Regression test passes.
* src branch
-* src rename/mv
-
-* src remove/rm
-
* src fast-import
* vc.el
the working copy against the last version checked in. With one revno,
diffs the working copy against that stored revision; with a range,
+src ls
+ List all registered files.
+
+src move 'old' 'new'
+ Rename a file and its master. Refuses to step on existing files or masters.
+ 'mv' and 'rename' are synonyms.
+
+src copy 'old' 'new'
+ Rename a file and its master. Refuses to step on existing files or masters.
+ 'cp' is a synonym.
+
src moveto 'directory' ['file'...]
Moves files and their histories to another directory.
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.
+The omission of 'src remove' is a deliberate speed bump.
"""
def init_method(*args):
"Copy a file and its history to another directory."
dircmd("copyto", backend.copyto, args)
+def filecmd(legend, hook, args):
+ (revspec, args) = preamble(legend, args)
+ if revspec is not None:
+ croak("%s doesn't take a revision spec" % legend)
+ elif len(args) != 2:
+ croak("%s requires exactly two arguments" % legend)
+ (source, target) = args
+ if not os.path.exists(source):
+ croak("I see no '%s' here." % source)
+ elif not os.path.exists(backend.master(source)):
+ croak("%s is not registered, skipping." % source)
+ elif os.path.exists(backend.master(target)):
+ croak("%s is registered, I won't step on it")
+ elif os.path.exists(target):
+ croak("%s exists, please delete manually if you want it gone")
+ hook(src, target)
+
+def move_method(*args):
+ "Move a file and its history."
+ filecmd("move", backend.move, args)
+
+def copy_method(*args):
+ "Copy a file and its history."
+ filecmd("copy", backend.copy, args)
+
def ls_method(*args):
"List registered files."
if args:
"moveto": moveto_method,
"copyto": copyto_method,
"ls": ls_method,
+ "move": move_method,
+ "mv": move_method,
+ "rename": move_method,
+ "copy": copy_method,
+ "cp": copy_method,
}
class RCS:
def set_tag(self, tagname, revision, arg):
"Set a specified tag."
do_or_die("rcs -N{0}:{1} {2}".format(tagname, revision, arg))
+ def move(self, source, target):
+ "Move a file and its history."
+ do_or_die("mv {0} {1} && mv {2} {3]".format(source, target,
+ self.master(source),
+ self.master(target)))
+ def copy(self, source, target):
+ "Copy a file and its history."
+ do_or_die("cp {0} {1} && cp {2} {3]".format(source, target,
+ self.master(source),
+ self.master(target)))
def moveto(self, arg, target):
"Move a file and its history to a target directory."
# Using mv(1) evades cross-filesystem issues
src add ['file'...]
Initialize new project histories for specified files.
-src commit [- | -m commentstring | -f commentfile] ['file'...]
+src commit [- | -m commentstring | -f commentfile] ['file'...]::
Enters a commit for specified files. Separately to each one.
With '-', take comment text from stdin; with '-m' use the
following string as the comment;with '-f' take from a file.
ci is a synonym for commit.
-src checkout [revision-spec] ['file'...]
+src checkout [revision-spec] ['file'...]::
Refresh the working copy of the file(s) from their history files.
co is a synonym for checkout.
-src cat [revision-spec] ['file'...]
+src cat [revision-spec] ['file'...]::
Send the specified revisions of the files to standard output.
-src branch [delete|del|-d] ['branchname']
+src branch [delete|del|-d] ['branchname']::
Create, switch to, or delete a branch. With no arguments, list branches.
-src tag [delete|del|-d] ['tagname'] ['revision-spec'] ['file'...]
+src tag [delete|del|-d] ['tagname'] ['revision-spec'] ['file'...]::
Create, switch to, or delete a tag. With no arguments, list tags.
-src list ['revision-spec'] ['file'...]
+src list ['revision-spec'] ['file'...]::
Sends summary information about the specified commits to standard output.
In each file listing, the summary line tagged with '*' is the
state that checkout would return to. The default revision-spec is
all commits on the current branch.
-src log ['revision-spec'] ['file'...]
+src log ['revision-spec'] ['file'...]::
Sends log information about the specified commits to standard output.
The default revision-spec is all commits on the current branch.
-src diff ['revision-spec'] ['file'...]
+src diff ['revision-spec'] ['file'...]::
Sends a diff listing to standard output. With no revision spec, diffs
the working copy against the last version checked in. With one revno,
diffs the working copy against that stored revision; with a range,
-src moveto 'directory' ['file'...]
+src ls::
+ List all registered files.
+
+src rename 'old' 'new'::
+ Rename a file and its master. Refuses to step on existing files or masters.
+ 'mv' and 'rename' are synonyms.
+
+src copy 'old' 'new'::
+ Rename a file and its master. Refuses to step on existing files or masters.
+ 'cp' is a synonym.
+
+src moveto 'directory' ['file'...]::
Moves files and their histories to another directory.
-src copyto 'directory' ['file'...]
+src copyto 'directory' ['file'...]::
Copies files and their histories to another directory.
-src fast-export ['file'...]
+src fast-export ['file'...]::
Export one or more projects as a git fast-import stream.
The committer identification is copied from your Git configuration.
-src ls
- List all registered files.
+The omission of 'src remove' is a deliberate speed bump.
If no files are specified, all eligible files are operated on in sequence.
diff -u testfile14 testfile15
check "fast-export"
-mkdir $SANDBOX/bar
-src $TESTOPTS moveto $SANDBOX/bar
-check "moveto"
+src $TESTOPTS rename testfile1 newname
+check "move"
+
+# untested: ls, moveto, copyto, copy
# end