D4698: py3: add b'' prefixes in contrib/simplemerge

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Mon Sep 24 01:50:32 EDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHGd3e940a32be0: py3: add b'' prefixes in contrib/simplemerge (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4698?vs=11294&id=11300

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

AFFECTED FILES
  contrib/simplemerge

CHANGE DETAILS

diff --git a/contrib/simplemerge b/contrib/simplemerge
old mode 100755
new mode 100644
--- a/contrib/simplemerge
+++ b/contrib/simplemerge
@@ -19,13 +19,13 @@
     procutil,
 )
 
-options = [('L', 'label', [], _('labels to use on conflict markers')),
-           ('a', 'text', None, _('treat all files as text')),
-           ('p', 'print', None,
-            _('print results instead of overwriting LOCAL')),
-           ('', 'no-minimal', None, _('no effect (DEPRECATED)')),
-           ('h', 'help', None, _('display help and exit')),
-           ('q', 'quiet', None, _('suppress output'))]
+options = [(b'L', b'label', [], _(b'labels to use on conflict markers')),
+           (b'a', b'text', None, _(b'treat all files as text')),
+           (b'p', b'print', None,
+            _(b'print results instead of overwriting LOCAL')),
+           (b'', b'no-minimal', None, _(b'no effect (DEPRECATED)')),
+           (b'h', b'help', None, _(b'display help and exit')),
+           (b'q', b'quiet', None, _(b'suppress output'))]
 
 usage = _('''simplemerge [OPTS] LOCAL BASE OTHER
 
@@ -41,16 +41,16 @@
 
 def showhelp():
     sys.stdout.write(usage)
-    sys.stdout.write('\noptions:\n')
+    sys.stdout.write(b'\noptions:\n')
 
     out_opts = []
     for shortopt, longopt, default, desc in options:
-        out_opts.append(('%2s%s' % (shortopt and '-%s' % shortopt,
-                                    longopt and ' --%s' % longopt),
-                         '%s' % desc))
+        out_opts.append((b'%2s%s' % (shortopt and b'-%s' % shortopt,
+                                     longopt and b' --%s' % longopt),
+                         b'%s' % desc))
     opts_len = max([len(opt[0]) for opt in out_opts])
     for first, second in out_opts:
-        sys.stdout.write(' %-*s  %s\n' % (opts_len, first, second))
+        sys.stdout.write(b' %-*s  %s\n' % (opts_len, first, second))
 
 try:
     for fp in (sys.stdin, sys.stdout, sys.stderr):
@@ -61,23 +61,23 @@
         args = fancyopts.fancyopts(sys.argv[1:], options, opts)
     except getopt.GetoptError as e:
         raise ParseError(e)
-    if opts['help']:
+    if opts[b'help']:
         showhelp()
         sys.exit(0)
     if len(args) != 3:
-            raise ParseError(_('wrong number of arguments'))
+            raise ParseError(_(b'wrong number of arguments'))
     local, base, other = args
     sys.exit(simplemerge.simplemerge(uimod.ui.load(),
                                      context.arbitraryfilectx(local),
                                      context.arbitraryfilectx(base),
                                      context.arbitraryfilectx(other),
                                      **opts))
 except ParseError as e:
-    sys.stdout.write("%s: %s\n" % (sys.argv[0], e))
+    sys.stdout.write(b"%s: %s\n" % (sys.argv[0], e))
     showhelp()
     sys.exit(1)
 except error.Abort as e:
-    sys.stderr.write("abort: %s\n" % e)
+    sys.stderr.write(b"abort: %s\n" % e)
     sys.exit(255)
 except KeyboardInterrupt:
     sys.exit(255)



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


More information about the Mercurial-devel mailing list