]> thyrsus.com Git - src.git/commitdiff
Commit comment editing is fully implemented.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 6 Nov 2014 21:03:27 +0000 (16:03 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 6 Nov 2014 21:03:27 +0000 (16:03 -0500)
src

diff --git a/src b/src
index 8cee306693344dbf679cb1441a0d6c288d67edc5..b5a8b4197bbfe4a11dbf23c7c327adf2d0eab08d 100755 (executable)
--- 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."