diff mercurial/hg.py @ 15887:12dea4d998ec

bookmarks: primarily use repo lock, not wlock Bookmarks are repository data, not working directory data. Only the current bookmark is working directory data. Some lock shuffling is required to avoid lockout between the initial mock lock and locking of the localrepo instance that is created after copying.
author Mads Kiilerich <mads@kiilerich.com>
date Fri, 13 Jan 2012 02:30:43 +0100
parents cd956049fc14
children 60cb4f381a78
line wrap: on
line diff
--- a/mercurial/hg.py	Fri Jan 13 02:29:38 2012 +0100
+++ b/mercurial/hg.py	Fri Jan 13 02:30:43 2012 +0100
@@ -279,7 +279,7 @@
             if self.dir_:
                 self.rmtree(self.dir_, True)
 
-    srclock = destlock = dircleanup = None
+    srclock = destwlock = destlock = dircleanup = None
     try:
         abspath = origsource
         if islocal(origsource):
@@ -325,6 +325,11 @@
             # we need to re-init the repo after manually copying the data
             # into it
             destrepo = repository(remoteui(ui, peeropts), dest)
+            # we need full recursive locking of the new repo instance
+            destwlock = destrepo.wlock()
+            if destlock:
+                destlock.release() # a little race condition - but no deadlock
+            destlock = destrepo.lock()
             srcrepo.hook('outgoing', source='clone',
                           node=node.hex(node.nullid))
         else:
@@ -401,7 +406,7 @@
 
         return srcrepo, destrepo
     finally:
-        release(srclock, destlock)
+        release(srclock, destlock, destwlock)
         if dircleanup is not None:
             dircleanup.cleanup()