From: Eric S. Raymond Date: Thu, 6 Nov 2014 21:27:34 +0000 (-0500) Subject: src checkout works. Now parse revspecs. X-Git-Tag: 0.1~22 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=f188484d07fe7acf1768a34c8c0b487691a38d36;p=src.git src checkout works. Now parse revspecs. --- diff --git a/src b/src index 6220e77..c046738 100755 --- 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__":