diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -1023,9 +1023,11 @@ the hunk is left unchanged. f.close() # Start the editor and wait for it to complete editor = ui.geteditor() - ui.system("%s \"%s\"" % (editor, patchfn), - environ={'HGUSER': ui.username()}, - onerr=util.Abort, errprefix=_("edit failed")) + ret = ui.system("%s \"%s\"" % (editor, patchfn), + environ={'HGUSER': ui.username()}) + if ret != 0: + ui.warn(_("editor exited with exit code %d\n") % ret) + continue # Remove comment lines patchfp = open(patchfn) ncpatchfp = cStringIO.StringIO() diff --git a/tests/test-commit-interactive.t b/tests/test-commit-interactive.t --- a/tests/test-commit-interactive.t +++ b/tests/test-commit-interactive.t @@ -1291,6 +1291,33 @@ Malformed patch - error handling abort: error parsing patch: unhandled transition: range -> range [255] +Exiting editor with status 1, ignores the edit but does not stop the recording +session + + $ HGEDITOR=false hg commit -i < y + > e + > n + > EOF + diff --git a/editedfile b/editedfile + 1 hunks, 3 lines changed + examine changes to 'editedfile'? [Ynesfdaq?] y + + @@ -1,3 +1,3 @@ + -This is the first line + -This change will be committed + -This is the third line + +This change will not be committed + +This is the second line + +This line has been added + record this change to 'editedfile'? [Ynesfdaq?] e + + editor exited with exit code 1 + record this change to 'editedfile'? [Ynesfdaq?] n + + no changes to record + + random text in random positions is still an error $ cat > editor.sh << '__EOF__'