]> thyrsus.com Git - rcs-fast-import.git/commitdiff
OK, successful creation of copy with no history.
authorEric S. Raymond <esr@thyrsus.com>
Sat, 13 Nov 2010 07:34:58 +0000 (02:34 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Sat, 13 Nov 2010 07:34:58 +0000 (02:34 -0500)
rcs-fast-import

index 0c0ec2b0953c17c27ddc6074bcfaf9ee003ca7b6..5e7b9f9036156b8ded93784349c84b5d95aa358a 100755 (executable)
@@ -565,6 +565,7 @@ class RCS:
     "Class encapsulating RCS version-control operations."
     historyfile = ".HISTORY"
     def __init__(self):
+        self.roundtrip = False
         if verbose:
             if not os.path.exists("RCS"):
                 try:
@@ -611,7 +612,7 @@ class RCS:
     def precommit(self, event):
         if verbose:
             RCS.record("commit")
-    def modify(self, event, path, mode, copyfile, roundtrip):
+    def modify(self, event, path, mode, copyfile):
         "Perform RCS file checkins and modifications,"
         if mode == "160000":
             raise FatalException("ignoring a submodule link %s", path)
@@ -629,7 +630,7 @@ class RCS:
                     os.link(copyfile, path)
                 except OSError:
                     raise FatalException("refusing to step on %s." % path)
-            if roundtrip:
+            if self.roundtrip:
                 comment = event.email_out()
             else:
                 comment = event.comment
@@ -670,10 +671,15 @@ class RCS:
         uphere = os.path.basename(target)
         do_or_die("co %s" % RCS.master(source), legend)
         os.rename(source, uphere)
-        do_or_die("ci -i -m'%s of %s' -l %s %s"
-                  % (legend, source, uphere, RCS.master(target)),
-                  legend.lower())
-        # FIXME: Must hack the date on the copty so RCS won't barf.
+        if self.roundtrip:
+            comment = event.email_out()
+        else:
+            comment = event.comment
+        command = "ci -l"
+        command += " -d'%s'" % event.committer.date.rfc822()
+        command += ' -m"%s"' % comment.replace('"', '\\"')
+        command += " " + uphere + " " + RCS.master(uphere)
+        do_or_die(command, legend.lower())
         RCS.record("C", source)
         RCS.record("T", target)
         os.remove(uphere)
@@ -714,6 +720,7 @@ if __name__ == '__main__':
     try:
         with Repository() as repo:
             repo.fast_import(sys.stdin, progress=verbose>0)
+            repo.roundtrip = roundtrip 
             for event in repo.commits():
                 vcs.precommit(event)
                 for op in event.fileops:
@@ -723,7 +730,7 @@ if __name__ == '__main__':
                         if op.mode == "160000":
                             complain("cannot represent a submodule link in RCS")
                         else:
-                            vcs.modify(event, op.path, op.mode, op.copyname, roundtrip)
+                            vcs.modify(event, op.path, op.mode, op.copyname)
                     elif op.op in ("D", "deleteall"):
                         if verbose:
                             announce("%5s D %s" % (event.mark, op.path))