[PATCH] Fix to remove clone lock

Stephen Darnell sdarnell at esmertec.com
Sat Aug 27 15:49:08 CDT 2005


Reviving my win32 hardlink changes, I discovered that the
new lock gets copied to destination clone, and result
in subsequent operations blocking.

Attached is a fix. (includes 2 trailing white space changes)

BTW Why does the unix lock code use symlinks rather than 
the regular files (that it drops back to)?

Regards,
  Stephen
 
-------------- next part --------------
# HG changeset patch
# User Stephen Darnell
# Node ID 6914baf96ecd34bbca3544444e0f2c2819aec86b
# Parent  3a1a46dcd3978a790f4c56486124880dbefeb1d4
Remove the lock file copied during clone (was the source lock file)

diff -r 3a1a46dcd397 -r 6914baf96ecd mercurial/commands.py
--- a/mercurial/commands.py	Sat Aug 27 08:55:10 2005
+++ b/mercurial/commands.py	Sat Aug 27 20:44:06 2005
@@ -580,10 +580,12 @@
 
         util.copytree(os.path.join(source, ".hg"), os.path.join(dest, ".hg"),
                       copyfile)
-        try:
-            os.unlink(os.path.join(dest, ".hg", "dirstate"))
-        except OSError:
-            pass
+
+        for fn in "dirstate", "lock":
+            try:
+                os.unlink(os.path.join(dest, ".hg", fn))
+            except OSError:
+                pass
 
         repo = hg.repository(ui, dest)
 
@@ -1348,14 +1350,14 @@
                    ('unknown', '?', u)]
 
     end = opts['print0'] and '\0' or '\n'
-    
+
     for opt, char, changes in ([ct for ct in changetypes if opts[ct[0]]]
                                or changetypes):
         if opts['strip']:
             format = "%%s%s" % end
         else:
             format = "%s %%s%s" % (char, end);
-            
+
         for f in changes:
             ui.write(format % f)
 


More information about the Mercurial mailing list