[PATCH 4 of 6] subrepo: speed up git push logic
Eric Eisner
ede at MIT.EDU
Thu Dec 9 15:53:27 CST 2010
# HG changeset patch
# User Eric Eisner <ede at mit.edu>
# Date 1291931534 18000
# Node ID 53341289eaf8f2c03e6df6baf633f4de28723811
# Parent dcaad69cfd6a44e777e633b470b6448c385d3487
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.
diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -813,8 +813,12 @@ class gitsubrepo(abstractsubrepo):
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
More information about the Mercurial-devel
mailing list