[PATCH 3 of 3] crecord: exit edition of hunk with non-zero status does not interrupt session

Laurent Charignon lcharignon at fb.com
Fri Jun 12 15:35:20 CDT 2015


I was busy on other things this week, sorry for the late reply
- Agreed for the commend on the third patch.
- For the second patch, only one string is localized in crecord.py, localizing the string could be done in a future series, I suggest that we keep it as is for now
- I will send a V2

Thanks,

Laurent

On Jun 10, 2015, at 7:37 AM, Augie Fackler <raf at durin42.com<mailto:raf at durin42.com>> wrote:

On Mon, Jun 08, 2015 at 10:50:58AM -0400, Augie Fackler wrote:
On Fri, Jun 05, 2015 at 02:03:33PM -0700, Laurent Charignon wrote:
# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com<mailto:lcharignon at fb.com>>
# Date 1433536874 25200
#      Fri Jun 05 13:41:14 2015 -0700
# Node ID 55d45b5b1cb25d431f4771cd42e456b76c904b36
# Parent  82711472302682face294f925835780ab9f710a8
crecord: exit edition of hunk with non-zero status does not interrupt session

Before this patch, when editing a hunk, if the editor was exiting with a non-
zero status the crecord session would be aborted. This patch makes crecord
handle the failure and goes back to the state before the failed edition.
We use the new error reporting mechanism introduced in the previous patch to
notify the user of the issue.

diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -1468,9 +1468,11 @@
                f.close()
                # start the editor and wait for it to complete
                editor = self.ui.geteditor()
-                self.ui.system("%s \"%s\"" % (editor, patchfn),
-                          environ={'hguser': self.ui.username()},
-                          onerr=util.Abort, errprefix=_("edit failed"))
+                ret = self.ui.system("%s \"%s\"" % (editor, patchfn),
+                          environ={'hguser': self.ui.username()})
+                if ret != 0:
+                    self.errorstr = "Editor exited with status %d" % ret

This looks suspiciously like something that should get localized?

Friendly ping on this series - I liked where it was going, and once we
work out my confusion on patches 2 and 3 it'll be ready to
land. Thanks!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20150612/9abe5893/attachment.html>


More information about the Mercurial-devel mailing list