annotate: migrate to modern pager API
authorAugie Fackler <augie@google.com>
Mon, 06 Feb 2017 22:52:47 -0500
changeset 30999 334cf948c758
parent 30998 75e325ce538e
child 31000 84ec2d6a2831
annotate: migrate to modern pager API
hgext/pager.py
mercurial/commands.py
tests/test-pager.t
--- a/hgext/pager.py	Mon Feb 06 23:55:54 2017 -0500
+++ b/hgext/pager.py	Mon Feb 06 22:52:47 2017 -0500
@@ -110,4 +110,4 @@
         extensions.wrapfunction(dispatch, '_runcommand', pagecmd)
     extensions.afterloaded('color', afterloaded)
 
-attended = ['annotate', 'cat', 'diff', 'export', 'glog', 'log', 'qdiff']
+attended = ['cat', 'diff', 'export', 'glog', 'log', 'qdiff']
--- a/mercurial/commands.py	Mon Feb 06 23:55:54 2017 -0500
+++ b/mercurial/commands.py	Mon Feb 06 22:52:47 2017 -0500
@@ -361,6 +361,7 @@
 
     Returns 0 on success.
     """
+    ui.pager('annotate')
     if not pats:
         raise error.Abort(_('at least one filename or pattern is required'))
 
--- a/tests/test-pager.t	Mon Feb 06 23:55:54 2017 -0500
+++ b/tests/test-pager.t	Mon Feb 06 22:52:47 2017 -0500
@@ -164,3 +164,43 @@
   $ hg fortytwo --pager=on
   paged! '42\n'
   [42]
+
+A command that asks for paging using ui.pager() directly works:
+  $ hg blame a
+  paged! ' 0: a\n'
+  paged! ' 1: a 1\n'
+  paged! ' 2: a 2\n'
+  paged! ' 3: a 3\n'
+  paged! ' 4: a 4\n'
+  paged! ' 5: a 5\n'
+  paged! ' 6: a 6\n'
+  paged! ' 7: a 7\n'
+  paged! ' 8: a 8\n'
+  paged! ' 9: a 9\n'
+  paged! '10: a 10\n'
+but not with HGPLAIN
+  $ HGPLAIN=1 hg blame a
+   0: a
+   1: a 1
+   2: a 2
+   3: a 3
+   4: a 4
+   5: a 5
+   6: a 6
+   7: a 7
+   8: a 8
+   9: a 9
+  10: a 10
+explicit flags work too:
+  $ hg blame --pager=no a
+   0: a
+   1: a 1
+   2: a 2
+   3: a 3
+   4: a 4
+   5: a 5
+   6: a 6
+   7: a 7
+   8: a 8
+   9: a 9
+  10: a 10