complain(b"%s%s returned error." % (self.command, self.legend))
return False
-def revcount(fn):
- "Count revisions in the log output from an RCS file."
- with popen_or_die("cd .src >/dev/null; rlog %s; cd ..>/dev/null" % fn) as fp:
- revno = 0
- for line in fp:
- if line.startswith("----------------------------"):
- revno += 1
- return revno
+def log_capture(fn):
+ return popen_or_die("cd .src >/dev/null; rlog %s; cd ..>/dev/null" % fn)
def help_method(*args):
"Summarize src commands, or (with argument) show help for a single command."
do_or_die("mv .src/{0},v . && ci -l {0} && mv {0},v .src".format(arg))
announce("%s %d" % (arg, revcount(arg)))
-def status_method(*args):
- args = preamble("status", args)
+def log_method(*args):
+ args = preamble("log", args)
for arg in args:
- announce("%s %d" % (arg, revcount(arg)))
+ sys.stdout.write("%s:\n" % arg)
+ with log_capture(arg) as fp:
+ revno = 0
+ for line in fp:
+ if line.startswith("----------------------------"):
+ revno += 1
+ print "%d\n" % revno
dispatch = {
"help": help_method,
"init": init_method,
"add": add_method,
"commit": commit_method,
- "status": status_method,
+ "log": log_method,
}
if __name__ == "__main__":