Patchwork [08,of,10] outgoing: introduce "outgoinghooks" to avoid redundant outgoing check

login
register
mail settings
Submitter Katsunori FUJIWARA
Date March 5, 2014, 12:12 p.m.
Message ID <98753a1c33c34326dcc5.1394021533@juju>
Download mbox | patch
Permalink /patch/3845/
State Superseded
Headers show

Comments

Katsunori FUJIWARA - March 5, 2014, 12:12 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1394019743 -32400
#      Wed Mar 05 20:42:23 2014 +0900
# Node ID 98753a1c33c34326dcc5a23e8b83b29818e5f54c
# Parent  3fd386676d872e404dce6ca57ce739518a639bcb
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).

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2277,6 +2277,10 @@ 
 
     return cmd
 
+# a list of (ui, repo, 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()
 
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4332,6 +4332,7 @@ 
         cmdutil.checkunsupportedgraphflags([], opts)
         o = hg._outgoing(ui, repo, dest, opts)
         if o is None:
+            cmdutil.outgoinghooks(ui, repo, opts, o)
             return
 
         revdag = cmdutil.graphrevs(repo, o, opts)
@@ -4339,6 +4340,7 @@ 
         showparents = [ctx.node() for ctx in repo[None].parents()]
         cmdutil.displaygraph(ui, revdag, displayer, showparents,
                              graphmod.asciiedges)
+        cmdutil.outgoinghooks(ui, repo, opts, o)
         return 0
 
     if opts.get('bookmarks'):
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -575,6 +575,7 @@ 
     limit = cmdutil.loglimit(opts)
     o = _outgoing(ui, repo, dest, opts)
     if o is None:
+        cmdutil.outgoinghooks(ui, repo, opts, o)
         return recurse()
 
     if opts.get('newest_first'):
@@ -590,6 +591,7 @@ 
         count += 1
         displayer.show(repo[n])
     displayer.close()
+    cmdutil.outgoinghooks(ui, repo, opts, o)
     recurse()
     return 0 # exit code is zero since we found outgoing changes