##// 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 from __future__ import absolute_import
61 from __future__ import absolute_import
62
62
63 from mercurial.i18n import _
64 from mercurial import (
63 from mercurial import (
65 cmdutil,
64 cmdutil,
66 commands,
65 commands,
67 dispatch,
66 dispatch,
68 extensions,
67 extensions,
69 util,
70 )
68 )
71
69
72 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
70 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
@@ -78,15 +76,9 b" testedwith = 'ships-with-hg-core'"
78 def uisetup(ui):
76 def uisetup(ui):
79
77
80 def pagecmd(orig, ui, options, cmd, cmdfunc):
78 def pagecmd(orig, ui, options, cmd, cmdfunc):
81 usepager = False
82 always = util.parsebool(options['pager'])
83 auto = options['pager'] == 'auto'
79 auto = options['pager'] == 'auto'
84
80 if auto and not ui.pageractive:
85 if always:
86 usepager = True
87 elif not auto:
88 usepager = False
81 usepager = False
89 else:
90 attend = ui.configlist('pager', 'attend', attended)
82 attend = ui.configlist('pager', 'attend', attended)
91 ignore = ui.configlist('pager', 'ignore')
83 ignore = ui.configlist('pager', 'ignore')
92 cmds, _ = cmdutil.findcmd(cmd, commands.table)
84 cmds, _ = cmdutil.findcmd(cmd, commands.table)
@@ -101,8 +93,8 b' def uisetup(ui):'
101 usepager = True
93 usepager = True
102 break
94 break
103
95
104 if usepager:
96 if usepager:
105 ui.pager('extension-via-attend-' + cmd)
97 ui.pager('extension-via-attend-' + cmd)
106 return orig(ui, options, cmd, cmdfunc)
98 return orig(ui, options, cmd, cmdfunc)
107
99
108 # Wrap dispatch._runcommand after color is loaded so color can see
100 # Wrap dispatch._runcommand after color is loaded so color can see
@@ -112,10 +104,4 b' def uisetup(ui):'
112 extensions.wrapfunction(dispatch, '_runcommand', pagecmd)
104 extensions.wrapfunction(dispatch, '_runcommand', pagecmd)
113 extensions.afterloaded('color', afterloaded)
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 attended = ['annotate', 'cat', 'diff', 'export', 'glog', 'log', 'qdiff']
107 attended = ['annotate', 'cat', 'diff', 'export', 'glog', 'log', 'qdiff']
@@ -93,6 +93,8 b' globalopts = ['
93 ('', 'version', None, _('output version information and exit')),
93 ('', 'version', None, _('output version information and exit')),
94 ('h', 'help', None, _('display help and exit')),
94 ('h', 'help', None, _('display help and exit')),
95 ('', 'hidden', False, _('consider hidden changesets')),
95 ('', 'hidden', False, _('consider hidden changesets')),
96 ('', 'pager', 'auto',
97 _("when to paginate (boolean, always, auto, or never)"), _('TYPE')),
96 ]
98 ]
97
99
98 dryrunopts = [('n', 'dry-run', None,
100 dryrunopts = [('n', 'dry-run', None,
@@ -819,6 +819,8 b' def _dispatch(req):'
819
819
820 def _runcommand(ui, options, cmd, cmdfunc):
820 def _runcommand(ui, options, cmd, cmdfunc):
821 """Run a command function, possibly with profiling enabled."""
821 """Run a command function, possibly with profiling enabled."""
822 if util.parsebool(options['pager']):
823 ui.pager('internal-always-' + cmd)
822 try:
824 try:
823 return cmdfunc()
825 return cmdfunc()
824 except error.SignatureError:
826 except error.SignatureError:
@@ -138,6 +138,7 b' Show the global options'
138 --help
138 --help
139 --hidden
139 --hidden
140 --noninteractive
140 --noninteractive
141 --pager
141 --profile
142 --profile
142 --quiet
143 --quiet
143 --repository
144 --repository
@@ -171,6 +172,7 b' Show the options for the "serve" command'
171 --ipv6
172 --ipv6
172 --name
173 --name
173 --noninteractive
174 --noninteractive
175 --pager
174 --pid-file
176 --pid-file
175 --port
177 --port
176 --prefix
178 --prefix
@@ -543,6 +543,8 b' hide outer repo'
543 --version output version information and exit
543 --version output version information and exit
544 -h --help display help and exit
544 -h --help display help and exit
545 --hidden consider hidden changesets
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 --version output version information and exit
580 --version output version information and exit
579 -h --help display help and exit
581 -h --help display help and exit
580 --hidden consider hidden changesets
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 --version output version information and exit
860 --version output version information and exit
857 -h --help display help and exit
861 -h --help display help and exit
858 --hidden consider hidden changesets
862 --hidden consider hidden changesets
863 --pager TYPE when to paginate (boolean, always, auto, or never)
864 (default: auto)
859
865
860 Make sure that single '-v' option shows help and built-ins only for 'dodo' command
866 Make sure that single '-v' option shows help and built-ins only for 'dodo' command
861 $ hg help -v dodo
867 $ hg help -v dodo
@@ -889,6 +895,8 b" Make sure that single '-v' option shows "
889 --version output version information and exit
895 --version output version information and exit
890 -h --help display help and exit
896 -h --help display help and exit
891 --hidden consider hidden changesets
897 --hidden consider hidden changesets
898 --pager TYPE when to paginate (boolean, always, auto, or never)
899 (default: auto)
892
900
893 In case when extension name doesn't match any of its commands,
901 In case when extension name doesn't match any of its commands,
894 help message should ask for '-v' to get list of built-in aliases
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 --version output version information and exit
968 --version output version information and exit
961 -h --help display help and exit
969 -h --help display help and exit
962 --hidden consider hidden changesets
970 --hidden consider hidden changesets
971 --pager TYPE when to paginate (boolean, always, auto, or never)
972 (default: auto)
963
973
964 $ hg help -v -e dudu
974 $ hg help -v -e dudu
965 dudu extension -
975 dudu extension -
@@ -992,6 +1002,8 b" help options '-v' and '-v -e' should be "
992 --version output version information and exit
1002 --version output version information and exit
993 -h --help display help and exit
1003 -h --help display help and exit
994 --hidden consider hidden changesets
1004 --hidden consider hidden changesets
1005 --pager TYPE when to paginate (boolean, always, auto, or never)
1006 (default: auto)
995
1007
996 Disabled extension commands:
1008 Disabled extension commands:
997
1009
@@ -1,4 +1,9 b''
1 #require docutils gettext
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 $ $TESTDIR/check-gendoc ro
6 $ $TESTDIR/check-gendoc ro
4 checking for parse errors
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 --version output version information and exit
326 --version output version information and exit
327 -h --help display help and exit
327 -h --help display help and exit
328 --hidden consider hidden changesets
328 --hidden consider hidden changesets
329 --pager TYPE when to paginate (boolean, always, auto, or never)
330 (default: auto)
329
331
330 (use 'hg help' for the full list of commands)
332 (use 'hg help' for the full list of commands)
331
333
@@ -422,6 +424,8 b' Verbose help for add'
422 --version output version information and exit
424 --version output version information and exit
423 -h --help display help and exit
425 -h --help display help and exit
424 --hidden consider hidden changesets
426 --hidden consider hidden changesets
427 --pager TYPE when to paginate (boolean, always, auto, or never)
428 (default: auto)
425
429
426 Test the textwidth config option
430 Test the textwidth config option
427
431
@@ -2523,6 +2527,9 b' Dish up an empty repo; serve it cold.'
2523 <tr><td></td>
2527 <tr><td></td>
2524 <td>--hidden</td>
2528 <td>--hidden</td>
2525 <td>consider hidden changesets</td></tr>
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 </table>
2533 </table>
2527
2534
2528 </div>
2535 </div>
@@ -2718,6 +2725,9 b' Dish up an empty repo; serve it cold.'
2718 <tr><td></td>
2725 <tr><td></td>
2719 <td>--hidden</td>
2726 <td>--hidden</td>
2720 <td>consider hidden changesets</td></tr>
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 </table>
2731 </table>
2722
2732
2723 </div>
2733 </div>
General Comments 0
You need to be logged in to leave comments. Login now