From: Eric S. Raymond Date: Wed, 12 Nov 2014 22:59:49 +0000 (-0500) Subject: If you exit from your editor without writing a file, amend will abort cleanly. X-Git-Tag: 0.6~10 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=acc9a86b3e7304dc73d350aa494ce800a9023deb;p=src.git If you exit from your editor without writing a file, amend will abort cleanly. --- 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: