Search code examples
mercurialclonedvcs

Is it safe to update after error in the middle of clone?


Getting some zlib error in the middle of cloning big (4 GB) repo from Mercurial (Kiln).

What should(may) I do next? Delete and try from the beginning, or can I just hg pull -u?

Will local repository be in consistent state after some error in the middle of cloning?

update to clarify question: clone of repository was successful, but clone of some subrepository failed. Does this change anything?


Solution

  • If you encounter an error while cloning a big repository, then Mercurial will automatically abort the transaction. When a transaction is rolled back, Mercurial will clean up everything. For hg clone, this unfortunately means that the changesets that were already downloaded are gone. So you can safely re-clone.

    However, from the way you put your question, it sounds like there is something left after the abort. So I guess you started a hg pull that was aborted mid-way? The same applied to pull: an abort will roll back the transaction and you can safely re-start the hg pull.

    An aborted pull looks like this:

    $ hg pull http://localhost:8000
    pulling from http://localhost:8000/
    searching for changes
    adding changesets
    transaction abort!                                                              
    rollback completed                                                              
    abort: stream ended unexpectedly (got 12 bytes, expected 503)                   
    

    I started hg serve on my machine and started a pull from that server. I then killed hg serve in the middle of the pull. The client aborted and rolled back the transaction.