changeset 46098:5510e2ac213f

simplemerge: work with opts as native strings instead of bytes There was little reason to use `pycompat.byteskwargs()` in `simplemerge()` as far as I could tell. Differential Revision: https://phab.mercurial-scm.org/D9548
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 08 Dec 2020 22:59:17 -0800
parents 1b5e0d0bdb05
children fd75e5c53ec3
files mercurial/simplemerge.py
diffstat 1 files changed, 7 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/simplemerge.py	Tue Dec 08 12:43:18 2020 -0500
+++ b/mercurial/simplemerge.py	Tue Dec 08 22:59:17 2020 -0800
@@ -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':