]> thyrsus.com Git - sccs2rcs.git/commitdiff
Another debugging checkpoint.
authorEric S. Raymond <esr@thyrsus.com>
Fri, 13 Jul 2007 12:10:29 +0000 (12:10 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Fri, 13 Jul 2007 12:10:29 +0000 (12:10 +0000)
sccs2rcs

index adb60a05c3d5484f19220dc18e0870999e1b7a92..ac7d9f926bf76a1f3f0611312759832c569f920c 100755 (executable)
--- a/sccs2rcs
+++ b/sccs2rcs
@@ -109,13 +109,14 @@ def progress(msg):
 
 def get_output(command):
     global logtext
-    logtext += "$ " + command
+    logtext += "$ " + command + "\n"
     (st, out) = commands.getstatusoutput(command)
     logtext += out + "\n"
     return out + "\n"
 
 def die(msg):
     print >>sys.stderr, "sccs2rcs: fatal error, ", msg
+    progress("error recovery begins")
     for filename in os.listdir("."):
         if os.path.exists(sccsfile(filename)) and writeable(filename):
             get_output("unget " + sccsfile(filename))
@@ -135,11 +136,11 @@ def warn(msg):
 
 def get_output_or_die(command):
     global logtext
-    logtext += "$ " + command
+    logtext += "$ " + command + "\n"
     (st, out) = commands.getstatusoutput(command)
+    logtext += out + "\n"
     if st != 0:
         die("'%s' failed" % command)
-    logtext += out + "\n"
     return out + "\n"
 
 if __name__ == '__main__':
@@ -206,10 +207,10 @@ if __name__ == '__main__':
         revisions.reverse()
 
         # Now use prs to run through the revision list extracting data
-        progress("%s revisions: %s\n" % (file, ", ".join(revisions)))
+        progress("%s revisions: %s" % (file, ", ".join(revisions)))
         for rev in revisions:
             cmd = 'prs -d":Dd: :Dm: :Dy: :T: :P:" -r%s SCCS/s.%s' % (rev, file)
-            date = get_output_or_die(cmd)
+            date = get_output_or_die(cmd).strip()
             try:
                 (day, month, year, tod, author) = date.split()
             except ValueError:
@@ -247,14 +248,15 @@ if __name__ == '__main__':
                 firsttime = False
                 if file in initstrings:
                     cmd = 'ci -f -r%s -d"%s" -w%s -t-%s %s' \
-                          % (rev, date, author, initstrings[file], file)
+                          % (rev, rcsdate, author, initstrings[file], file)
                 else:
                     if initstrings:
                         warn("no description for %s in comments file" % file)
                     cmd = 'ci -f -r%s -d"%s" -w%s -t/dev/null %s' \
-                          % (rev, date, author, file)
+                          % (rev, rcsdate, author, file)
                 cmd = "echo 'Initial revision.' | " + cmd
                 get_output_or_die(cmd)
+                progress("initial checkin successful")
             else:
                 # get RCS lock    
                 revparts = rev.split(".")
@@ -290,7 +292,7 @@ if __name__ == '__main__':
     # Replace all files for which there exist SCCS masters,
     progress("replacing workfiles")
     for filename in os.listdir("."):
-        if os.exists(sccsfile(filename)):
+        if os.path.exists(sccsfile(filename)):
             os.remove(filename)
             os.system("co " + file)
     print progress("done.")