py3: convert opts keys to bytes before passing to core APIs
authorMartin von Zweigbergk <martinvonz@google.com>
Wed, 17 Jul 2019 11:03:09 -0700
changeset 4752 8a73a8df63b6
parent 4750 d9d55e34943c
child 4753 87d3955467b4
py3: convert opts keys to bytes before passing to core APIs
hgext3rd/evolve/cmdrewrite.py
hgext3rd/evolve/evolvecmd.py
hgext3rd/evolve/obshistory.py
hgext3rd/evolve/stablesort.py
hgext3rd/topic/__init__.py
--- a/hgext3rd/evolve/cmdrewrite.py	Thu Jul 11 15:30:40 2019 -0700
+++ b/hgext3rd/evolve/cmdrewrite.py	Wed Jul 17 11:03:09 2019 -0700
@@ -29,6 +29,7 @@
     obsutil,
     patch,
     phases,
+    pycompat,
     scmutil,
     util,
 )
@@ -508,7 +509,7 @@
         if disallowunstable and not onahead:
             raise error.Abort(_("cannot uncommit in the middle of a stack"))
 
-        match = scmutil.match(old, pats, opts)
+        match = scmutil.match(old, pats, pycompat.byteskwargs(opts))
 
         # Check all explicitly given files; abort if there's a problem.
         if match.files():
@@ -551,7 +552,7 @@
             if (pats or includeorexclude or opts.get('all')):
                 if not (opts['message'] or opts['logfile']):
                     opts['message'] = old.description()
-                message = cmdutil.logmessage(ui, opts)
+                message = cmdutil.logmessage(ui, pycompat.byteskwargs(opts))
                 newid = _commitfiltered(repo, old, match, target=rev,
                                         message=message, user=opts.get('user'),
                                         date=opts.get('date'))
@@ -794,6 +795,7 @@
             updates = allctx[:]
             if p2 is not None and root.p2() != p2:
                 updates.append(p2)
+            commitopts = pycompat.byteskwargs(commitopts)
             newid, unusedvariable = rewriteutil.rewrite(repo, root, updates,
                                                         head,
                                                         [root.p1().node(),
@@ -915,6 +917,7 @@
             # TODO: if the author and message are the same, don't create a new
             # hash. Right now we create a new hash because the date can be
             # different.
+            commitopts = pycompat.byteskwargs(commitopts)
             newid, created = rewriteutil.rewrite(repo, root, updates, head,
                                                  [root.p1().node(),
                                                   p2.node()],
--- a/hgext3rd/evolve/evolvecmd.py	Thu Jul 11 15:30:40 2019 -0700
+++ b/hgext3rd/evolve/evolvecmd.py	Wed Jul 17 11:03:09 2019 -0700
@@ -26,6 +26,7 @@
     obsolete,
     obsutil,
     phases,
+    pycompat,
     repair,
     scmutil,
     simplemerge,
@@ -1316,7 +1317,7 @@
     if opts.get('rev'):
         revs = scmutil.revrange(repo, opts.get('rev'))
 
-    fm = ui.formatter('evolvelist', opts)
+    fm = ui.formatter('evolvelist', pycompat.byteskwargs(opts))
     for rev in revs:
         ctx = repo[rev]
         unpars = _preparelistctxs(ctx.parents(), lambda p: p.orphan())
--- a/hgext3rd/evolve/obshistory.py	Thu Jul 11 15:30:40 2019 -0700
+++ b/hgext3rd/evolve/obshistory.py	Wed Jul 17 11:03:09 2019 -0700
@@ -16,6 +16,7 @@
     patch,
     obsutil,
     node as nodemod,
+    pycompat,
     scmutil,
     util,
 )
@@ -423,15 +424,18 @@
 
 def _debugobshistorygraph(ui, repo, revs, opts):
 
-    displayer = obsmarker_printer(ui, repo.unfiltered(), obspatch=True, diffopts=opts, buffered=True)
+    displayer = obsmarker_printer(ui, repo.unfiltered(), obspatch=True,
+                                  diffopts=pycompat.byteskwargs(opts),
+                                  buffered=True)
     edges = graphmod.asciiedges
-    walker = _obshistorywalker(repo.unfiltered(), revs, opts.get('all', False), opts.get('filternonlocal', False))
+    walker = _obshistorywalker(repo.unfiltered(), revs, opts.get('all', False),
+                               opts.get('filternonlocal', False))
     compat.displaygraph(ui, repo, walker, displayer, edges)
 
 def _debugobshistoryrevs(ui, repo, revs, opts):
     """ Display the obsolescence history for revset
     """
-    fm = ui.formatter('debugobshistory', opts)
+    fm = ui.formatter('debugobshistory', pycompat.byteskwargs(opts))
     precursors = repo.obsstore.predecessors
     successors = repo.obsstore.successors
     nodec = repo.changelog.node
--- a/hgext3rd/evolve/stablesort.py	Thu Jul 11 15:30:40 2019 -0700
+++ b/hgext3rd/evolve/stablesort.py	Wed Jul 17 11:03:09 2019 -0700
@@ -16,6 +16,7 @@
     localrepo,
     error,
     node as nodemod,
+    pycompat,
     scmutil,
 )
 
@@ -72,7 +73,8 @@
         raise error.Abort('unknown sorting method: "%s"' % method,
                           hint='pick one of: %s' % valid_method)
 
-    displayer = compat.changesetdisplayer(ui, repo, opts, buffered=True)
+    displayer = compat.changesetdisplayer(ui, repo, pycompat.byteskwargs(opts),
+                                          buffered=True)
     kwargs = {}
     if opts['limit']:
         kwargs['limit'] = int(opts['limit'])
--- a/hgext3rd/topic/__init__.py	Thu Jul 11 15:30:40 2019 -0700
+++ b/hgext3rd/topic/__init__.py	Wed Jul 17 11:03:09 2019 -0700
@@ -137,6 +137,7 @@
     obsolete,
     patch,
     phases,
+    pycompat,
     registrar,
     scmutil,
     templatefilters,
@@ -711,7 +712,8 @@
             topic = repo.currenttopic
         if not topic:
             raise error.Abort(_('no active topic to list'))
-        return stack.showstack(ui, repo, topic=topic, opts=opts)
+        return stack.showstack(ui, repo, topic=topic,
+                               opts=pycompat.byteskwargs(opts))
 
     if touchedrevs:
         if not obsolete.isenabled(repo, obsolete.createmarkersopt):
@@ -761,7 +763,7 @@
         ui.write_err(_('no active topic\n'))
         ret = 1
     elif current:
-        fm = ui.formatter('topic', opts)
+        fm = ui.formatter('topic', pycompat.byteskwargs(opts))
         namemask = '%s\n'
         label = 'topic.active'
         fm.startitem()
@@ -791,7 +793,8 @@
     if topic is None:
         branch = repo[None].branch()
     ui.pager('stack')
-    return stack.showstack(ui, repo, branch=branch, topic=topic, opts=opts)
+    return stack.showstack(ui, repo, branch=branch, topic=topic,
+                           opts=pycompat.byteskwargs(opts))
 
 @command('debugcb|debugconvertbookmark', [
         ('b', 'bookmark', '', _('bookmark to convert to topic')),
@@ -1006,7 +1009,7 @@
     return rewrote
 
 def _listtopics(ui, repo, opts):
-    fm = ui.formatter('topics', opts)
+    fm = ui.formatter('topics', pycompat.byteskwargs(opts))
     activetopic = repo.currenttopic
     namemask = '%s'
     if repo.topics: