]> thyrsus.com Git - src.git/commitdiff
Commit...but with no revision listing.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 6 Nov 2014 18:03:41 +0000 (13:03 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 6 Nov 2014 18:03:41 +0000 (13:03 -0500)
src

diff --git a/src b/src
index f0d7ce0ae947066533a9f1074b4bd2b5883d58d2..854b8f8af3dd22d1cd45dfb728c69aceafe828d5 100755 (executable)
--- a/src
+++ b/src
@@ -109,6 +109,7 @@ def init_method(*args):
 
 def add_method(*args):
     "Register a file into src control."
+    preamble("add", args)
     for arg in args:
        if not os.path.exists(arg):
            complain("I see no '%s' here." % arg)
@@ -119,22 +120,31 @@ def add_method(*args):
            do_or_die("ci -l %s && mv %s,v .src" % (arg, arg))
            announce("%s: 1" % arg) 
 
+def preamble(cmd, args):
+    "Common setup code."
+    if not args:
+        masters = os.listdir(".src")
+        if len(masters) == 1:
+            args.append(masters[0])
+    print "%s%s:" % (cmd, args)
+
 def commit_method(*args):
     "Commit changes to files."
+    preamble("commit", args)
     for arg in args:
        if not os.path.exists(arg):
            complain("I see no '%s' here." % arg)
-       elif not os.path.exists(".src/%s,v"):
-           complain("%s is not registered.")
+       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: 1" % arg) 
 
 dispatch = {
-    "help": help_method,
-    "init": init_method,
-    "add":  add_method,
-    "commit":  add_method,
+    "help":   help_method,
+    "init":   init_method,
+    "add":    add_method,
+    "commit": commit_method,
 }
 
 if __name__ == "__main__":