# Requires Python 2.5 or newer and RCS 5.7 or newer.
#
"""
-Usage: rcs-fast-import [-v] [-p] [-u] [-l] [-d] [-n] [-V]
+Usage: rcs-fast-import [-v] [-p] [-u] [-l] [-n] [-V]
Break the content of a git-fast-import stream on stdin into individual RCS
master files in RCS subdirectories of the corresponding directory structure.
The -V option displays the program version number and exits. -? displays
this help and exits.
-The -d option enables delete operations in the the input
-stream. Normally, delete operations in the input stream are ignored so
-as to maximize access to the unpacked history.
-
The -n option sets dry-run mode; parse the import stream, then go through
all logic other than actually creating files. Useful for debugging in
combination with -v.
# FIXME: Someday, do real branch structure here.
if event.is_tip():
do_or_die("rcs -n'%s': %s" % (event.branch, " ".join(RCS.rcsfiles())))
+ def delete(self, commit, path):
+ "Mark a path deleted."
+ file(path, "w").close()
+ if roundtrip:
+ comment = event.email_out()
+ else:
+ comment = event.comment
+ command = "ci -l"
+ command += " -sDeleted"
+ command += " -d'%s'" % event.committer.date.rfc822()
+ command += ' -m"%s"' % comment.replace('"', '\\"')
+ command += " " + path + " " + RCS.master(path)
+ os.remove(path)
def rename(self, source, target):
"Perform RCS renames."
# Dodgy, but since user is more likely to be
do_or_die("co -u %s" % (" ".join(RCS.rcsfiles()),))
if __name__ == '__main__':
- (options, arguments) = getopt.getopt(sys.argv[1:], "dlnpuvV?")
+ (options, arguments) = getopt.getopt(sys.argv[1:], "lnpuvV?")
do_unlocked_checkouts = False
checkout_mode = None
roundtrip = True
if (switch == '-?'):
print __doc__
raise SystemExit, 0
- elif switch == '-d':
- do_deletes = True
elif switch == '-p':
roundtrip = False
elif switch in ('-l', '-u'):
else:
committables.append((op.path, op.mode, op.copyname))
elif op.op in ("D", "deleteall"):
- # If we delete masters, we lose ability to
- # retrieve old versions.
- if do_deletes:
- if verbose:
- announce("%5s D %s" % (event.mark, op.path))
- if not dryrun:
- vcs.remove(op.path)
- elif verbose:
- announce("%5s D %s ignored" % (event.mark, op.path))
+ if verbose:
+ announce("%5s D %s" % (event.mark, op.path))
+ if not dryrun:
+ vcs.remove(op.path)
elif op.op == "R":
if verbose:
announce("%5s R '%s' '%s'" % (event.mark, op.source, op.target))
<!DOCTYPE refentry PUBLIC
"-//OASIS//DTD DocBook XML V4.1.2//EN"
"docbook/docbookx.dtd">
-<refentry id='rcs-fast-export.1'>
+<refentry id='rcs-fast-import.1'>
<refmeta>
-<refentrytitle>rcs-fast-export</refentrytitle>
+<refentrytitle>rcs-fast-import</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class='date'>Nov 11 2010</refmiscinfo>
-<refmiscinfo class='productname'>rcs-fast-export</refmiscinfo>
-<refmiscinfo class='source'>rcs-fast-export</refmiscinfo>
+<refmiscinfo class='productname'>rcs-fast-import</refmiscinfo>
+<refmiscinfo class='source'>rcs-fast-import</refmiscinfo>
<refmiscinfo class='manual'>Development Tools</refmiscinfo>
</refmeta>
<refnamediv id='name'>
-<refname>rcs-fast-export</refname>
-<refpurpose>surgical operations on repositories</refpurpose>
+<refname>rcs-fast-import</refname>
+<refpurpose>unpack a fast-import stream into an RCS repository tree</refpurpose>
</refnamediv>
<refsynopsisdiv id='synopsis'>
<cmdsynopsis>
- <command>rcs-fast-export</command>
+ <command>rcs-fast-import</command>
<arg choice='opt'>-v</arg>
<arg choice='opt'>-u</arg>
<arg choice='opt'>-l</arg>
all logic other than actually creating files. Useful for debugging in
combination with -v.</para>
-<para>R file operations rename corresponding RCS master files; C operations
+<para>In order to preserve history, D file operations do not delete
+previously-created master files; instead, an empty file is checked
+in as the content and the file's RCS state tag is set to "Deleted".
+R file operations rename corresponding RCS master files. C operations
initialize a new file.</para>
-
</refsect1>
<refsect1 id='bugs'><title>BUGS</title>
<filename>ANNOTATED-TAGS</filename> in the toplevel RCS
directory.</para>
-<para>If D or R operations are present in the import stream, the
-conversion will not round-trip properly (that is the file structure
-after rcs-fast-export | rcs-fast-import won't be an exact copy) with
-differences near deleted and renamed files.</para>
-
<para>In each commit, the committer date entered in RCS metadata will
be the committer date from the import stream, but the committer
identity will be lost; all commits are checked in as if by the
<refsect1 id='author'><title>AUTHOR</title>
<para>Eric S. Raymond <email>esr@thyrsus.com</email>; project page at <ulink
-url='http://www.catb.org/~esr/rcs-fast-export'>http://www.catb.org/~esr/rcs-fast-export</ulink>.</para>
+url='http://www.catb.org/~esr/rcs-fast-import'>http://www.catb.org/~esr/rcs-fast-import</ulink>.</para>
</refsect1>
</refentry>