D1626: py3: handle keyword arguments correctly in cmdutil.py

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Sat Dec 9 20:08:42 EST 2017


pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1626

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -181,7 +181,7 @@
 def setupwrapcolorwrite(ui):
     # wrap ui.write so diff output can be labeled/colorized
     def wrapwrite(orig, *args, **kw):
-        label = kw.pop('label', '')
+        label = kw.pop(r'label', '')
         for chunk, l in patch.difflabel(lambda: args):
             orig(chunk, label=label + l)
 
@@ -372,7 +372,7 @@
 
             # Make all of the pathnames absolute.
             newfiles = [repo.wjoin(nf) for nf in newfiles]
-            return commitfunc(ui, repo, *newfiles, **opts)
+            return commitfunc(ui, repo, *newfiles, **pycompat.strkwargs(opts))
         finally:
             # 5. finally restore backed-up files
             try:
@@ -1334,7 +1334,8 @@
                 if opts.get('exact'):
                     editor = None
                 else:
-                    editor = getcommiteditor(editform=editform, **opts)
+                    editor = getcommiteditor(editform=editform,
+                                             **pycompat.strkwargs(opts))
                 extra = {}
                 for idfunc in extrapreimport:
                     extrapreimportmap[idfunc](repo, extractdata, extra, opts)
@@ -2717,7 +2718,7 @@
         firstedge = next(edges)
         width = firstedge[2]
         displayer.show(ctx, copies=copies, matchfn=revmatchfn,
-                       _graphwidth=width, **props)
+                       _graphwidth=width, **pycompat.strkwargs(props))
         lines = displayer.hunk.pop(rev).split('\n')
         if not lines[-1]:
             del lines[-1]
@@ -3008,6 +3009,7 @@
 
 def cat(ui, repo, ctx, matcher, basefm, fntemplate, prefix, **opts):
     err = 1
+    opts = pycompat.byteskwargs(opts)
 
     def write(path):
         filename = None
@@ -3050,7 +3052,8 @@
             submatch = matchmod.subdirmatcher(subpath, matcher)
 
             if not sub.cat(submatch, basefm, fntemplate,
-                           os.path.join(prefix, sub._path), **opts):
+                           os.path.join(prefix, sub._path),
+                           **pycompat.strkwargs(opts)):
                 err = 0
         except error.RepoLookupError:
             ui.status(_("skipping missing subrepository: %s\n")



To: pulkit, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list