开发者

Is it safe to ignore errors hg cloning from a write-protected source repo?

I have a Mercurial repository on a write-protected USB thumb drive, from which I want to clone to a workstation. I thought this would be a "one-way" operation, but it's not: after inserting the thumb drive into the workstation, and trying hg clone E:\my_repo, I get an error indicating that Mercurial is trying to write to the source repo. (This is on Windows XP, with the following error details: "hg.exe - Write Protect Error / The disk cannot be written to because it is write protected. Please remove the write protection from the volume in drive E:.")

Interestingly, selecting "Continue" among the error dialog options-- which effectively seems to mean, "ignore the error and 开发者_运维问答continue what you were doing"-- seems to allow the clone to complete successfully. Or at least I can't see anything wrong with the resulting cloned repo.

My questions are: (1) why does Mercurial need to write to the source when cloning? And (2) is it indeed safe to simply continue and ignore whatever Mercurial fails to write to the source?


There are four ways Mercurial clones:

  • hardlink: used for clones on the same volume where supported
  • copy: used for clones from filesystem to filesystem
  • pull: used for cloning from remote machines
  • stream: used for cloning on a high-speed LAN (see --uncompressed)

All of these methods but pull try to lock the source repository to avoid any commits in the middle of the clone that might corrupt it. Since that's not a danger for you, it's safe to ignore the error (though it's not a given that Mercurial will be happy with the failure to lock).

Alternately, you can specify --pull to do a clone where locking isn't needed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜