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

login
register
mail settings
Submitter Katsunori FUJIWARA
Date April 15, 2014, 3:52 p.m.
Message ID <d6e861694142d91195ad.1397577151@juju>
Download mbox | patch
Permalink /patch/4369/
State Accepted
Commit 1004d3cd65fda8fcc9a2394b26e6251aa0a45336
Headers show

Comments

Katsunori FUJIWARA - April 15, 2014, 3:52 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1397576244 -32400
#      Wed Apr 16 00:37:24 2014 +0900
# Node ID d6e861694142d91195adf094f9604543c7ee5f56
# Parent  8808149819512acecf299d799b6925eb5ad8f6f0
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
@@ -2324,6 +2324,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()
 
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4389,6 +4389,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)
@@ -4396,6 +4397,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'):
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -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