]> thyrsus.com Git - rcs-fast-import.git/commitdiff
Checkpoint before changing API.
authorEric S. Raymond <esr@thyrsus.com>
Wed, 10 Nov 2010 20:05:44 +0000 (15:05 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Wed, 10 Nov 2010 20:05:44 +0000 (15:05 -0500)
rcs-fast-import

index 1143a4ace788a69e5cef25765526955bd47bb6c0..25d8f2a9bb843f33534c3548a6595e078b2b0669 100755 (executable)
@@ -541,23 +541,32 @@ class RCS:
     @staticmethod
     def master(filename):
         "Return the master file corresponding to a specified filename."
-        return "RCS/%s,v" % filename
-    def modify(self, path, mode, copy):
+        parts = os.path.split(filename)
+        parts.insert(-1, "RCS")
+        return os.path.join(parts)
+    def modify(self, event, path, mode, copyfile):
         "Perform RCS file checkins and modifications,"
         rcsdir = os.path.join(os.path.dirname(path), "RCS")
         if not os.path.exists(rcsdir):
             try:
-                os.mkdir(rcsdir)
+                os.makdirs(rcsdir)
             except OSError:
                 raise FatalException("can't create %s." % rcsdir)
+        workdir = os.path.dirname(filename)
+        masterfile = RCS.master(filename)
+        exists = os.path.exists(path)
+        shutil.copy(copyfile, workdir)
+        exists = os.path.exists(path)
+        if exists:
+            fp = do_or_die("ci -m '%s'" % (event.comment))
     def rename(self, source, target):
-        "Preform RCS renames."
+        "Perform RCS renames."
         # Dodgy, but since user is more likely to be
         # interested in later versions this is better
         # than doing nothing.
         os.rename(RCS.master(op.source), RCS.master(op.target))
     def copy(self, source, target):
-        "Preform RCS copies."
+        "Perform RCS copies."
         # The copy will get the original's history.
         # There's a case that what we ought to do instead
         # is check out the tip rev and use it to initialize
@@ -608,7 +617,8 @@ if __name__ == '__main__':
                         if verbose:
                             announce("%5d M %s" % (i+1, op.path))
                         if not dryrun:
-                            vcs.modify_file(op.path, op.mode, op.copyname)
+                            vcs.modify_file(event,
+                                            op.path, op.mode, op.copyname)
                     elif op.op in ("D", "deleteall"):
                         # If we delete masters, we lose ability to
                         # retrieve old versions.