churn: migrate `opts` to native kwargs
authorMatt Harbison <matt_harbison@yahoo.com>
Sun, 20 Aug 2023 15:34:11 -0400
changeset 50872 5a22b2594d96
parent 50871 0c76520ec4cc
child 50873 259213382862
churn: migrate `opts` to native kwargs
hgext/churn.py
--- a/hgext/churn.py	Sun Aug 20 15:30:39 2023 -0400
+++ b/hgext/churn.py	Sun Aug 20 15:34:11 2023 -0400
@@ -52,18 +52,17 @@
 
 def countrate(ui, repo, amap, *pats, **opts):
     """Calculate stats"""
-    opts = pycompat.byteskwargs(opts)
-    if opts.get(b'dateformat'):
+    if opts.get('dateformat'):
 
         def getkey(ctx):
             t, tz = ctx.date()
             date = datetime.datetime(*time.gmtime(float(t) - tz)[:6])
             return encoding.strtolocal(
-                date.strftime(encoding.strfromlocal(opts[b'dateformat']))
+                date.strftime(encoding.strfromlocal(opts['dateformat']))
             )
 
     else:
-        tmpl = opts.get(b'oldtemplate') or opts.get(b'template')
+        tmpl = opts.get('oldtemplate') or opts.get('template')
         tmpl = logcmdutil.maketemplater(ui, repo, tmpl)
 
         def getkey(ctx):
@@ -80,7 +79,7 @@
         rev = ctx.rev()
         key = getkey(ctx).strip()
         key = amap.get(key, key)  # alias remap
-        if opts.get(b'changesets'):
+        if opts.get('changesets'):
             rate[key] = (rate.get(key, (0,))[0] + 1, 0)
         else:
             parents = ctx.parents()
@@ -96,11 +95,11 @@
 
     wopts = logcmdutil.walkopts(
         pats=pats,
-        opts=opts,
-        revspec=opts[b'rev'],
-        date=opts[b'date'],
-        include_pats=opts[b'include'],
-        exclude_pats=opts[b'exclude'],
+        opts=pycompat.byteskwargs(opts),
+        revspec=opts['rev'],
+        date=opts['date'],
+        include_pats=opts['include'],
+        exclude_pats=opts['exclude'],
     )
     revs, makefilematcher = logcmdutil.makewalker(repo, wopts)
     for ctx in scmutil.walkchangerevs(repo, revs, makefilematcher, prep):