]> thyrsus.com Git - sccs2rcs.git/commitdiff
Implement and document -l.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 6 Nov 2014 13:10:32 +0000 (08:10 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 6 Nov 2014 13:10:32 +0000 (08:10 -0500)
sccs2rcs
sccs2rcs.xml

index 89680f7801c728a95d384af8e1411951f5aca7f7..53bb2d689c1c698e28f61437d05891693e2cbba0 100755 (executable)
--- a/sccs2rcs
+++ b/sccs2rcs
@@ -177,9 +177,14 @@ Incomplete history in ./RCS -- remove it.
 Original unchanged history in ./SCCS.
 """
     if logtext:
-        print "Log follows:"
-        print logtext
-        print "Log ends here."
+        if logfile:
+            wfp = open(logfile, "w")
+            wfp.write(logtext)
+            wfp.close()
+        else:
+            print "Log follows:"
+            print logtext
+            print "Log ends here."
     sys.exit(1)
 
 def warn(msg):
@@ -199,10 +204,13 @@ def do_it_or_die(command):
 
 if __name__ == '__main__':
     comments = None
-    (options, arguments) = getopt.getopt(sys.argv[1:], "c:")
+    logfile = None
+    (options, arguments) = getopt.getopt(sys.argv[1:], "c:l:")
     for (switch, val) in options:
         if switch == '-c':
             comments = val
+        elif switch == '-l':
+            logfile = val
 
     # User may have supplied a comments file
     initstrings = {} 
@@ -377,6 +385,12 @@ if __name__ == '__main__':
     for filename in os.listdir("SCCS"):
         if is_sccsmaster(master):
             do_it("co " + rcsfile(workfile(master)))
+
+    if logfile:
+        wfp = open(logfile, "w")
+        wfp.write(logtext)
+        wfp.close()
+
     progress("done.")
 
 # sccs2rcs ends here
index a643ffff5f46d3e138e7956df6785be746d2d71c..3626f579436ece9596f6b5ae8fa2a2858a149aa5 100644 (file)
@@ -20,6 +20,7 @@
 <cmdsynopsis>
   <command>sccs2rcs</command>
   <arg choice='opt'>-c <replaceable>commentfile</replaceable></arg>
+  <arg choice='opt'>-l <replaceable>logfile</replaceable></arg>
 </cmdsynopsis>
 </refsynopsisdiv>
 
@@ -45,9 +46,13 @@ complain about the exceptions so you can see them.</para>
 <para>If this tool fails it will tell you why. `rm -rf RCS; unget SCCS/s.*'
 will recover your initial state.</para>
 
-<para>There is one option. With -c you can specify an initial-comments file.
+<para>With -c you can specify an initial-comments file.
 Each line should consist of a filename followed by a colon, followed
 by the RCS initial coment to set for that file.</para>
+
+<para>With -l you can make the command log be written to a specified 
+file, whether the program fails or succeeds. This is mainly useful
+for debugging unusual situations.</para>
 </refsect1>
 
 <refsect1 id='returns'><title>ERROR RETURNS</title>