D803: extdiff: use pager

quark (Jun Wu) phabricator at mercurial-scm.org
Fri Sep 22 19:13:39 EDT 2017


quark created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Now the pager extension is deprecated, there is no easy way to enable pager
  for extdiff. That makes it inconsistent with normal `hg diff` experience.
  Therefore use pager for extdiff commands.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/extdiff.py
  tests/test-extdiff.t

CHANGE DETAILS

diff --git a/tests/test-extdiff.t b/tests/test-extdiff.t
--- a/tests/test-extdiff.t
+++ b/tests/test-extdiff.t
@@ -109,6 +109,22 @@
   diffing */extdiff.*/a.2a13a4d2da36/a a.46c0e4daeb72/a (glob) (no-windows !)
   diff-like tools yield a non-zero exit code
 
+Pager should be used:
+
+  $ cat >> $TESTTMP/fakepager.py <<EOF
+  > import sys
+  > for line in sys.stdin:
+  >     sys.stdout.write('paged! %s' % line)
+  > sys.stdout.flush()
+  > EOF
+
+  $ hg falabala -c 1 --config ui.formatted=yes --config pager.pager="$PYTHON $TESTTMP/fakepager.py"
+  paged! * (glob)
+  [1]
+  $ hg extdiff -p echo -r 0 --config ui.formatted=yes --config pager.pager="$PYTHON $TESTTMP/fakepager.py"
+  paged! * (glob)
+  [1]
+
 issue3153: ensure using extdiff with removed subrepos doesn't crash:
 
   $ hg init suba
diff --git a/hgext/extdiff.py b/hgext/extdiff.py
--- a/hgext/extdiff.py
+++ b/hgext/extdiff.py
@@ -272,6 +272,7 @@
         cmdline = re.sub(regex, quote, cmdline)
 
         ui.debug('running %r in %s\n' % (cmdline, tmproot))
+        ui.pager('extdiff')
         ui.system(cmdline, cwd=tmproot, blockedtag='extdiff')
 
         for copy_fn, working_fn, st in fnsandstat:



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


More information about the Mercurial-devel mailing list