]> thyrsus.com Git - rcs-fast-import.git/commitdiff
RCS *and* SCCS ids, not that we support SCCS yet.
authorEric S. Raymond <esr@thyrsus.com>
Sun, 14 Nov 2010 04:44:15 +0000 (23:44 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Sun, 14 Nov 2010 04:44:15 +0000 (23:44 -0500)
rcs-fast-import

index cdf03f6361ad37c719cfdbbe180426a2c7063469..5f11bce146f89bdd64c7e2ed8c2cc8b4f980df9b 100755 (executable)
@@ -593,8 +593,30 @@ def loud_rename(source, target):
 # our working-file paths. It also assumes that we have to stuff
 # commit metadata in comments as RFC822 headers if we want to keep it.
 
+class GenericRev:
+    "Encapsulate operations on an RCS/SCCS ID."
+    def __init__(self, rev=None):
+        if rev is None:
+            self.rev = [1, 1]
+        else:
+            self.rev = rev
+    def __hash__(self):
+        "Make these valid dictionary keys,"
+        return hash(tuple(self.rev))
+    def successor(self):
+        "Return the successor of this ID."
+        s = GenericRev(self.rev)
+        s.rev[-1] += 1
+        return s
+    def branch(self, branchnum):
+        "Return ID for the tip of a new branch."
+        return GenericRev(self.rev + [branchnum, 1])
+    def __str__(self):
+        return ".".join(map(str, self.rev))
+
 class Generic:
     "Generic file-oriented VCS - could be used for, say. SCCS as well as RCS."
+    revfactory = GenericRev
     def __init__(self):
         self.roundtrip = False
         if not os.path.exists(self.__class__.repodirectory):
@@ -706,32 +728,10 @@ class Generic:
         self.copy(commit, source, target, legend="Rename")
         self.delete(commit, source, legend="Rename")
 
-class RCSRev:
-    "Encapsulate operations on an RCS ID."
-    def __init__(self, rev=None):
-        if rev is None:
-            self.rev = [1, 1]
-        else:
-            self.rev = rev
-    def __hash__(self):
-        "Make these valid dictionary keys,"
-        return hash(tuple(self.rev))
-    def successor(self):
-        "Return the successor of this ID."
-        s = RCSRev(self.rev)
-        s.rev[-1] += 1
-        return s
-    def branch(self, branchnum):
-        "Return ID for the tip of a new branch."
-        return RCSRev(self.rev + [branchnum, 1])
-    def __str__(self):
-        return ".".join(map(str, self.rev))
-
 class RCS(Generic):
     "Class encapsulating RCS version-control operations."
     repodirectory = "RCS"
     mastertemplate = "%s,v"
-    revfactory = RCSRev
     def __init__(self):
         Generic.__init__(self)
     def checkin(self, commit, comment, op, path):
@@ -739,15 +739,15 @@ class RCS(Generic):
         command = "ci -l%s" % self.make_tip(commit, path)
         if op == "D":
             command += " -sDeleted"
-        command += " -d'%s'" % event.committer.date.rfc822()
+        command += " -d'%s'" % commit.committer.date.rfc822()
         command += ' -m"%s"' % comment.replace('"', '\\"')
         command += " " + path + " " + self.master(path)
         return command
     def checkout(self, path, branch):
-        "Check out the latest revision corresponding to path and branch"
+        "Check out the latest revision corresponding to path and branch."
         return "co -r%s %s" % (self.get_tip(path, branch), self.master(path))
     def postcommit(self, event):
-        # Save annotated tags for round-tripping
+        "Save annotated tags for round-tripping."
         for tag in event.taglist:
             with file("ANNOTATED-TAGS", "w") as fp:
                 fp.write(tag.email_out())