]> thyrsus.com Git - sccs2rcs.git/commitdiff
Forward-port to work with cssc.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 6 Nov 2014 11:57:12 +0000 (06:57 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 6 Nov 2014 11:57:12 +0000 (06:57 -0500)
sccs2rcs

index 611eb91036c8c4765d969d1f13c94bc3671291e1..89680f7801c728a95d384af8e1411951f5aca7f7 100755 (executable)
--- a/sccs2rcs
+++ b/sccs2rcs
@@ -6,6 +6,11 @@
 # history without losing any of the information contained therein.
 # It requires that the SCCS and RCS tools be installed on your system. 
 #
+# This code requires only get, unget, and prs from the SCCS tools.
+# it now assumes these will be called Berekely-style through an
+# sccs front end, e.g. "sccs get", "sccs unget", and "sccs prs".
+# This will work with the free CSSC tools.
+#
 # Run this in a directory with an SCCS subdirectory. It will convert
 # all the SCCS files to corresponding RCS master files in a new RCS
 # directory; the SCCS data itself is accessed read-only. It will
@@ -165,7 +170,7 @@ def die(msg):
     record("error recovery begins")
     for master in os.listdir("SCCS"):
         if is_sccsmaster(master):
-            do_it("unget " + master)
+            do_it("sccs unget " + master)
     print >>sys.stderr, """\
 Danger!  Danger!
 Incomplete history in ./RCS -- remove it.
@@ -251,7 +256,7 @@ if __name__ == '__main__':
         # Extract a list of revisions from the master 
         revisions = []
         try:
-            for line in os.popen("prs " + sccsmaster(stem), "r"):
+            for line in os.popen("sccs prs " + sccsmaster(stem), "r"):
                 if line.startswith("D "):
                     revisions.append(line.split()[1])
         except OSError:
@@ -260,10 +265,10 @@ if __name__ == '__main__':
             die("garbled revision line in master file " + master)
         revisions.reverse()
 
-        # Now use prs to run through the revision list extracting data
+        # Now use sccs prs to run through the revision list extracting data
         record("%s revisions: %s" % (stem, ", ".join(revisions)))
         for rev in revisions:
-            cmd = 'prs -d":Dd: :Dm: :Dy: :T: :P:" -r%s SCCS/s.%s' % (rev, stem)
+            cmd = 'sccs prs -d":Dd: :Dm: :Dy: :T: :P:" -r%s SCCS/s.%s' % (rev, stem)
             date = do_it_or_die(cmd).strip()
             try:
                 (day, month, year, tod, author) = date.split()
@@ -280,7 +285,7 @@ if __name__ == '__main__':
             rcsdate = day + " " + months[int(month)-1] + " " + year + " " + tod
             progress("==> file %s, rev=%s, date=%s, author=%s" \
                   % (stem, rev, rcsdate, author)) 
-            do_it_or_die("get -e -r%s %s" % (rev, sccsmaster(stem)))
+            do_it_or_die("sccs get -e -r%s %s" % (rev, sccsmaster(stem)))
             record("checked out of SCCS")
 
             # replace SCCS keywords with RCS keywords
@@ -333,7 +338,7 @@ if __name__ == '__main__':
                     do_it_or_die("rcs -l %s" % (stem,))
                     record("got trunk lock")
                 # Extract the delta message for this revision
-                deltamsg = do_it_or_die("prs -r%s SCCS/s.%s" % (rev, stem))
+                deltamsg = do_it_or_die("sccs prs -r%s SCCS/s.%s" % (rev, stem))
                 deltalines = deltamsg.split("\n")
                 while deltalines:
                     line = deltalines[0]
@@ -342,7 +347,7 @@ if __name__ == '__main__':
                         break
                 # Strip leading blank lines if present.
                 if deltalines != ['', '']:
-                    while not deltalines[0].strip():
+                    while deltalines and not deltalines[0].strip():
                         deltalines.pop(0)
                 deltamsg = "\n".join(deltalines)
                 cmd = 'ci -f -r%s -d"%s" -w%s %s' % (rev, rcsdate, author, stem)
@@ -355,7 +360,7 @@ if __name__ == '__main__':
                 except OSError:
                     die("RCS checkin of delta failed")
             # We're done with this master, unlock it.
-           do_it_or_die("unget -r%s %s" % (rev, sccsmaster(stem)))
+           do_it_or_die("sccs unget -r%s %s" % (rev, sccsmaster(stem)))
 
     # Generate tags from snapshots created by Emacs VC mode
     tagnames = os.path.join("SCCS", "VC-names")