From: Eric S. Raymond Date: Thu, 6 Nov 2014 20:45:20 +0000 (-0500) Subject: src log and src list are implemented. X-Git-Tag: 0.1~25 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=a1acb245e947a938e1375b42f8e64a5aa2bba9ec;p=src.git src log and src list are implemented. --- diff --git a/src b/src index 4c67d8c..8cee306 100755 --- 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 33f5aac..bf14473 100644 --- 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