# HG changeset patch # User FUJIWARA Katsunori # Date 2014-04-15 15:37:24 # Node ID 1004d3cd65fda8fcc9a2394b26e6251aa0a45336 # Parent 025ec0f08cb60ca50a5b342ccc006f7a8fa30ab2 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). diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2379,6 +2379,11 @@ def command(table): 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 @@ -4355,6 +4355,7 @@ def outgoing(ui, repo, dest=None, **opts 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 @@ def outgoing(ui, repo, dest=None, **opts 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 @@ def outgoing(ui, repo, dest, opts): 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 @@ def outgoing(ui, repo, dest, opts): 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