diff --git a/mercurial/simplemerge.py b/mercurial/simplemerge.py --- a/mercurial/simplemerge.py +++ b/mercurial/simplemerge.py @@ -407,10 +407,10 @@ def simplemerge(ui, local, base, other, f.close() if util.binary(text): msg = _("%s looks like a binary file.") % filename + if not opts.get('quiet'): + ui.warn(_('warning: %s\n') % msg) if not opts.get('text'): raise util.Abort(msg) - elif not opts.get('quiet'): - ui.warn(_('warning: %s\n') % msg) return text name_a = local @@ -423,9 +423,12 @@ def simplemerge(ui, local, base, other, if labels: raise util.Abort(_("can only specify two labels.")) - localtext = readfile(local) - basetext = readfile(base) - othertext = readfile(other) + try: + localtext = readfile(local) + basetext = readfile(base) + othertext = readfile(other) + except util.Abort: + return 1 local = os.path.realpath(local) if not opts.get('print'): diff --git a/tests/test-simplemerge-cmd.t b/tests/test-simplemerge-cmd.t --- a/tests/test-simplemerge-cmd.t +++ b/tests/test-simplemerge-cmd.t @@ -99,8 +99,8 @@ binary file $ python -c "f = file('binary-local', 'w'); f.write('\x00'); f.close()" $ cat orig >> binary-local $ python simplemerge -p binary-local base other - abort: binary-local looks like a binary file. - [255] + warning: binary-local looks like a binary file. + [1] binary file --text