comparison hgext/fastannotate/commands.py @ 39682:b77f2ea51da5

py3: fix kwargs handling in hgext/fastannotate.py Differential Revision: https://phab.mercurial-scm.org/D4588
author Pulkit Goyal <pulkit@yandex-team.ru>
date Fri, 14 Sep 2018 23:51:21 +0300
parents b3572f733dbd
children 24e493ec2229
comparison
equal deleted inserted replaced
39681:c73c7653dfb9 39682:b77f2ea51da5
128 128
129 # performance hack: filtered repo can be slow. unfilter by default. 129 # performance hack: filtered repo can be slow. unfilter by default.
130 if ui.configbool('fastannotate', 'unfilteredrepo'): 130 if ui.configbool('fastannotate', 'unfilteredrepo'):
131 repo = repo.unfiltered() 131 repo = repo.unfiltered()
132 132
133 opts = pycompat.byteskwargs(opts)
134
133 rev = opts.get('rev', '.') 135 rev = opts.get('rev', '.')
134 rebuild = opts.get('rebuild', False) 136 rebuild = opts.get('rebuild', False)
135 137
136 diffopts = patch.difffeatureopts(ui, opts, section='annotate', 138 diffopts = patch.difffeatureopts(ui, opts, section='annotate',
137 whitespace=True) 139 whitespace=True)
205 if ui.configbool('fastannotate', 'unfilteredrepo'): 207 if ui.configbool('fastannotate', 'unfilteredrepo'):
206 repo = repo.unfiltered() 208 repo = repo.unfiltered()
207 209
208 # treat the file as text (skip the isbinary check) 210 # treat the file as text (skip the isbinary check)
209 if ui.configbool('fastannotate', 'forcetext'): 211 if ui.configbool('fastannotate', 'forcetext'):
210 opts['text'] = True 212 opts[r'text'] = True
211 213
212 # check if we need to do prefetch (client-side) 214 # check if we need to do prefetch (client-side)
213 rev = opts.get('rev') 215 rev = opts.get(r'rev')
214 if util.safehasattr(repo, 'prefetchfastannotate') and rev is not None: 216 if util.safehasattr(repo, 'prefetchfastannotate') and rev is not None:
215 paths = list(_matchpaths(repo, rev, pats, opts)) 217 paths = list(_matchpaths(repo, rev, pats, pycompat.byteskwargs(opts)))
216 repo.prefetchfastannotate(paths) 218 repo.prefetchfastannotate(paths)
217 219
218 return orig(ui, repo, *pats, **opts) 220 return orig(ui, repo, *pats, **opts)
219 221
220 def registercommand(): 222 def registercommand():
239 server. Otherwise, build the annotate cache locally. 241 server. Otherwise, build the annotate cache locally.
240 242
241 The annotate cache will be built using the default diff and follow 243 The annotate cache will be built using the default diff and follow
242 options and lives in '.hg/fastannotate/default'. 244 options and lives in '.hg/fastannotate/default'.
243 """ 245 """
246 opts = pycompat.byteskwargs(opts)
244 rev = opts.get('REV') or ui.config('fastannotate', 'mainbranch') 247 rev = opts.get('REV') or ui.config('fastannotate', 'mainbranch')
245 if not rev: 248 if not rev:
246 raise error.Abort(_('you need to provide a revision'), 249 raise error.Abort(_('you need to provide a revision'),
247 hint=_('set fastannotate.mainbranch or use --rev')) 250 hint=_('set fastannotate.mainbranch or use --rev'))
248 if ui.configbool('fastannotate', 'unfilteredrepo'): 251 if ui.configbool('fastannotate', 'unfilteredrepo'):