changeset 21051:1004d3cd65fd

outgoing: introduce "outgoinghooks" to avoid redundant outgoing check This patch introduces "outgoinghooks" to avoid redundant outgoing check for "hg outgoing" in other than "commands.outgoing" (or utility functions used by it).
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Wed, 16 Apr 2014 00:37:24 +0900
parents 025ec0f08cb6
children cde32cb5a565
files mercurial/cmdutil.py mercurial/commands.py mercurial/hg.py
diffstat 3 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Wed Apr 16 00:37:24 2014 +0900
+++ b/mercurial/cmdutil.py	Wed Apr 16 00:37:24 2014 +0900
@@ -2379,6 +2379,11 @@
 
     return cmd
 
+# a list of (ui, repo, otherpeer, opts, missing) functions called by
+# commands.outgoing.  "missing" is "missing" of the result of
+# "findcommonoutgoing()"
+outgoinghooks = util.hooks()
+
 # a list of (ui, repo) functions called by commands.summary
 summaryhooks = util.hooks()
 
--- a/mercurial/commands.py	Wed Apr 16 00:37:24 2014 +0900
+++ b/mercurial/commands.py	Wed Apr 16 00:37:24 2014 +0900
@@ -4355,6 +4355,7 @@
         cmdutil.checkunsupportedgraphflags([], opts)
         o, other = hg._outgoing(ui, repo, dest, opts)
         if not o:
+            cmdutil.outgoinghooks(ui, repo, other, opts, o)
             return
 
         revdag = cmdutil.graphrevs(repo, o, opts)
@@ -4362,6 +4363,7 @@
         showparents = [ctx.node() for ctx in repo[None].parents()]
         cmdutil.displaygraph(ui, revdag, displayer, showparents,
                              graphmod.asciiedges)
+        cmdutil.outgoinghooks(ui, repo, other, opts, o)
         return 0
 
     if opts.get('bookmarks'):
--- a/mercurial/hg.py	Wed Apr 16 00:37:24 2014 +0900
+++ b/mercurial/hg.py	Wed Apr 16 00:37:24 2014 +0900
@@ -600,6 +600,7 @@
     limit = cmdutil.loglimit(opts)
     o, other = _outgoing(ui, repo, dest, opts)
     if not o:
+        cmdutil.outgoinghooks(ui, repo, other, opts, o)
         return recurse()
 
     if opts.get('newest_first'):
@@ -615,6 +616,7 @@
         count += 1
         displayer.show(repo[n])
     displayer.close()
+    cmdutil.outgoinghooks(ui, repo, other, opts, o)
     recurse()
     return 0 # exit code is zero since we found outgoing changes