From f79e406e3389b38dcb958218135794531c4dd50d Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 6 Nov 2014 16:03:27 -0500 Subject: [PATCH] Commit comment editing is fully implemented. --- src | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src b/src index 8cee306..b5a8b41 100755 --- a/src +++ b/src @@ -32,10 +32,14 @@ def do_or_die(dcmd, legend=b""): "Either execute a command or raise a fatal exception." if legend: legend = " " + legend + if debug == 0: + mute = " >/dev/null 2>&1" + else: + mute = "" if debug >= DEBUG_COMMANDS: announce(b"executing '%s'%s" % (dcmd, legend)) try: - retcode = subprocess.call(dcmd, shell=True) + retcode = subprocess.call(dcmd + mute, shell=True) if retcode < 0: complain(b"child was terminated by signal %d." % -retcode) elif retcode != 0: @@ -186,8 +190,13 @@ def commit_method(*args): elif not os.path.exists(".src/%s,v" % arg): complain("%s is not registered." % arg) else: - do_or_die("mv .src/{0},v . && ci -l {0} && mv {0},v .src".format(arg)) - announce("%s %d" % (arg, revcount(arg))) + editor = os.getenv("EDITOR") or "emacsclient" + scratchfile = "/tmp/src%dtmp" % os.getpid() + do_or_die(editor + " " + scratchfile) + logcomment = open(scratchfile).read() + do_or_die("mv .src/{0},v . && ci -l -m'{1}' {0} && mv {0},v .src".format(arg, logcomment)) + revlist = log_capture(arg) + announce("%s -> %d" % (arg, len(revlist))) class RCSRevisionItem: "Capture the state of an RCS revision item in the log." -- 2.43.0