comparison hgext/fastannotate/commands.py @ 43554:9f70512ae2cf

cleanup: remove pointless r-prefixes on single-quoted strings This is the promised second step on single-quoted strings. These had existed because our source transformer didn't turn r'' into b'', so we had tagged some strings as r-strings to get "native" strings on both Pythons. Now that the transformer is gone, we can dispense with this nonsense. Methodology: I ran hg locate 'set:added() or modified() or clean()' | egrep '.*\.py$' | xargs egrep --color=never -n -- \[\^b\]\[\^a-z\]r\'\[\^\'\\\\\]\*\'\[\^\'\ in an emacs grep-mode buffer, and then used a keyboard macro to iterate over the results and remove the r prefix as needed. # skip-blame removing unneeded r prefixes left over from Python 3 migration. Differential Revision: https://phab.mercurial-scm.org/D7306
author Augie Fackler <augie@google.com>
date Fri, 08 Nov 2019 11:19:20 -0800
parents 8ff1ecfadcd1
children 9d2b2df2c2ba
comparison
equal deleted inserted replaced
43553:47fac1692ede 43554:9f70512ae2cf
80 for p in ctx.walk(m): 80 for p in ctx.walk(m):
81 yield p 81 yield p
82 82
83 83
84 fastannotatecommandargs = { 84 fastannotatecommandargs = {
85 r'options': [ 85 'options': [
86 (b'r', b'rev', b'.', _(b'annotate the specified revision'), _(b'REV')), 86 (b'r', b'rev', b'.', _(b'annotate the specified revision'), _(b'REV')),
87 (b'u', b'user', None, _(b'list the author (long with -v)')), 87 (b'u', b'user', None, _(b'list the author (long with -v)')),
88 (b'f', b'file', None, _(b'list the filename')), 88 (b'f', b'file', None, _(b'list the filename')),
89 (b'd', b'date', None, _(b'list the date (short with -q)')), 89 (b'd', b'date', None, _(b'list the date (short with -q)')),
90 (b'n', b'number', None, _(b'list the revision number (default)')), 90 (b'n', b'number', None, _(b'list the revision number (default)')),
131 ), 131 ),
132 ] 132 ]
133 + commands.diffwsopts 133 + commands.diffwsopts
134 + commands.walkopts 134 + commands.walkopts
135 + commands.formatteropts, 135 + commands.formatteropts,
136 r'synopsis': _(b'[-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] FILE...'), 136 'synopsis': _(b'[-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] FILE...'),
137 r'inferrepo': True, 137 'inferrepo': True,
138 } 138 }
139 139
140 140
141 def fastannotate(ui, repo, *pats, **opts): 141 def fastannotate(ui, repo, *pats, **opts):
142 """show changeset information by line for each file 142 """show changeset information by line for each file
255 255
256 256
257 _newopts = set() 257 _newopts = set()
258 _knownopts = { 258 _knownopts = {
259 opt[1].replace(b'-', b'_') 259 opt[1].replace(b'-', b'_')
260 for opt in (fastannotatecommandargs[r'options'] + commands.globalopts) 260 for opt in (fastannotatecommandargs['options'] + commands.globalopts)
261 } 261 }
262 262
263 263
264 def _annotatewrapper(orig, ui, repo, *pats, **opts): 264 def _annotatewrapper(orig, ui, repo, *pats, **opts):
265 """used by wrapdefault""" 265 """used by wrapdefault"""
267 if ui.configbool(b'fastannotate', b'unfilteredrepo'): 267 if ui.configbool(b'fastannotate', b'unfilteredrepo'):
268 repo = repo.unfiltered() 268 repo = repo.unfiltered()
269 269
270 # treat the file as text (skip the isbinary check) 270 # treat the file as text (skip the isbinary check)
271 if ui.configbool(b'fastannotate', b'forcetext'): 271 if ui.configbool(b'fastannotate', b'forcetext'):
272 opts[r'text'] = True 272 opts['text'] = True
273 273
274 # check if we need to do prefetch (client-side) 274 # check if we need to do prefetch (client-side)
275 rev = opts.get(r'rev') 275 rev = opts.get('rev')
276 if util.safehasattr(repo, 'prefetchfastannotate') and rev is not None: 276 if util.safehasattr(repo, 'prefetchfastannotate') and rev is not None:
277 paths = list(_matchpaths(repo, rev, pats, pycompat.byteskwargs(opts))) 277 paths = list(_matchpaths(repo, rev, pats, pycompat.byteskwargs(opts)))
278 repo.prefetchfastannotate(paths) 278 repo.prefetchfastannotate(paths)
279 279
280 return orig(ui, repo, *pats, **opts) 280 return orig(ui, repo, *pats, **opts)