Patchwork D9548: simplemerge: work with opts as native strings instead of bytes

login
register
mail settings
Submitter phabricator
Date Dec. 9, 2020, 9:28 a.m.
Message ID <differential-rev-PHID-DREV-6riev4hseimqez4p2ine-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47844/
State Superseded
Headers show

Comments

phabricator - Dec. 9, 2020, 9:28 a.m.
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  There was little reason to use `pycompat.byteskwargs()` in
  `simplemerge()` as far as I could tell.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/simplemerge.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/simplemerge.py b/mercurial/simplemerge.py
--- a/mercurial/simplemerge.py
+++ b/mercurial/simplemerge.py
@@ -433,9 +433,9 @@ 
     then we just warn)"""
     if stringutil.binary(text):
         msg = _(b"%s looks like a binary file.") % path
-        if not opts.get(b'quiet'):
+        if not opts.get('quiet'):
             ui.warn(_(b'warning: %s\n') % msg)
-        if not opts.get(b'text'):
+        if not opts.get('text'):
             raise error.Abort(msg)
     return text
 
@@ -460,7 +460,6 @@ 
 
     The merged result is written into `localctx`.
     """
-    opts = pycompat.byteskwargs(opts)
 
     def readctx(ctx):
         # Merges were always run in the working copy before, which means
@@ -472,11 +471,11 @@ 
         # repository usually sees) might be more useful.
         return _verifytext(ctx.decodeddata(), ctx.path(), ui, opts)
 
-    mode = opts.get(b'mode', b'merge')
+    mode = opts.get('mode', b'merge')
     name_a, name_b, name_base = None, None, None
     if mode != b'union':
         name_a, name_b, name_base = _picklabels(
-            [localctx.path(), otherctx.path(), None], opts.get(b'label', [])
+            [localctx.path(), otherctx.path(), None], opts.get('label', [])
         )
 
     try:
@@ -488,7 +487,7 @@ 
 
     m3 = Merge3Text(basetext, localtext, othertext)
     extrakwargs = {
-        b"localorother": opts.get(b"localorother", None),
+        b"localorother": opts.get("localorother", None),
         b'minimize': True,
     }
     if mode == b'union':
@@ -504,7 +503,7 @@ 
     for line in m3.merge_lines(
         name_a=name_a, name_b=name_b, **pycompat.strkwargs(extrakwargs)
     ):
-        if opts.get(b'print'):
+        if opts.get('print'):
             ui.fout.write(line)
         else:
             mergedtext += line
@@ -519,7 +518,7 @@ 
         addedflags = (localflags ^ otherflags) - baseflags
         flags = b''.join(sorted(commonflags | addedflags))
 
-    if not opts.get(b'print'):
+    if not opts.get('print'):
         localctx.write(mergedtext, flags)
 
     if m3.conflicts and not mode == b'union':