]> thyrsus.com Git - rcs-fast-import.git/commitdiff
Storte deleted files ans empty with a Deleted state.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 11 Nov 2010 20:16:42 +0000 (15:16 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 11 Nov 2010 20:16:42 +0000 (15:16 -0500)
rcs-fast-import
rcs-fast-import.xml

index fb9c7168858af7eebf4b09c34a88475878d25d10..e470926a6bddc88c9adb54d8731a9021a3f7d255 100755 (executable)
@@ -7,7 +7,7 @@
 # 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.
@@ -25,10 +25,6 @@ revisions; with the -u option, check out but do not lock.
 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.
@@ -611,6 +607,19 @@ class RCS:
         # 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
@@ -633,7 +642,7 @@ class RCS:
                 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
@@ -641,8 +650,6 @@ if __name__ == '__main__':
        if (switch == '-?'):
            print __doc__
             raise SystemExit, 0
-        elif switch == '-d':
-            do_deletes = True
         elif switch == '-p':
             roundtrip = False
         elif switch in ('-l', '-u'):
@@ -669,15 +676,10 @@ if __name__ == '__main__':
                         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))
index 511982587c1ff36ab8d3988972b5edd84a2b2836..b1664f3b98c805c3bb0a9a63d3b46b46bacd7fcc 100644 (file)
@@ -2,23 +2,23 @@
 <!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>
@@ -60,9 +60,11 @@ as to maximize access to the unpacked history.</para>
 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>
@@ -73,11 +75,6 @@ to RCS. This tool deposits them as tagged revisions of a file named
 <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
@@ -110,6 +107,6 @@ stream was not linear.</para>
 <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>