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'...]
+ Moves 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.
def init_method(*args):
"Create a repo directory if none already exists."
- if not os.path.exists(repodir):
+ if args:
+ target = os.path.join(args[0], ".src")
+ else:
+ target = repodir
+ if not os.path.exists(target):
try:
- os.mkdir(repodir)
+ os.mkdir(target)
except OSError:
croak("creation failed, check directory permissions.")
- elif os.path.isdir(repodir):
- croak("%s already exists." % repodir)
+ elif os.path.isdir(target):
+ croak("%s already exists." % target)
else:
- croak("%s exists but is not a directory." % repodir)
+ croak("%s exists but is not a directory." % target)
def preamble(cmd, args):
"Common setup code."
if val in revrange:
sys.stdout.write("reset refs/tags/%s\nfrom :%d\n\n" % (key, markmap[val]))
+def moveto_method(*args):
+ "Register a file into src control."
+ (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 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)
+
dispatch = {
"help": help_method,
"init": init_method,
"diff": diff_method,
"tag": tag_method,
"fast-export": fast_export_method,
+ "moveto": moveto_method,
}
if __name__ == "__main__":
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'...]
+ Moves files and their histories to another directory.
+
src fast-export ['file'...]
Export one or more projects as a git fast-import stream.
The committer identification is copied from your Git configuration.
fast-export, the listing modes of tag and branch) you will see a reply
only if the operation failed.
-Other commands (add, commit, checkout, tag creation and deletion) give
-you a success message per file when operating on multiple files, so
-you will not be in doubt about which operation succeeded. This
-behavior can be suppressed with the -q option, placed 'before' the
-subcommand word.
+Other commands (add, commit, checkout, tag creation and deletion,
+moveto) give you a success message per file when operating on multiple
+files, so you will not be in doubt about which operation succeeded.
+This behavior can be suppressed with the -q option, placed 'before'
+the subcommand word.
== DEBUGGING OPTIONS ==
constant screen witch of 79. It's for regression testing.
== DANGER! DANGER! ==
-This is a proof-of-concept alpha release. The 'branch' and
-'fast-export' commands are not yet implemented; they are
-described here to document the design.
+This is a proof-of-concept alpha release. The 'branch' command is not
+yet implemented; it is described here to document the design.
== IMPLEMENTATION NOTE ==
SRC presently uses RCS for back-end storage. This may change in the future.