Export one or more projects to standard output as a git fast-import stream.
The committer identification is copied from your Git configuration.
+src fast-import [-p]
+ Parse a git-fast-import stream from standard input. The modifications for
+ each individual file become a SRC history. Mark, committer and
+ author data, and mark cross-references to parent commits, are preserved
+ in RFC-822-style headers on log comments unless the -p (plain) option
+ is given, in which case this metadata is discarded.
+
The omission of 'src remove' is a deliberate speed bump.
"""
args = list(args)
croak("branches are not yet implemented.")
+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" % source)
+ elif os.path.exists(target):
+ croak("%s exists, please delete manually if you want it gone" % target)
+ else:
+ hook(source, 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:
+ 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")
+
def fast_export_method(*args):
"Dump revision content to standard output."
(revspec, args) = preamble("cat", args)
if val in revrange:
sys.stdout.write("reset refs/tags/%s\nfrom :%d\n\n" % (key, markmap[val]))
-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" % source)
- elif os.path.exists(target):
- croak("%s exists, please delete manually if you want it gone" % target)
- else:
- hook(source, 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:
- 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")
+def fast_import_method(*args):
+ "Accept a git fast-import stream on stdin, turn it into file histories."
+ # Force -l to fit SRC's lockless interface.
+ do_or_die(r"rcs-fast-import -l " +" ".join(args))
dispatch = {
"help": help_method,
"diff": diff_method,
"tag": tag_method,
"branch": branch_method,
- "fast-export": fast_export_method,
"ls": ls_method,
"move": move_method,
"mv": move_method,
"rename": move_method,
"copy": copy_method,
"cp": copy_method,
+ "fast-export": fast_export_method,
+ "fast-import": fast_import_method,
}
class RCS:
Export one or more projects as a git fast-import stream.
The committer identification is copied from your Git configuration.
+src fast-import [-p]::
+ Parse a git-fast-import stream from standard input. The modifications for
+ each individual file become a SRC history. Mark, committer and
+ author data, and mark cross-references to parent commits, are preserved
+ in RFC-822-style headers on log comments unless the -p (plain) option
+ is given, in which case this metadata is discarded.
+
The omission of 'src remove' is a deliberate speed bump.
If no files are specified, all eligible files are operated on in sequence.
== NOISE CONTROL ==
Silence is golden. When you have selected only one file to operate
-on, and the command is not a report generator (cat, log, list,
+on, and the command is not a report generator (status, cat, log, list,
fast-export, the listing modes of tag and branch, ls) you will see a reply
only if the operation failed.
-Other commands (add, commit, checkout, tag creation and deletion,
-moveto, copyto) 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) 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.
== BACKWARD COMPATIBILITY ==
== DEBUGGING OPTIONS ==
-These will be of interet mainly to developers.
+These will be of interest mainly to developers.
A '-d' option before the main command word turns on debugging
messages; it can be repeated for higher debugging levels.
It also attributes all commits to J. Random Hacker and sets a
constant screen witch of 79. It's for regression testing.
+== REQUIREMENTS ==
+
+The RCS tools must be installed and accessible on your path;
+rcs-fast-import(1) is required to support the src fast-import command.
+
== LIMITATIONS ==
The 'branch' command is not yet implemented; it is described here to