]> thyrsus.com Git - sccs2rcs.git/commitdiff
Fixed to work with newer RCS.
authorEric S. Raymond <esr@thyrsus.com>
Tue, 17 Aug 1993 19:42:36 +0000 (19:42 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Tue, 17 Aug 1993 19:42:36 +0000 (19:42 +0000)
sccs2rcs

index 8ba350b82f2d4e2039131f1005ecb6314da43e5b..979b330d99f467dcd823a524d12710aac62e3454 100755 (executable)
--- a/sccs2rcs
+++ b/sccs2rcs
@@ -4,10 +4,14 @@
 # history into an RCS history without losing any of
 # the information contained therein.
 # It has been tested under the following OS's:
-#     SunOS 3.5, 4.0.3, 4.1
-#     Ultrix-32 2.0, 3.1
+#     Dell UUNIX 2.2 (System V Release 4)
 #
 # Things to note:
+#   + The -b (batch) option can be used to tell this script to run
+#     non-interactively.  In this mode, it assumes that you do not
+#     want to enter descriptions on initial checkins, nor change
+#     the default keyword substitution
+#
 #   + It will NOT delete or alter your ./SCCS history under any circumstances.
 #
 #   + Run in a directory where ./SCCS exists and where you can
@@ -41,6 +45,9 @@
 # kenstir@viewlogic.com
 # ...!harvard!cg-atla!viewlog!kenstir
 #
+# Eric S. Raymond
+# esr@snark.thyrsus.com
+#
 # $Id$
 
 
 #   /usr/local/bin/sccs should override /usr/ucb/sccs there
 set path = (/usr/local/bin $path)
 
+# Note: newer version of RCS require century digits on the -d option
+# of ci.  Losing SCCS doesn't supply them.  Kluge around this.
+#
+set century = 19
+
+############################################################
+# Option handling
+#
+while ($#argv)
+
+    if ($argv[1] == "-b") then
+       set nodesc = "0"
+       set nohack = "0"    
+    endif
+
+    shift
+end
 
 ############################################################
 # Error checking
@@ -76,14 +100,14 @@ else
     mkdir RCS
 endif
 
+set months = (Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)
+
 sccs clean
 
 set logfile = /tmp/sccs2rcs_$$_log
 rm -f $logfile
 set tmpfile = /tmp/sccs2rcs_$$_tmp
 rm -f $tmpfile
-set emptyfile = /tmp/sccs2rcs_$$_empty
-echo -n "" > $emptyfile
 set initialfile = /tmp/sccs2rcs_$$_init
 echo "Initial revision" > $initialfile
 set sedfile = /tmp/sccs2rcs_$$_sed
@@ -117,35 +141,40 @@ set rcs_keywords = (\
 ############################################################
 # Get some answers from user
 #
-echo ""
-echo "Do you want to be prompted for a description of each"
-echo "file as it is checked in to RCS initially?"
-echo -n "(y=prompt for description, n=null description) [y] ?"
-set ans = $<
-if ((_$ans == _) || (_$ans == _y) || (_$ans == _Y)) then
-    set nodesc = 0
-else
-    set nodesc = 1
+if ((_$nodesc == _)) then
+    echo ""
+    echo "Do you want to be prompted for a description of each"
+    echo "file as it is checked in to RCS initially?"
+    echo -n "(y=prompt for description, n=null description) [y]? "
+    set ans = $<
+    if ((_$ans == _) || (_$ans == _y) || (_$ans == _Y)) then
+       set nodesc = 0
+    else
+       set nodesc = 1
+    endif
 endif
-echo ""
-echo "The default keyword substitutions are as follows and are"
-echo "applied in the order specified:"
-set i = 1
-while ($i <= $#sccs_keywords)
-#    echo '    '\"$sccs_keywords[$i]\"'        ==>     '\"$rcs_keywords[$i]\"
-    echo "     $sccs_keywords[$i]      ==>     $rcs_keywords[$i]"
-    @ i = $i + 1
-end
-echo ""
-echo -n "Do you want to change them [n] ?"
-set ans = $<
-if ((_$ans != _) && (_$ans != _n) && (_$ans != _N)) then
-    echo "You can't always get what you want."
-    echo "Edit this script file and change the variables:"
-    echo '    $sccs_keywords'
-    echo '    $rcs_keywords'
-else
-    echo "good idea."
+
+if ((_$nohack == _)) then
+    echo ""
+    echo "The default keyword substitutions are as follows and are"
+    echo "applied in the order specified:"
+    set i = 1
+    while ($i <= $#sccs_keywords)
+#      echo '  '\"$sccs_keywords[$i]\"'        ==>     '\"$rcs_keywords[$i]\"
+       echo "  $sccs_keywords[$i]      ==>     $rcs_keywords[$i]"
+       @ i = $i + 1
+    end
+    echo ""
+    echo -n "Do you want to change them [n]? "
+    set ans = $<
+    if ((_$ans != _) && (_$ans != _n) && (_$ans != _N)) then
+       echo "You can't always get what you want."
+       echo "Edit this script file and change the variables:"
+       echo '    $sccs_keywords'
+       echo '    $rcs_keywords'
+    else
+       echo "good idea."
+    endif
 endif
 
 # create the sed script
@@ -155,7 +184,6 @@ while ($i <= $#sccs_keywords)
     @ i = $i + 1
 end
 
-
 ############################################################
 # Loop over every s-file in SCCS dir
 #
@@ -169,8 +197,14 @@ foreach sfile (SCCS/s.*)
         if ($status != 0) goto ERROR
 
         # get file into current dir and get stats
-        set date = `sccs prs -r$rev $file | grep "^D " | awk '{print $3, $4}'`
-        set author = `sccs prs -r$rev $file | grep "^D " | awk '{print $5}'`
+        set date   = (`sccs prs -d":Dd: :Dm: :Dy: :T: :P:" -r$rev $file`)
+       set day    = $date[1]
+       set month  = $date[2]
+       set year   = ${century}${date[3]}
+       set time   = $date[4]
+       set author = $date[5]
+       set date = "$day $months[$month] $year $time"
+
         echo ""
         echo "==> file $file, rev=$rev, date=$date, author=$author"
         sccs edit -r$rev $file >>& $logfile
@@ -186,8 +220,8 @@ foreach sfile (SCCS/s.*)
         # check file into RCS
         if ($firsttime) then
             set firsttime = 0
-            if ($nodesc) then
-                ci -f -r$rev -d"$date" -w$author -t$emptyfile $file <$initialfile >>& $logfile
+            if ($nodesc == 0) then
+                ci -f -r$rev -d"$date" -w$author -t/dev/null $file <$initialfile >>& $logfile
                 if ($status != 0) goto ERROR
                 echo initial rev checked into RCS without description
             else
@@ -228,7 +262,7 @@ end
 #
 echo cleaning up...
 mv SCCS old-SCCS
-rm -f $tmpfile $emptyfile $initialfile $sedfile
+rm -f $tmpfile $initialfile $sedfile
 echo ===================================================
 echo "       Conversion Completed Successfully"
 echo ""