3 # Copyright (C) 1995-2005 The Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
16 ############################################################
19 if [ ! -d SCCS
] ; then
23 logfile
=/tmp
/rcs2sccs_$
$_log
25 tmpfile
=/tmp
/rcs2sccs_$
$_tmp
27 emptyfile
=/tmp
/rcs2sccs_$
$_empty
28 echo -n "" > $emptyfile
29 initialfile
=/tmp
/rcs2sccs_$
$_init
30 echo "Initial revision" > $initialfile
31 sedfile
=/tmp
/rcs2sccs_$
$_sed
33 revfile
=/tmp
/rcs2sccs_$
$_rev
35 commentfile
=/tmp
/rcs2sccs_$
$_comment
38 # create the sed script
40 s,;Id;,%Z%%M% %I% %E%,g
41 s,;SunId;,%Z%%M% %I% %E%,g
45 s,;Id:.*;,%Z%%M% %I% %E%,g
46 s,;SunId:.*;,%Z%%M% %I% %E%,g
51 sed -e 's/;/\\$/g' $sedfile > $tmpfile
53 ############################################################
54 # Loop over every RCS file in RCS dir
56 if sort -k 1,1 /dev
/null
2>/dev
/null
57 then sort_each_field
='-k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9'
58 else sort_each_field
='+0 +1 +2 +3 +4 +5 +6 +7 +8'
61 # get rid of the ",v" at the end of the name
62 file=`echo $vfile | sed -e 's/,v$//'`
64 # work on each rev of that file in ascending order
66 rlog
$file |
grep "^revision [0-9][0-9]*\." |
awk '{print $2}' |
sed -e 's/\./ /g' |
sort -n -u $sort_each_field |
sed -e 's/ /./g' > $revfile
67 for rev in `cat $revfile`; do
72 # get file into current dir and get stats
73 date=`rlog -r$rev $file | grep "^date: " | awk '{print $2; exit}' | sed -e 's/^19\|^20//'`
74 time=`rlog -r$rev $file | grep "^date: " | awk '{print $3; exit}' | sed -e 's/;//'`
75 author
=`rlog -r$rev $file | grep "^date: " | awk '{print $5; exit}' | sed -e 's/;//'`
78 rlog
-r$rev $file |
sed -e '/^branches: /d' -e '1,/^date: /d' -e '/^===========/d' -e 's/$/\\/' |
awk '{if ((total += length($0) + 1) < 510) print $0}' > $commentfile
79 echo "==> file $file, rev=$rev, date=$date, author=$author"
81 co
-r$rev $file >> $logfile 2>&1
86 echo checked out of RCS
88 # add SCCS keywords in place of RCS keywords
89 sed -f $sedfile $file > $tmpfile
94 echo performed keyword substitutions
98 # check file into SCCS
99 if [ "$firsttime" = "1" ]; then
101 echo about to
do sccs admin
102 echo sccs admin
-n -i$file $file < $commentfile
103 sccs admin
-n -i$file $file < $commentfile >> $logfile 2>&1
105 echo ERROR
- sccs admin
108 echo initial
rev checked into SCCS
112 brev
=`echo $rev | sed -e 's/\.[0-9]*$//'`
113 sccs admin
-fb $file 2>>$logfile
114 echo sccs get
-e -p -r$brev $file
115 sccs get
-e -p -r$brev $file >/dev
/null
2>>$logfile
118 echo sccs get
-e -p $file
119 sccs get
-e -p $file >/dev
/null
2>> $logfile
123 echo ERROR
- sccs get
126 sccs delta
$file < $commentfile >> $logfile 2>&1
128 echo ERROR
- sccs delta
-r$rev $file
131 echo checked into SCCS
133 sed -e "s;^\x01d D $rev ../../.. ..:..:.. [^ ][^ ]*;\x01d D $rev $date $author;" SCCS
/s.
$file > $tmpfile
135 cp $tmpfile SCCS
/s.
$file
136 chmod 444 SCCS
/s.
$file
139 echo ERROR
- sccs admin
-z
147 ############################################################
151 rm -f $tmpfile $emptyfile $initialfile $sedfile $commentfile
152 echo ===================================================
153 echo " Conversion Completed Successfully"
154 echo ===================================================