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.
--- 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