# 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.
#
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
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
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%'\
# 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]}
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
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
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
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 ""