]> thyrsus.com Git - src.git/commitdiff
src checkout works. Now parse revspecs.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 6 Nov 2014 21:27:34 +0000 (16:27 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 6 Nov 2014 21:27:34 +0000 (16:27 -0500)
src

diff --git a/src b/src
index 6220e77bb9177f1098b9e7e53c89489abe875b9c..c046738b41aad7c0599b94d9094dfc679e2449c9 100755 (executable)
--- a/src
+++ b/src
@@ -39,7 +39,7 @@ def do_or_die(dcmd, legend=b""):
     if debug >= DEBUG_COMMANDS:
         announce(b"executing '%s'%s" % (dcmd, legend))
     try:
-        retcode = subprocess.call(dcmd + mute, shell=True)
+        retcode = subprocess.call("(" + dcmd + ")" + mute, shell=True)
         if retcode < 0:
             complain(b"child was terminated by signal %d." % -retcode)
         elif retcode != 0:
@@ -207,7 +207,7 @@ class RCSRevisionItem:
         self.date = None
 
 def list_method(*args):
-    args = preamble("log", args)
+    args = preamble("list", args)
     width = screenwidth()
     for arg in args:
         sys.stdout.write("= %s %s\n" % (arg, ((width - len(arg) - 5) * "=")))
@@ -225,14 +225,22 @@ def log_method(*args):
             sys.stdout.write("%-4d | %s\n%s" % (item.revno, item.date, item.log))
             sys.stdout.write(("-" * (width - 1)) + "\n")
 
+def checkout_method(*args):
+    args = preamble("checkout", args)
+    width = screenwidth()
+    for arg in args:
+        revlist = log_capture(arg)
+        do_or_die("mv .src/{0},v . && rm {0} && co -l {0} && mv {0},v .src".format(arg))
+        announce("%s <- %d" % (arg, len(revlist))) 
 
 dispatch = {
-    "help":   help_method,
-    "init":   init_method,
-    "add":    add_method,
-    "commit": commit_method,
-    "list":   list_method,
-    "log":    log_method,
+    "help":     help_method,
+    "init":     init_method,
+    "add":      add_method,
+    "commit":   commit_method,
+    "list":     list_method,
+    "log":      log_method,
+    "checkout": checkout_method,
 }
 
 if __name__ == "__main__":