]> thyrsus.com Git - rcs-fast-import.git/commitdiff
Now seems to do deletes correctly.
authorEric S. Raymond <esr@thyrsus.com>
Sat, 13 Nov 2010 14:54:09 +0000 (09:54 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Sat, 13 Nov 2010 14:54:09 +0000 (09:54 -0500)
rcs-fast-import

index 68343f76ea10b5425c36cd9069aa8277271eaba4..7d390f7f21b5d92ac9c4251f9783e0af71ad00d0 100755 (executable)
@@ -621,20 +621,22 @@ class RCS:
                 fp.write(path)
             fp.write("\n")
     @staticmethod
-    def instantiate(path, copyfile):
+    def instantiate(path, copyfile=None):
         rcsdir = os.path.join(os.path.dirname(path), "RCS")
         if not os.path.exists(rcsdir):
             try:
                 os.makedirs(rcsdir)
             except OSError:
                 raise FatalException("can't create %s." % rcsdir)
-        if verbose >= DEBUG_SHUFFLE:
-            announce("linking %s to %s" % (os.path.relpath(copyfile), path))
-        if not dryrun:
-            try:
-                os.link(copyfile, path)
-            except OSError, e:
-                raise FatalException("refusing to step on %s: %s." % (path, `e`))
+        if copyfile:
+            if verbose >= DEBUG_SHUFFLE:
+                announce("linking %s to %s" % (os.path.relpath(copyfile), path))
+            if not dryrun:
+                try:
+                    os.link(copyfile, path)
+                except OSError, e:
+                    raise FatalException("refusing to step on %s: %s." % (path, `e`))
+        return rcsdir
     def normal_checkin(self, commit, path, legend, state=None):
         if self.roundtrip:
             comment = event.email_out()
@@ -661,7 +663,8 @@ class RCS:
             RCS.record("M", path)
     def delete(self, commit, path, legend="delete"):
         "Mark a path deleted, but don't actually remove the master."
-        RCS.instantiate(path, "/dev/null")
+        RCS.instantiate(path)
+        open(path, "w").close()
         self.normal_checkin(commit, path, legend="delete", state="Deleted")
         RCS.record("D", path)
     def copy(self, commit, source, target, legend="Copy"):
@@ -669,6 +672,7 @@ class RCS:
         if os.path.exists(RCS.master(target)):
             raise FatalException("copy to existing file")
         do_or_die("co %s" % RCS.master(source), legend)
+        RCS.instantiate(target)
         loud_rename(source, target)
         self.normal_checkin(commit, target, legend="copy")
         RCS.record("C", source)