# HG changeset patch # User Pierre-Yves David # Date 1322440333 -3600 # Node ID a348739da8f07914f59e9ddbb6e51df2f94b4d45 # Parent 9df9444e96ec6df9f870cdcfb338e33c025841cd addchangegroup: remove the lock argument on the addchangegroup methods This argument is no longer require. post lock release code is now handled with dedicated post release callback code in lock itself. diff -r 9df9444e96ec -r a348739da8f0 mercurial/commands.py --- a/mercurial/commands.py Mon Nov 28 01:18:15 2011 +0100 +++ b/mercurial/commands.py Mon Nov 28 01:32:13 2011 +0100 @@ -5575,8 +5575,7 @@ for fname in fnames: f = url.open(ui, fname) gen = changegroup.readbundle(f, fname) - modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname, - lock=lock) + modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname) bookmarks.updatecurrentbookmark(repo, wc.node(), wc.branch()) finally: lock.release() diff -r 9df9444e96ec -r a348739da8f0 mercurial/localrepo.py --- a/mercurial/localrepo.py Mon Nov 28 01:18:15 2011 +0100 +++ b/mercurial/localrepo.py Mon Nov 28 01:32:13 2011 +0100 @@ -1527,8 +1527,7 @@ "changegroupsubset.")) else: cg = remote.changegroupsubset(fetch, heads, 'pull') - result = self.addchangegroup(cg, 'pull', remote.url(), - lock=lock) + result = self.addchangegroup(cg, 'pull', remote.url()) phases.advanceboundary(self, 0, common) finally: lock.release() @@ -1583,8 +1582,7 @@ ret = remote.unbundle(cg, remote_heads, 'push') else: # we return an integer indicating remote head count change - ret = remote.addchangegroup(cg, 'push', self.url(), - lock=lock) + ret = remote.addchangegroup(cg, 'push', self.url()) # if we don't push, the common data is already useful # everything exchange is public for now phases.advanceboundary(self, 0, fut) @@ -1849,12 +1847,10 @@ return changegroup.unbundle10(util.chunkbuffer(gengroup()), 'UN') - def addchangegroup(self, source, srctype, url, emptyok=False, lock=None): + def addchangegroup(self, source, srctype, url, emptyok=False): """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. - If lock is not None, the function takes ownership of the lock - and releases it after the changegroup is added. Return an integer summarizing the change to this repo: - nothing changed or no source: 0 @@ -2019,8 +2015,6 @@ finally: tr.release() - if lock: - lock.release() # never return 0 here: if dh < 0: return dh - 1 diff -r 9df9444e96ec -r a348739da8f0 mercurial/sshserver.py --- a/mercurial/sshserver.py Mon Nov 28 01:18:15 2011 +0100 +++ b/mercurial/sshserver.py Mon Nov 28 01:32:13 2011 +0100 @@ -142,8 +142,8 @@ self.sendresponse("") cg = changegroup.unbundle10(self.fin, "UN") - r = self.repo.addchangegroup(cg, 'serve', self._client(), - lock=self.lock) + r = self.repo.addchangegroup(cg, 'serve', self._client()) + self.lock.release() return str(r) def _client(self): diff -r 9df9444e96ec -r a348739da8f0 mercurial/wireproto.py --- a/mercurial/wireproto.py Mon Nov 28 01:18:15 2011 +0100 +++ b/mercurial/wireproto.py Mon Nov 28 01:32:13 2011 +0100 @@ -574,8 +574,7 @@ gen = changegroupmod.readbundle(fp, None) try: - r = repo.addchangegroup(gen, 'serve', proto._client(), - lock=lock) + r = repo.addchangegroup(gen, 'serve', proto._client()) except util.Abort, inst: sys.stderr.write("abort: %s\n" % inst) finally: