Show More
@@ -5,7 +5,7 b' demandimport.enable()' | |||||
5 |
|
5 | |||
6 | import os, sys |
|
6 | import os, sys | |
7 | from mercurial.i18n import _ |
|
7 | from mercurial.i18n import _ | |
8 | from mercurial import simplemerge, fancyopts, util |
|
8 | from mercurial import simplemerge, fancyopts, util, ui | |
9 |
|
9 | |||
10 | options = [('L', 'label', [], _('labels to use on conflict markers')), |
|
10 | options = [('L', 'label', [], _('labels to use on conflict markers')), | |
11 | ('a', 'text', None, _('treat all files as text')), |
|
11 | ('a', 'text', None, _('treat all files as text')), | |
@@ -55,7 +55,7 b' try:' | |||||
55 | sys.exit(0) |
|
55 | sys.exit(0) | |
56 | if len(args) != 3: |
|
56 | if len(args) != 3: | |
57 | raise ParseError(_('wrong number of arguments')) |
|
57 | raise ParseError(_('wrong number of arguments')) | |
58 | sys.exit(simplemerge.simplemerge(*args, **opts)) |
|
58 | sys.exit(simplemerge.simplemerge(ui.ui(), *args, **opts)) | |
59 | except ParseError, e: |
|
59 | except ParseError, e: | |
60 | sys.stdout.write("%s: %s\n" % (sys.argv[0], e)) |
|
60 | sys.stdout.write("%s: %s\n" % (sys.argv[0], e)) | |
61 | showhelp() |
|
61 | showhelp() |
@@ -170,7 +170,7 b' def filemerge(repo, mynode, orig, fcd, f' | |||||
170 |
|
170 | |||
171 | # do we attempt to simplemerge first? |
|
171 | # do we attempt to simplemerge first? | |
172 | if _toolbool(ui, tool, "premerge", not (binary or symlink)): |
|
172 | if _toolbool(ui, tool, "premerge", not (binary or symlink)): | |
173 | r = simplemerge.simplemerge(a, b, c, quiet=True) |
|
173 | r = simplemerge.simplemerge(ui, a, b, c, quiet=True) | |
174 | if not r: |
|
174 | if not r: | |
175 | ui.debug(_(" premerge successful\n")) |
|
175 | ui.debug(_(" premerge successful\n")) | |
176 | os.unlink(back) |
|
176 | os.unlink(back) | |
@@ -187,7 +187,7 b' def filemerge(repo, mynode, orig, fcd, f' | |||||
187 | HG_BASE_ISLINK='l' in fca.flags()) |
|
187 | HG_BASE_ISLINK='l' in fca.flags()) | |
188 |
|
188 | |||
189 | if tool == "internal:merge": |
|
189 | if tool == "internal:merge": | |
190 | r = simplemerge.simplemerge(a, b, c, label=['local', 'other']) |
|
190 | r = simplemerge.simplemerge(ui, a, b, c, label=['local', 'other']) | |
191 | else: |
|
191 | else: | |
192 | args = _toolstr(ui, tool, "args", '$local $base $other') |
|
192 | args = _toolstr(ui, tool, "args", '$local $base $other') | |
193 | if "$output" in args: |
|
193 | if "$output" in args: |
@@ -24,11 +24,6 b' import util, mdiff, sys, os' | |||||
24 | class CantReprocessAndShowBase(Exception): |
|
24 | class CantReprocessAndShowBase(Exception): | |
25 | pass |
|
25 | pass | |
26 |
|
26 | |||
27 | def warn(message): |
|
|||
28 | sys.stdout.flush() |
|
|||
29 | sys.stderr.write(message) |
|
|||
30 | sys.stderr.flush() |
|
|||
31 |
|
||||
32 | def intersect(ra, rb): |
|
27 | def intersect(ra, rb): | |
33 | """Given two ranges return the range where they intersect or None. |
|
28 | """Given two ranges return the range where they intersect or None. | |
34 |
|
29 | |||
@@ -405,7 +400,7 b' class Merge3Text(object):' | |||||
405 |
|
400 | |||
406 | return unc |
|
401 | return unc | |
407 |
|
402 | |||
408 | def simplemerge(local, base, other, **opts): |
|
403 | def simplemerge(ui, local, base, other, **opts): | |
409 | def readfile(filename): |
|
404 | def readfile(filename): | |
410 | f = open(filename, "rb") |
|
405 | f = open(filename, "rb") | |
411 | text = f.read() |
|
406 | text = f.read() | |
@@ -415,7 +410,7 b' def simplemerge(local, base, other, **op' | |||||
415 | if not opts.get('text'): |
|
410 | if not opts.get('text'): | |
416 | raise util.Abort(msg) |
|
411 | raise util.Abort(msg) | |
417 | elif not opts.get('quiet'): |
|
412 | elif not opts.get('quiet'): | |
418 | warn(_('warning: %s\n') % msg) |
|
413 | ui.warn(_('warning: %s\n') % msg) | |
419 | return text |
|
414 | return text | |
420 |
|
415 | |||
421 | name_a = local |
|
416 | name_a = local | |
@@ -451,5 +446,5 b' def simplemerge(local, base, other, **op' | |||||
451 |
|
446 | |||
452 | if m3.conflicts: |
|
447 | if m3.conflicts: | |
453 | if not opts.get('quiet'): |
|
448 | if not opts.get('quiet'): | |
454 | warn(_("warning: conflicts during merge.\n")) |
|
449 | ui.warn(_("warning: conflicts during merge.\n")) | |
455 | return 1 |
|
450 | return 1 |
General Comments 0
You need to be logged in to leave comments.
Login now