Mercurial > hg
comparison hgext/pager.py @ 43077:687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Done with
python3.7 contrib/byteify-strings.py -i $(hg files 'set:mercurial/**.py - mercurial/thirdparty/** + hgext/**.py - hgext/fsmonitor/pywatchman/** - mercurial/__init__.py')
black -l 80 -t py33 -S $(hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**" - hgext/fsmonitor/pywatchman/**')
# skip-blame mass-reformatting only
Differential Revision: https://phab.mercurial-scm.org/D6972
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 06 Oct 2019 09:48:39 -0400 |
parents | 2372284d9457 |
children | 89a2afe31e82 |
comparison
equal
deleted
inserted
replaced
43076:2372284d9457 | 43077:687b865b95ad |
---|---|
33 | 33 |
34 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | 34 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
35 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | 35 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
36 # be specifying the version(s) of Mercurial they are tested with, or | 36 # be specifying the version(s) of Mercurial they are tested with, or |
37 # leave the attribute unspecified. | 37 # leave the attribute unspecified. |
38 testedwith = 'ships-with-hg-core' | 38 testedwith = b'ships-with-hg-core' |
39 | 39 |
40 configtable = {} | 40 configtable = {} |
41 configitem = registrar.configitem(configtable) | 41 configitem = registrar.configitem(configtable) |
42 | 42 |
43 configitem( | 43 configitem( |
44 'pager', 'attend', default=lambda: attended, | 44 b'pager', b'attend', default=lambda: attended, |
45 ) | 45 ) |
46 | 46 |
47 | 47 |
48 def uisetup(ui): | 48 def uisetup(ui): |
49 def pagecmd(orig, ui, options, cmd, cmdfunc): | 49 def pagecmd(orig, ui, options, cmd, cmdfunc): |
50 auto = options['pager'] == 'auto' | 50 auto = options[b'pager'] == b'auto' |
51 if auto and not ui.pageractive: | 51 if auto and not ui.pageractive: |
52 usepager = False | 52 usepager = False |
53 attend = ui.configlist('pager', 'attend') | 53 attend = ui.configlist(b'pager', b'attend') |
54 ignore = ui.configlist('pager', 'ignore') | 54 ignore = ui.configlist(b'pager', b'ignore') |
55 cmds, _ = cmdutil.findcmd(cmd, commands.table) | 55 cmds, _ = cmdutil.findcmd(cmd, commands.table) |
56 | 56 |
57 for cmd in cmds: | 57 for cmd in cmds: |
58 var = 'attend-%s' % cmd | 58 var = b'attend-%s' % cmd |
59 if ui.config('pager', var, None): | 59 if ui.config(b'pager', var, None): |
60 usepager = ui.configbool('pager', var, True) | 60 usepager = ui.configbool(b'pager', var, True) |
61 break | 61 break |
62 if cmd in attend or (cmd not in ignore and not attend): | 62 if cmd in attend or (cmd not in ignore and not attend): |
63 usepager = True | 63 usepager = True |
64 break | 64 break |
65 | 65 |
67 # Slight hack: the attend list is supposed to override | 67 # Slight hack: the attend list is supposed to override |
68 # the ignore list for the pager extension, but the | 68 # the ignore list for the pager extension, but the |
69 # core code doesn't know about attend, so we have to | 69 # core code doesn't know about attend, so we have to |
70 # lobotomize the ignore list so that the extension's | 70 # lobotomize the ignore list so that the extension's |
71 # behavior is preserved. | 71 # behavior is preserved. |
72 ui.setconfig('pager', 'ignore', '', 'pager') | 72 ui.setconfig(b'pager', b'ignore', b'', b'pager') |
73 ui.pager('extension-via-attend-' + cmd) | 73 ui.pager(b'extension-via-attend-' + cmd) |
74 else: | 74 else: |
75 ui.disablepager() | 75 ui.disablepager() |
76 return orig(ui, options, cmd, cmdfunc) | 76 return orig(ui, options, cmd, cmdfunc) |
77 | 77 |
78 extensions.wrapfunction(dispatch, '_runcommand', pagecmd) | 78 extensions.wrapfunction(dispatch, b'_runcommand', pagecmd) |
79 | 79 |
80 | 80 |
81 attended = ['annotate', 'cat', 'diff', 'export', 'glog', 'log', 'qdiff'] | 81 attended = [b'annotate', b'cat', b'diff', b'export', b'glog', b'log', b'qdiff'] |