diff mercurial/localrepo.py @ 11493:cc4e2a7ca23f

Merge with stable
author Martin Geisler <mg@aragost.com>
date Fri, 02 Jul 2010 11:30:57 +0200
parents ee1ed6afac21
children b602a95c21ec
line wrap: on
line diff
--- a/mercurial/localrepo.py	Mon Jun 21 17:02:48 2010 -0300
+++ b/mercurial/localrepo.py	Fri Jul 02 11:30:57 2010 +0200
@@ -1199,7 +1199,7 @@
                                        "other repository doesn't support "
                                        "changegroupsubset."))
                 cg = remote.changegroupsubset(fetch, heads, 'pull')
-            return self.addchangegroup(cg, 'pull', remote.url())
+            return self.addchangegroup(cg, 'pull', remote.url(), lock=lock)
         finally:
             lock.release()
 
@@ -1233,8 +1233,8 @@
             ret = discovery.prepush(self, remote, force, revs, newbranch)
             if ret[0] is not None:
                 cg, remote_heads = ret
-                # here, we return an integer indicating remote head count change
-                return remote.addchangegroup(cg, 'push', self.url())
+                # we return an integer indicating remote head count change
+                return remote.addchangegroup(cg, 'push', self.url(), lock=lock)
             # and here we return 0 for "nothing to push" or 1 for
             # "something to push but I refuse"
             return ret[1]
@@ -1620,7 +1620,7 @@
 
         return util.chunkbuffer(gengroup())
 
-    def addchangegroup(self, source, srctype, url, emptyok=False):
+    def addchangegroup(self, source, srctype, url, emptyok=False, lock=None):
         """Add the changegroup returned by source.read() to this repo.
         srctype is a string like 'push', 'pull', or 'unbundle'.  url is
         the URL of the repo where this changegroup is coming from.
@@ -1760,6 +1760,8 @@
             tr.close()
         finally:
             tr.release()
+            if lock:
+                lock.release()
 
         if changesets > 0:
             # forcefully update the on-disk branch cache