From: Eric S. Raymond Date: Sat, 8 Nov 2014 17:53:19 +0000 (-0500) Subject: Implemented src ls. X-Git-Tag: 0.2~9 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=c6f5470965933f615861330045bc58207e1958e7;p=src.git Implemented src ls. --- diff --git a/TODO b/TODO index 2f2c1bb..62e1d34 100644 --- a/TODO +++ b/TODO @@ -11,5 +11,3 @@ * vc.el * .srcignore - -* Test reposurgeon import. diff --git a/src b/src index be9acc9..aede05d 100755 --- a/src +++ b/src @@ -308,6 +308,9 @@ src copyto 'directory' ['file'...] src fast-export ['file'...] Export one or more projects to standard output as a git fast-import stream. The committer identification is copied from your Git configuration. + +src ls + List all registered files. """ def init_method(*args): @@ -369,7 +372,7 @@ def preamble(cmd, args): except OSError: croak("repo directory %s does not exist" % repodir) if len(masters) == 1: - args += [master[:-2] for master in masters] + args += [backend.workfile(master) for master in masters] else: croak("%s requires at least one file argument" % cmd) return(revspec, args) @@ -694,7 +697,7 @@ def moveto_method(*args): def copyto_method(*args): "Copy a file and its history to another directory." - (revspec, args) = preamble("moveto", args) + (revspec, args) = preamble("copyto", args) if revspec is not None: croak("moveto doesn't take a revision spec") if args: @@ -716,6 +719,18 @@ def copyto_method(*args): if not quiet and len(args) > 1: announce("%s -> %s" % target) +def ls_method(*args): + "List registered files." + if args: + croak("ls cannot accept arguments") + try: + masters = os.listdir(repodir) + except OSError: + croak("repo directory %s does not exist" % repodir) + masters.sort() + for master in masters: + sys.stdout.write(backend.workfile(master) + "\n") + dispatch = { "help": help_method, "init": init_method, @@ -733,6 +748,7 @@ dispatch = { "fast-export": fast_export_method, "moveto": moveto_method, "copyto": copyto_method, + "ls": ls_method, } class RCS: @@ -750,6 +766,8 @@ class RCS: return RCS.RCSLifter(name) def master(self, arg): return os.path.join(repodir, arg + ",v") + def workfile(self, arg): + return arg[:-2] def add(self, arg): "Register a file" do_or_die("rcs -q -kb -i {0}