]> thyrsus.com Git - src.git/commitdiff
src log and src list are implemented.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 6 Nov 2014 20:45:20 +0000 (15:45 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 6 Nov 2014 20:45:20 +0000 (15:45 -0500)
src
src.asc

diff --git a/src b/src
index 4c67d8c5ed625df95459685cdc4694a93fc08f1c..8cee306693344dbf679cb1441a0d6c288d67edc5 100755 (executable)
--- a/src
+++ b/src
@@ -128,8 +128,11 @@ src branch [delete] ['branchname']
 src tag [delete] ['tagname'] ['revspec']
    Create, switch to, or delete a tag. With no arguments, list tags.
 
+src list ['revision-spec'] ['file'...]
+   Sends summary information about the specified commits to standard output.
+
 src log ['revision-spec'] ['file'...]
-   Sends log information about the specified files to standard output.
+   Sends log information about the specified commits to standard output.
 
 src diff ['revision-spec'] ['file'...]
    Sends a diff listing to standard output
@@ -194,20 +197,32 @@ class RCSRevisionItem:
         self.log = ""
         self.date = None
 
+def list_method(*args):
+    args = preamble("log", args)
+    width = screenwidth()
+    for arg in args:
+        sys.stdout.write("= %s %s\n" % (arg, ((width - len(arg) - 5) * "=")))
+        for item in log_capture(arg):
+            # Must allow enough room for revno and date
+            summary = item.log.strip()[:width - 32]
+            sys.stdout.write("%-4d %s %s\n" % (item.revno, item.date, summary))
+
 def log_method(*args):
     args = preamble("log", args)
     width = screenwidth()
     for arg in args:
         sys.stdout.write("= %s %s\n" % (arg, ((width - len(arg) - 5) * "=")))
         for item in log_capture(arg):
-            sys.stdout.write("%d | %s\n%s" % (item.revno, item.date, item.log))
+            sys.stdout.write("%-4d | %s\n%s" % (item.revno, item.date, item.log))
             sys.stdout.write(("-" * (width - 1)) + "\n")
 
+
 dispatch = {
     "help":   help_method,
     "init":   init_method,
     "add":    add_method,
     "commit": commit_method,
+    "list":   list_method,
     "log":    log_method,
 }
 
diff --git a/src.asc b/src.asc
index 33f5aacbd11a78eeab2aea0bd3c0a46e45a8c50d..bf144738a19a88ca291e873f2488bb18becf5209 100644 (file)
--- a/src.asc
+++ b/src.asc
@@ -47,8 +47,11 @@ src branch [delete] ['branchname']
 src tag [delete] ['tagname'] ['revspec']
    Create, switch to, or delete a tag. With no arguments, list tags.
 
+src list ['revision-spec'] ['file'...]
+   Sends summary information about the specified commits to standard output.
+
 src log ['revision-spec'] ['file'...]
-   Sends log information about the specified files to standard output.
+   Sends log information about the specified commits to standard output.
 
 src diff ['revision-spec'] ['file'...]
    Sends a diff listing to standard output