addchangegroup: ony queue hooks when we have changesets
authorMatt Mackall <mpm@selenic.com>
Wed, 30 Nov 2011 15:33:44 -0600
changeset 15586 98ec09582f72
parent 15585 a348739da8f0
child 15587 809d5d30e377
addchangegroup: ony queue hooks when we have changesets
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Mon Nov 28 01:32:13 2011 +0100
+++ b/mercurial/localrepo.py	Wed Nov 30 15:33:44 2011 -0600
@@ -2000,8 +2000,8 @@
 
             tr.close()
 
-            def postaddchangegroup():
-                if changesets > 0:
+            if changesets > 0:
+                def runhooks():
                     # forcefully update the on-disk branch cache
                     self.ui.debug("updating the branch cache\n")
                     self.updatebranchcache()
@@ -2011,7 +2011,7 @@
                     for n in added:
                         self.hook("incoming", node=hex(n), source=srctype,
                                   url=url)
-            self._postrelease(postaddchangegroup)
+                self._postrelease(runhooks)
 
         finally:
             tr.release()