diff mercurial/patch.py @ 25483:fb04372d7b38

record: exiting editor with non-zero status should not stop recording session Before this patch, exiting a hunk edit in record with a non-zero status lead to the end of the recording session, losing previously-selected hunks to record. This patch introduces the more desirable behavior of warning the user and continuing the recording session.
author Laurent Charignon <lcharignon@fb.com>
date Fri, 05 Jun 2015 13:31:18 -0700
parents 69609f43c752
children 2748bf78a5bf
line wrap: on
line diff
--- a/mercurial/patch.py	Sun Jun 07 18:11:23 2015 -0700
+++ b/mercurial/patch.py	Fri Jun 05 13:31:18 2015 -0700
@@ -1023,9 +1023,11 @@
                     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()