python3: add byte prefix for objects that look like kwargs but aren't
authorRaphaël Gomès <rgomes@octobus.net>
Tue, 06 Aug 2019 11:17:38 +0200
changeset 4803 88472e743c64
parent 4802 dc403312a012
child 4804 079dbf36e884
python3: add byte prefix for objects that look like kwargs but aren't The `byteify-strings.py` script has no way of knowing that those aren't acutally kwargs since it works purely at the tokenization level, so we have to add the byte prefix to their keys manually.
hgext3rd/evolve/__init__.py
hgext3rd/evolve/obsexchange.py
hgext3rd/evolve/rewriteutil.py
hgext3rd/topic/stack.py
hgext3rd/topic/topicmap.py
--- a/hgext3rd/evolve/__init__.py	Tue Aug 06 11:10:36 2019 +0200
+++ b/hgext3rd/evolve/__init__.py	Tue Aug 06 11:17:38 2019 +0200
@@ -843,7 +843,7 @@
         _getnodefrompatch(hunk, expected)
         ret = orig(ui, repo, hunk, parents, opts, *args, **kwargs)
     created = ret[1]
-    if (opts['obsolete'] and None not in (created, expected['node'])
+    if (opts[b'obsolete'] and None not in (created, expected['node'])
         and created != expected['node']):
         tr = repo.transaction('import-obs')
         try:
--- a/hgext3rd/evolve/obsexchange.py	Tue Aug 06 11:10:36 2019 +0200
+++ b/hgext3rd/evolve/obsexchange.py	Tue Aug 06 11:17:38 2019 +0200
@@ -65,7 +65,7 @@
 def _addobscommontob2pull(orig, pullop, kwargs):
     ret = orig(pullop, kwargs)
     ui = pullop.repo.ui
-    if ('obsmarkers' in kwargs
+    if (b'obsmarkers' in kwargs
         and pullop.remote.capable('_evoext_getbundle_obscommon')):
         boundaries = obsdiscovery.buildpullobsmarkersboundaries(pullop)
         if 'common' in boundaries:
@@ -73,13 +73,13 @@
             if common != pullop.common:
                 obsexcmsg(ui, 'request obsmarkers for some common nodes\n')
             if common != [node.nullid]:
-                kwargs['evo_obscommon'] = common
+                kwargs[b'evo_obscommon'] = common
         elif 'missing' in boundaries:
             missing = boundaries['missing']
             if missing:
                 obsexcmsg(ui, 'request obsmarkers for %d common nodes\n'
                           % len(missing))
-            kwargs['evo_missing_nodes'] = missing
+            kwargs[b'evo_missing_nodes'] = missing
     return ret
 
 def _getbundleobsmarkerpart(orig, bundler, repo, source, **kwargs):
--- a/hgext3rd/evolve/rewriteutil.py	Tue Aug 06 11:10:36 2019 +0200
+++ b/hgext3rd/evolve/rewriteutil.py	Tue Aug 06 11:17:38 2019 +0200
@@ -218,12 +218,12 @@
         if not message:
             message = old.description()
 
-        user = commitopts.get('user') or old.user()
+        user = commitopts.get(b'user') or old.user()
         # TODO: In case not date is given, we should take the old commit date
         # if we are working one one changeset or mimic the fold behavior about
         # date
-        date = commitopts.get('date') or None
-        extra = dict(commitopts.get('extra', old.extra()))
+        date = commitopts.get(b'date') or None
+        extra = dict(commitopts.get(b'extra', old.extra()))
         extra['branch'] = head.branch()
 
         new = context.memctx(repo,
@@ -235,7 +235,7 @@
                              date=date,
                              extra=extra)
 
-        if commitopts.get('edit'):
+        if commitopts.get(b'edit'):
             new._text = cmdutil.commitforceeditor(repo, new, [])
         revcount = len(repo)
         newid = repo.commitctx(new)
--- a/hgext3rd/topic/stack.py	Tue Aug 06 11:10:36 2019 +0200
+++ b/hgext3rd/topic/stack.py	Tue Aug 06 11:17:38 2019 +0200
@@ -317,7 +317,7 @@
 
         symbol = None
         states = []
-        if opts.get('children'):
+        if opts.get(b'children'):
             expr = 'children(%d) and merge() - %ld'
             revisions = repo.revs(expr, ctx.rev(), st._revs)
             if len(revisions) > 0:
--- a/hgext3rd/topic/topicmap.py	Tue Aug 06 11:10:36 2019 +0200
+++ b/hgext3rd/topic/topicmap.py	Tue Aug 06 11:17:38 2019 +0200
@@ -111,7 +111,7 @@
         return ret
     parents = ctx.parents()
 
-    if (not opts.get('amend') and bheads and node not in bheads and not
+    if (not opts.get(b'amend') and bheads and node not in bheads and not
         [x for x in parents if x.node() in bheads and x.branch() == branch]):
         repo.ui.status(_("(consider using topic for lightweight branches."
                          " See 'hg help topic')\n"))