##// END OF EJS Templates
pager: move more behavior into core...
Augie Fackler -
r30993:9c2977ce default
parent child Browse files
Show More
@@ -60,13 +60,11 b' you can use --pager=<value>::'
60 60 '''
61 61 from __future__ import absolute_import
62 62
63 from mercurial.i18n import _
64 63 from mercurial import (
65 64 cmdutil,
66 65 commands,
67 66 dispatch,
68 67 extensions,
69 util,
70 68 )
71 69
72 70 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
@@ -78,15 +76,9 b" testedwith = 'ships-with-hg-core'"
78 76 def uisetup(ui):
79 77
80 78 def pagecmd(orig, ui, options, cmd, cmdfunc):
79 auto = options['pager'] == 'auto'
80 if auto and not ui.pageractive:
81 81 usepager = False
82 always = util.parsebool(options['pager'])
83 auto = options['pager'] == 'auto'
84
85 if always:
86 usepager = True
87 elif not auto:
88 usepager = False
89 else:
90 82 attend = ui.configlist('pager', 'attend', attended)
91 83 ignore = ui.configlist('pager', 'ignore')
92 84 cmds, _ = cmdutil.findcmd(cmd, commands.table)
@@ -112,10 +104,4 b' def uisetup(ui):'
112 104 extensions.wrapfunction(dispatch, '_runcommand', pagecmd)
113 105 extensions.afterloaded('color', afterloaded)
114 106
115 def extsetup(ui):
116 commands.globalopts.append(
117 ('', 'pager', 'auto',
118 _("when to paginate (boolean, always, auto, or never)"),
119 _('TYPE')))
120
121 107 attended = ['annotate', 'cat', 'diff', 'export', 'glog', 'log', 'qdiff']
@@ -93,6 +93,8 b' globalopts = ['
93 93 ('', 'version', None, _('output version information and exit')),
94 94 ('h', 'help', None, _('display help and exit')),
95 95 ('', 'hidden', False, _('consider hidden changesets')),
96 ('', 'pager', 'auto',
97 _("when to paginate (boolean, always, auto, or never)"), _('TYPE')),
96 98 ]
97 99
98 100 dryrunopts = [('n', 'dry-run', None,
@@ -819,6 +819,8 b' def _dispatch(req):'
819 819
820 820 def _runcommand(ui, options, cmd, cmdfunc):
821 821 """Run a command function, possibly with profiling enabled."""
822 if util.parsebool(options['pager']):
823 ui.pager('internal-always-' + cmd)
822 824 try:
823 825 return cmdfunc()
824 826 except error.SignatureError:
@@ -138,6 +138,7 b' Show the global options'
138 138 --help
139 139 --hidden
140 140 --noninteractive
141 --pager
141 142 --profile
142 143 --quiet
143 144 --repository
@@ -171,6 +172,7 b' Show the options for the "serve" command'
171 172 --ipv6
172 173 --name
173 174 --noninteractive
175 --pager
174 176 --pid-file
175 177 --port
176 178 --prefix
@@ -543,6 +543,8 b' hide outer repo'
543 543 --version output version information and exit
544 544 -h --help display help and exit
545 545 --hidden consider hidden changesets
546 --pager TYPE when to paginate (boolean, always, auto, or never)
547 (default: auto)
546 548
547 549
548 550
@@ -578,6 +580,8 b' hide outer repo'
578 580 --version output version information and exit
579 581 -h --help display help and exit
580 582 --hidden consider hidden changesets
583 --pager TYPE when to paginate (boolean, always, auto, or never)
584 (default: auto)
581 585
582 586
583 587
@@ -856,6 +860,8 b' extension help itself'
856 860 --version output version information and exit
857 861 -h --help display help and exit
858 862 --hidden consider hidden changesets
863 --pager TYPE when to paginate (boolean, always, auto, or never)
864 (default: auto)
859 865
860 866 Make sure that single '-v' option shows help and built-ins only for 'dodo' command
861 867 $ hg help -v dodo
@@ -889,6 +895,8 b" Make sure that single '-v' option shows "
889 895 --version output version information and exit
890 896 -h --help display help and exit
891 897 --hidden consider hidden changesets
898 --pager TYPE when to paginate (boolean, always, auto, or never)
899 (default: auto)
892 900
893 901 In case when extension name doesn't match any of its commands,
894 902 help message should ask for '-v' to get list of built-in aliases
@@ -960,6 +968,8 b" help options '-v' and '-v -e' should be "
960 968 --version output version information and exit
961 969 -h --help display help and exit
962 970 --hidden consider hidden changesets
971 --pager TYPE when to paginate (boolean, always, auto, or never)
972 (default: auto)
963 973
964 974 $ hg help -v -e dudu
965 975 dudu extension -
@@ -992,6 +1002,8 b" help options '-v' and '-v -e' should be "
992 1002 --version output version information and exit
993 1003 -h --help display help and exit
994 1004 --hidden consider hidden changesets
1005 --pager TYPE when to paginate (boolean, always, auto, or never)
1006 (default: auto)
995 1007
996 1008 Disabled extension commands:
997 1009
@@ -1,4 +1,9 b''
1 1 #require docutils gettext
2 2
3 Error: the current ro localization has some rst defects exposed by
4 moving pager to core. These two warnings about references are expected
5 until the localization is corrected.
3 6 $ $TESTDIR/check-gendoc ro
4 7 checking for parse errors
8 gendoc.txt:55: (WARNING/2) Inline interpreted text or phrase reference start-string without end-string.
9 gendoc.txt:55: (WARNING/2) Inline interpreted text or phrase reference start-string without end-string.
@@ -326,6 +326,8 b' Test short command list with verbose opt'
326 326 --version output version information and exit
327 327 -h --help display help and exit
328 328 --hidden consider hidden changesets
329 --pager TYPE when to paginate (boolean, always, auto, or never)
330 (default: auto)
329 331
330 332 (use 'hg help' for the full list of commands)
331 333
@@ -422,6 +424,8 b' Verbose help for add'
422 424 --version output version information and exit
423 425 -h --help display help and exit
424 426 --hidden consider hidden changesets
427 --pager TYPE when to paginate (boolean, always, auto, or never)
428 (default: auto)
425 429
426 430 Test the textwidth config option
427 431
@@ -2523,6 +2527,9 b' Dish up an empty repo; serve it cold.'
2523 2527 <tr><td></td>
2524 2528 <td>--hidden</td>
2525 2529 <td>consider hidden changesets</td></tr>
2530 <tr><td></td>
2531 <td>--pager TYPE</td>
2532 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2526 2533 </table>
2527 2534
2528 2535 </div>
@@ -2718,6 +2725,9 b' Dish up an empty repo; serve it cold.'
2718 2725 <tr><td></td>
2719 2726 <td>--hidden</td>
2720 2727 <td>consider hidden changesets</td></tr>
2728 <tr><td></td>
2729 <td>--pager TYPE</td>
2730 <td>when to paginate (boolean, always, auto, or never) (default: auto)</td></tr>
2721 2731 </table>
2722 2732
2723 2733 </div>
General Comments 0
You need to be logged in to leave comments. Login now