]> thyrsus.com Git - sccs2rcs.git/commitdiff
No longer requires sccs(1).
authorEric S. Raymond <esr@thyrsus.com>
Thu, 1 Aug 2002 20:23:18 +0000 (20:23 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 1 Aug 2002 20:23:18 +0000 (20:23 +0000)
sccs2rcs

index 6b1cc9d216898cdbe54f9499c096d5772e163c6f..bcdef5384a0003e29181159f45ef1d3cfaeee763 100755 (executable)
--- a/sccs2rcs
+++ b/sccs2rcs
@@ -3,11 +3,6 @@
 # Sccs2rcs is a script to convert an existing SCCS
 # history into an RCS history without losing any of
 # the information contained therein.
-# It has been tested under the following OS's:
-#     Dell UNIX 2.2 (System V Release 4)
-#     SunOS 3.5, 4.0.3, 4.1
-#     Ultrix-32 2.0, 3.1
-# It requires the BSD utility `sccs', also found under SVr4
 #
 # Things to note:
 #   + The -b (batch) option can be used to tell this script to run
 #
 #   + It will NOT delete or alter your ./SCCS history under any circumstances.
 #
-#   + Run in a directory where ./SCCS exists and where you can
-#       create ./RCS
-#
-#   + /usr/local/bin is put in front of the default path.
-#     (SCCS under Ultrix is set-uid sccs, bad bad bad, so
-#     /usr/local/bin/sccs here fixes that)
+#   + Run in a directory where ./SCCS exists and where you can create ./RCS
 #
 #   + Date, time, author, comments, branches, are all preserved.
 #
 #   + If a command fails somewhere in the middle, it bombs with
 #     a message -- remove what it's done so far and try again.
-#         "rm -rf RCS; sccs unedit `sccs tell`; sccs clean"
+#     (`rm -rf RCS; unget SCCS/s.*' should do the job.)
 #     There is no recovery and exit is far from graceful.
 #     If a particular module is hanging you up, consider
 #     doing it separately; move it from the current area so that
 # kenstir@viewlogic.com
 # ...!harvard!cg-atla!viewlog!kenstir
 #
-# I added some portability fixes and the -u option.
+# I added some portability fixes and the -u option.  More importantly,
+# I removed the dependencies on the BSD/SV `sccs' utility; this script
+# will now work on any system that has the base SCCS/RCS tools available.
 #
 # Eric S. Raymond
-# esr@snark.thyrsus.com
+# esr@thyrsus.com
 #
 # $Id$
 
 
-#we'll assume the user set up the path correctly
-# for the Pmax, /usr/ucb/sccs is suid sccs, what a pain
-#   /usr/local/bin/sccs should override /usr/ucb/sccs there
-set path = (/usr/local/bin $path)
-
 # Note: newer versions of RCS require century digits on the -d option
 # of ci.  Losing SCCS doesn't supply them.  Kluge around this.
 #
@@ -101,11 +88,12 @@ if (! -d SCCS) then
     echo "Error: ./SCCS directory not found."
     exit 1
 endif
-set edits = (`sccs tell`)
-if ($#edits) then
-    echo "Error: $#edits file(s) out for edit...clean up before converting."
-    exit 1
-endif
+foreach f (*)
+    if (-f SCCS/s.$f && -w $f) then
+       echo "Error: $f is out for edit...clean up before converting."
+       exit 1
+    endif
+end
 if (-d RCS) then
     echo "Warning: RCS directory exists"
     if (`ls -a RCS | wc -l` > 2) then
@@ -118,7 +106,12 @@ endif
 
 set months = (Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)
 
-sccs clean
+# Remove all files for which there exist SCCS masters
+foreach f (*)
+    if (-f SCCS/s.$f) then
+       rm $f
+    endif
+end
 
 set logfile = /tmp/sccs2rcs_$$_log
 rm -f $logfile
@@ -129,7 +122,7 @@ echo "Initial revision" > $initialfile
 set sedfile = /tmp/sccs2rcs_$$_sed
 rm -f $sedfile
 
-# the quotes surround the dollar signs to fool RCS when I check in this script
+# the quotes surround the dollar signs are to fool RCS when I check in this script
 set sccs_keywords = (\
     '%W%[      ]*%G%'\
     '%W%[      ]*%E%'\
@@ -209,11 +202,11 @@ foreach sfile (SCCS/s.*)
 
     # work on each rev of that file in ascending order
     set firsttime = 1
-    foreach rev (`sccs prs $file | grep "^D " | awk '{print $2}' | tail -r`)
+    foreach rev (`prs SCCS/s.$file | grep "^D " | awk '{print $2}' | tail -r`)
         if ($status != 0) goto ERROR
 
         # get file into current dir and get stats
-        set date   = (`sccs prs -d":Dd: :Dm: :Dy: :T: :P:" -r$rev $file`)
+        set date   = (`prs -d":Dd: :Dm: :Dy: :T: :P:" -r$rev SCCS/s.$file`)
        set day    = $date[1]
        set month  = $date[2]
        set year   = ${century}${date[3]}
@@ -223,7 +216,7 @@ foreach sfile (SCCS/s.*)
 
         echo ""
         echo "==> file $file, rev=$rev, date=$date, author=$author"
-        sccs edit -r$rev $file >>& $logfile
+        get -e -r$rev SCCS/s.$file >>& $logfile
         if ($status != 0) goto ERROR
         echo checked out of SCCS
 
@@ -253,7 +246,7 @@ foreach sfile (SCCS/s.*)
             rcs -l $file >>& $logfile
             if ($status != 0) goto ERROR
             echo got lock
-            sccs prs -r$rev $file | grep "." > $tmpfile
+            prs -r$rev SCCS/s.$file | grep "." > $tmpfile
             # it's OK if grep fails here and gives status == 1
             # put the delta message in $tmpfile
             ed $tmpfile >>& $logfile <<EOF
@@ -266,7 +259,7 @@ EOF
             if ($status != 0) goto ERROR
             echo checked into RCS
         endif
-        sccs unedit $file >>& $logfile
+        unget SCCS/s.$file >>& $logfile
         if ($status != 0) goto ERROR
     end
     rm -f $file
@@ -288,8 +281,10 @@ echo ===================================================
 exit 0
 
 ERROR:
-foreach f (`sccs tell`)
-    sccs unedit $f
+foreach f (*)
+    if (-f SCCS/s.$f && -w $f) then
+       unget SCCS/s.$f
+    endif
 end
 echo ""
 echo ""