[PATCH 2 of 3] addchangegroup: use a postrelease callback to call changegroup hook
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Mon Nov 28 08:13:33 CST 2011
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1322439495 -3600
# Node ID b9401c8120aec346e6cae02dee958707df28959b
# Parent e376bca0c45451b7b595697de0cff3f82a277729
addchangegroup: use a postrelease callback to call changegroup hook
This is will allow addchangegroup to drop lock related code.
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -2003,21 +2003,24 @@
cl.finalize(trp)
tr.close()
+
+ def postaddchangegroup():
+ if changesets > 0:
+ # forcefully update the on-disk branch cache
+ self.ui.debug("updating the branch cache\n")
+ self.updatebranchcache()
+ self.hook("changegroup", node=hex(cl.node(clstart)),
+ source=srctype, url=url)
+
+ for n in added:
+ self.hook("incoming", node=hex(n), source=srctype,
+ url=url)
+ self._postrelease(postaddchangegroup)
+
finally:
tr.release()
if lock:
lock.release()
-
- if changesets > 0:
- # forcefully update the on-disk branch cache
- self.ui.debug("updating the branch cache\n")
- self.updatebranchcache()
- self.hook("changegroup", node=hex(cl.node(clstart)),
- source=srctype, url=url)
-
- for n in added:
- self.hook("incoming", node=hex(n), source=srctype, url=url)
-
# never return 0 here:
if dh < 0:
return dh - 1
More information about the Mercurial-devel
mailing list