bookmarks: backout locking change in 12dea4d998ec
authorMatt Mackall <mpm@selenic.com>
Wed, 18 Jan 2012 14:56:52 -0600
changeset 15908 60cb4f381a78
parent 15907 51fc43253a52
child 15909 8435fa20dff9
bookmarks: backout locking change in 12dea4d998ec Repo lock only applies to data in .hg/store/
mercurial/bookmarks.py
mercurial/hg.py
--- a/mercurial/bookmarks.py	Tue Jan 17 20:23:23 2012 +0100
+++ b/mercurial/bookmarks.py	Wed Jan 18 14:56:52 2012 -0600
@@ -84,7 +84,7 @@
             raise util.Abort(_("bookmark '%s' contains illegal "
                 "character" % mark))
 
-    lock = repo.lock()
+    wlock = repo.wlock()
     try:
 
         file = repo.opener('bookmarks', 'w', atomictemp=True)
@@ -99,7 +99,7 @@
             pass
 
     finally:
-        lock.release()
+        wlock.release()
 
 def setcurrent(repo, mark):
     '''Set the name of the bookmark that we are currently on
@@ -117,13 +117,13 @@
         raise util.Abort(_("bookmark '%s' contains illegal "
             "character" % mark))
 
-    lock = repo.lock()
+    wlock = repo.wlock()
     try:
         file = repo.opener('bookmarks.current', 'w', atomictemp=True)
         file.write(encoding.fromlocal(mark))
         file.close()
     finally:
-        lock.release()
+        wlock.release()
     repo._bookmarkcurrent = mark
 
 def updatecurrentbookmark(repo, oldnode, curbranch):
@@ -162,7 +162,7 @@
     return d
 
 def pushbookmark(repo, key, old, new):
-    lock = repo.lock()
+    w = repo.wlock()
     try:
         marks = repo._bookmarks
         if hex(marks.get(key, '')) != old:
@@ -176,7 +176,7 @@
         write(repo)
         return True
     finally:
-        lock.release()
+        w.release()
 
 def updatefromremote(ui, repo, remote, path):
     ui.debug("checking for updated bookmarks\n")
--- a/mercurial/hg.py	Tue Jan 17 20:23:23 2012 +0100
+++ b/mercurial/hg.py	Wed Jan 18 14:56:52 2012 -0600
@@ -279,7 +279,7 @@
             if self.dir_:
                 self.rmtree(self.dir_, True)
 
-    srclock = destwlock = destlock = dircleanup = None
+    srclock = destlock = dircleanup = None
     try:
         abspath = origsource
         if islocal(origsource):
@@ -325,11 +325,6 @@
             # 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:
@@ -406,7 +401,7 @@
 
         return srcrepo, destrepo
     finally:
-        release(srclock, destlock, destwlock)
+        release(srclock, destlock)
         if dircleanup is not None:
             dircleanup.cleanup()