Patchwork D574: pager: do not start pager if `ui` has been `pushbuffer`-ed

login
register
mail settings
Submitter phabricator
Date Aug. 31, 2017, 6:23 a.m.
Message ID <f2c9d36641034ce183274f95724dfa5f@localhost.localdomain>
Download mbox | patch
Permalink /patch/23531/
State Not Applicable
Headers show

Comments

phabricator - Aug. 31, 2017, 6:23 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG31a2eb0f74e5: pager: do not start pager if `ui` has been `pushbuffer`-ed (authored by quark).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D574?vs=1460&id=1468

REVISION DETAIL
  https://phab.mercurial-scm.org/D574

AFFECTED FILES
  mercurial/ui.py
  tests/test-pager.t

CHANGE DETAILS




To: quark, #hg-reviewers
Cc: martinvonz, mercurial-devel

Patch

diff --git a/tests/test-pager.t b/tests/test-pager.t
--- a/tests/test-pager.t
+++ b/tests/test-pager.t
@@ -340,6 +340,20 @@ 
    9: a 9
   10: a 10
 
+During pushbuffer, pager should not start:
+  $ cat > $TESTTMP/pushbufferpager.py <<EOF
+  > def uisetup(ui):
+  >     ui.pushbuffer()
+  >     ui.pager('mycmd')
+  >     ui.write('content\n')
+  >     ui.write(ui.popbuffer())
+  > EOF
+
+  $ echo append >> a
+  $ hg --config extensions.pushbuffer=$TESTTMP/pushbufferpager.py status --color=off
+  content
+  paged! 'M a\n'
+
 Environment variables like LESS and LV are set automatically:
   $ cat > $TESTTMP/printlesslv.py <<EOF
   > from __future__ import absolute_import
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -962,6 +962,7 @@ 
             # formatted() will need some adjustment.
             or not self.formatted()
             or self.plain()
+            or self._buffers
             # TODO: expose debugger-enabled on the UI object
             or '--debugger' in pycompat.sysargv):
             # We only want to paginate if the ui appears to be