Patchwork [2,of,2,pager-tweaks] outgoing: avoid running pager until we're actually showing changes

login
register
mail settings
Submitter Augie Fackler
Date Feb. 21, 2017, 7 p.m.
Message ID <8f1cb445777d4daff036.1487703608@arthedain.pit.corp.google.com>
Download mbox | patch
Permalink /patch/18691/
State Accepted
Headers show

Comments

Augie Fackler - Feb. 21, 2017, 7 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1487693162 18000
#      Tue Feb 21 11:06:02 2017 -0500
# Node ID 8f1cb445777d4daff036b852b6bbcae741f8dfa4
# Parent  54759a9a01b70dc90fe8db95023f18244b50a7c4
outgoing: avoid running pager until we're actually showing changes

Consistent with the new behavior of incoming in the previous patch.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3641,13 +3641,13 @@  def outgoing(ui, repo, dest=None, **opts
     """
     if opts.get('graph'):
         cmdutil.checkunsupportedgraphflags([], opts)
-        ui.pager('outgoing')
         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)
+        ui.pager('outgoing')
         displayer = cmdutil.show_changeset(ui, repo, opts, buffered=True)
         cmdutil.displaygraph(ui, repo, revdag, displayer, graphmod.asciiedges)
         cmdutil.outgoinghooks(ui, repo, other, opts, o)
@@ -3660,13 +3660,12 @@  def outgoing(ui, repo, dest=None, **opts
         if 'bookmarks' not in other.listkeys('namespaces'):
             ui.warn(_("remote doesn't support bookmarks\n"))
             return 0
+        ui.status(_('comparing with %s\n') % util.hidepassword(dest))
         ui.pager('outgoing')
-        ui.status(_('comparing with %s\n') % util.hidepassword(dest))
         return bookmarks.outgoing(ui, repo, other)
 
     repo._subtoppath = ui.expandpath(dest or 'default-push', dest or 'default')
     try:
-        ui.pager('outgoing')
         return hg.outgoing(ui, repo, dest, opts)
     finally:
         del repo._subtoppath
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -872,6 +872,7 @@  def outgoing(ui, repo, dest, opts):
 
     if opts.get('newest_first'):
         o.reverse()
+    ui.pager('outgoing')
     displayer = cmdutil.show_changeset(ui, repo, opts)
     count = 0
     for n in o: