changeset 13109:53341289eaf8

subrepo: speed up git push logic In many common cases where the subrepo is up to date with the remote repo, hg push will only need to run one git-branch command to see that nothing needs to be pushed.
author Eric Eisner <ede@mit.edu>
date Thu, 09 Dec 2010 16:52:14 -0500
parents dcaad69cfd6a
children cad35f06c031
files mercurial/subrepo.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/subrepo.py	Thu Dec 09 16:52:14 2010 -0500
+++ b/mercurial/subrepo.py	Thu Dec 09 16:52:14 2010 -0500
@@ -813,8 +813,12 @@
     def push(self, force):
         # if a branch in origin contains the revision, nothing to do
         current, branch2rev, rev2branch = self._gitbranchmap()
+        if self._state[1] in rev2branch:
+            for b in rev2branch[self._state[1]]:
+                if b.startswith('remotes/origin/'):
+                    return True
         for b, revision in branch2rev.iteritems():
-            if b.startswith('remotes/origin'):
+            if b.startswith('remotes/origin/'):
                 if self._gitisancestor(self._state[1], revision):
                     return True
         # otherwise, try to push the currently checked out branch