changeset 14214:c5db85676c38

summary: run discovery only once for in/out against same repo Reuses the result of findcommonincoming if default and default-push are the same.
author Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
date Fri, 06 May 2011 14:45:13 +0200
parents 30273f0c776b
children 474179077ae0
files mercurial/commands.py
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Fri May 06 14:44:18 2011 +0200
+++ b/mercurial/commands.py	Fri May 06 14:45:13 2011 +0200
@@ -4016,17 +4016,21 @@
         revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev'))
         ui.debug('comparing with %s\n' % util.hidepassword(source))
         repo.ui.pushbuffer()
-        common, incoming, rheads = discovery.findcommonincoming(repo, other)
+        commoninc = discovery.findcommonincoming(repo, other)
+        _common, incoming, _rheads = commoninc
         repo.ui.popbuffer()
         if incoming:
             t.append(_('1 or more incoming'))
 
         dest, branches = hg.parseurl(ui.expandpath('default-push', 'default'))
         revs, checkout = hg.addbranchrevs(repo, repo, branches, None)
-        other = hg.repository(hg.remoteui(repo, {}), dest)
-        ui.debug('comparing with %s\n' % util.hidepassword(dest))
+        if source != dest:
+            other = hg.repository(hg.remoteui(repo, {}), dest)
+            commoninc = None
+            ui.debug('comparing with %s\n' % util.hidepassword(dest))
         repo.ui.pushbuffer()
-        common, outheads = discovery.findcommonoutgoing(repo, other)
+        common, outheads = discovery.findcommonoutgoing(repo, other,
+                                                        commoninc=commoninc)
         repo.ui.popbuffer()
         o = repo.changelog.findmissing(common=common, heads=outheads)
         if o: