# HG changeset patch # User mpm@selenic.com # Date 1126147031 25200 # Node ID 920682a532dfbdd9d0823d2326d26941e5049efd # Parent 4644df4944ffa661f54128b9e7bee3472bcf98c3 Tighten up clone locking Add a lock on the destination, expand comment on source lock diff -r 4644df4944ff -r 920682a532df mercurial/commands.py --- a/mercurial/commands.py Wed Sep 07 19:30:23 2005 -0700 +++ b/mercurial/commands.py Wed Sep 07 19:37:11 2005 -0700 @@ -605,10 +605,14 @@ if copyfile is not shutil.copy2: ui.note("cloning by hardlink\n") - # we use a lock here because because we're not nicely ordered - l = lock.lock(os.path.join(source, ".hg", "lock")) + # we use a lock here because if we race with commit, we can + # end up with extra data in the cloned revlogs that's not + # pointed to by changesets, thus causing verify to fail + l1 = lock.lock(os.path.join(source, ".hg", "lock")) + # and here to avoid premature writing to the target os.mkdir(os.path.join(dest, ".hg")) + l2 = lock.lock(os.path.join(dest, ".hg", "lock")) files = "data 00manifest.d 00manifest.i 00changelog.d 00changelog.i" for f in files.split():