From acc9a86b3e7304dc73d350aa494ce800a9023deb Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 12 Nov 2014 17:59:49 -0500 Subject: [PATCH] If you exit from your editor without writing a file, amend will abort cleanly. --- src | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src b/src index fdee133..6d92790 100755 --- a/src +++ b/src @@ -532,9 +532,12 @@ class CommentContext: "Interactively edit a comment if required, then prepare for handoff." if self.comment is None or self.force_edit: editor = os.getenv("EDITOR") or "emacsclient" - commentfile = "/tmp/src%dtmp" % os.getpid() - do_or_die(editor + " " + commentfile, loud=True) - self.comment = open(commentfile).read() + try: + commentfile = "/tmp/src%dtmp" % os.getpid() + do_or_die(editor + " " + commentfile, loud=True) + self.comment = open(commentfile).read() + except IOError: + croak("amend aborted.") # Can be removed if we every parse RC files directly for badnews in backend.delimiters: if badnews in self.comment: -- 2.43.0