Show More
@@ -19,13 +19,13 b' from mercurial.utils import (' | |||||
19 | procutil, |
|
19 | procutil, | |
20 | ) |
|
20 | ) | |
21 |
|
21 | |||
22 | options = [('L', 'label', [], _('labels to use on conflict markers')), |
|
22 | options = [(b'L', b'label', [], _(b'labels to use on conflict markers')), | |
23 | ('a', 'text', None, _('treat all files as text')), |
|
23 | (b'a', b'text', None, _(b'treat all files as text')), | |
24 | ('p', 'print', None, |
|
24 | (b'p', b'print', None, | |
25 | _('print results instead of overwriting LOCAL')), |
|
25 | _(b'print results instead of overwriting LOCAL')), | |
26 | ('', 'no-minimal', None, _('no effect (DEPRECATED)')), |
|
26 | (b'', b'no-minimal', None, _(b'no effect (DEPRECATED)')), | |
27 | ('h', 'help', None, _('display help and exit')), |
|
27 | (b'h', b'help', None, _(b'display help and exit')), | |
28 | ('q', 'quiet', None, _('suppress output'))] |
|
28 | (b'q', b'quiet', None, _(b'suppress output'))] | |
29 |
|
29 | |||
30 | usage = _('''simplemerge [OPTS] LOCAL BASE OTHER |
|
30 | usage = _('''simplemerge [OPTS] LOCAL BASE OTHER | |
31 |
|
31 | |||
@@ -41,16 +41,16 b' class ParseError(Exception):' | |||||
41 |
|
41 | |||
42 | def showhelp(): |
|
42 | def showhelp(): | |
43 | sys.stdout.write(usage) |
|
43 | sys.stdout.write(usage) | |
44 | sys.stdout.write('\noptions:\n') |
|
44 | sys.stdout.write(b'\noptions:\n') | |
45 |
|
45 | |||
46 | out_opts = [] |
|
46 | out_opts = [] | |
47 | for shortopt, longopt, default, desc in options: |
|
47 | for shortopt, longopt, default, desc in options: | |
48 | out_opts.append(('%2s%s' % (shortopt and '-%s' % shortopt, |
|
48 | out_opts.append((b'%2s%s' % (shortopt and b'-%s' % shortopt, | |
49 | longopt and ' --%s' % longopt), |
|
49 | longopt and b' --%s' % longopt), | |
50 | '%s' % desc)) |
|
50 | b'%s' % desc)) | |
51 | opts_len = max([len(opt[0]) for opt in out_opts]) |
|
51 | opts_len = max([len(opt[0]) for opt in out_opts]) | |
52 | for first, second in out_opts: |
|
52 | for first, second in out_opts: | |
53 | sys.stdout.write(' %-*s %s\n' % (opts_len, first, second)) |
|
53 | sys.stdout.write(b' %-*s %s\n' % (opts_len, first, second)) | |
54 |
|
54 | |||
55 | try: |
|
55 | try: | |
56 | for fp in (sys.stdin, sys.stdout, sys.stderr): |
|
56 | for fp in (sys.stdin, sys.stdout, sys.stderr): | |
@@ -61,11 +61,11 b' try:' | |||||
61 | args = fancyopts.fancyopts(sys.argv[1:], options, opts) |
|
61 | args = fancyopts.fancyopts(sys.argv[1:], options, opts) | |
62 | except getopt.GetoptError as e: |
|
62 | except getopt.GetoptError as e: | |
63 | raise ParseError(e) |
|
63 | raise ParseError(e) | |
64 | if opts['help']: |
|
64 | if opts[b'help']: | |
65 | showhelp() |
|
65 | showhelp() | |
66 | sys.exit(0) |
|
66 | sys.exit(0) | |
67 | if len(args) != 3: |
|
67 | if len(args) != 3: | |
68 | raise ParseError(_('wrong number of arguments')) |
|
68 | raise ParseError(_(b'wrong number of arguments')) | |
69 | local, base, other = args |
|
69 | local, base, other = args | |
70 | sys.exit(simplemerge.simplemerge(uimod.ui.load(), |
|
70 | sys.exit(simplemerge.simplemerge(uimod.ui.load(), | |
71 | context.arbitraryfilectx(local), |
|
71 | context.arbitraryfilectx(local), | |
@@ -73,11 +73,11 b' try:' | |||||
73 | context.arbitraryfilectx(other), |
|
73 | context.arbitraryfilectx(other), | |
74 | **opts)) |
|
74 | **opts)) | |
75 | except ParseError as e: |
|
75 | except ParseError as e: | |
76 | sys.stdout.write("%s: %s\n" % (sys.argv[0], e)) |
|
76 | sys.stdout.write(b"%s: %s\n" % (sys.argv[0], e)) | |
77 | showhelp() |
|
77 | showhelp() | |
78 | sys.exit(1) |
|
78 | sys.exit(1) | |
79 | except error.Abort as e: |
|
79 | except error.Abort as e: | |
80 | sys.stderr.write("abort: %s\n" % e) |
|
80 | sys.stderr.write(b"abort: %s\n" % e) | |
81 | sys.exit(255) |
|
81 | sys.exit(255) | |
82 | except KeyboardInterrupt: |
|
82 | except KeyboardInterrupt: | |
83 | sys.exit(255) |
|
83 | sys.exit(255) |
General Comments 0
You need to be logged in to leave comments.
Login now