src moveto 'directory' ['file'...]
Moves files and their histories to another directory.
+src copyto 'directory' ['file'...]
+ Copies files and their histories to another directory.
+
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.
sys.stdout.write("reset refs/tags/%s\nfrom :%d\n\n" % (key, markmap[val]))
def moveto_method(*args):
- "Register a file into src control."
+ "Move a file and its history to another directory."
(revspec, args) = preamble("moveto", args)
if revspec is not None:
croak("moveto doesn't take a revision spec")
# Using mv(1) evades cross-filesystem issues
do_or_die("mv {0} {1} && mv {2} {3]/{4}".format(arg, target, master(arg), target, repodir))
if not quiet and len(args) > 1:
- announce("%s -> %s" % target)
+ announce("%s -> %s" % target)
+
+def copyto_method(*args):
+ "Copy a file and its history to another directory."
+ (revspec, args) = preamble("moveto", args)
+ if revspec is not None:
+ croak("moveto doesn't take a revision spec")
+ if args:
+ target = args.pop(0)
+ else:
+ croak("moveto requires a sirectory argument")
+ if not os.path.exists(target):
+ croak("%s does not exist" % arg)
+ if not os.path.isdir(target):
+ croak("%s is not a directory" % arg)
+ init_method(target)
+ for arg in args:
+ if not os.path.exists(arg):
+ croak("I see no '%s' here." % arg)
+ elif not os.path.exists(master(arg)):
+ croak("%s is not registered, skipping." % arg)
+ else:
+ # Using cp(1) evades cross-filesystem issues
+ do_or_die("cp {0} {1} && cp {2} {3]/{4}".format(arg, target, master(arg), target, repodir))
+ if not quiet and len(args) > 1:
+ announce("%s -> %s" % target)
dispatch = {
"help": help_method,
"tag": tag_method,
"fast-export": fast_export_method,
"moveto": moveto_method,
+ "copyto": copyto_method,
}
if __name__ == "__main__":