3 # Based on the CVS 1.0 checkin csh script.
4 # Contributed by Per Cederqvist <ceder@signum.se>.
5 # Rewritten in sh by David MacKenzie <djm@cygnus.com>.
7 # Copyright (c) 1989, Brian Berliner
9 # You may distribute under the terms of the GNU General Public License.
11 #############################################################################
13 # Check in sources that previously were under RCS or no source control system.
15 # The repository is the directory where the sources should be deposited.
17 # Traverses the current directory, ensuring that an
18 # identical directory structure exists in the repository directory. It
19 # then checks the files in in the following manner:
21 # 1) If the file doesn't yet exist, check it in as revision 1.1
23 # The script also is somewhat verbose in letting the user know what is
24 # going on. It prints a diagnostic when it creates a new file, or updates
25 # a file that has been modified on the trunk.
27 # Bugs: doesn't put the files in branch 1.1.1
28 # doesn't put in release and vendor tags
30 #############################################################################
32 usage
="Usage: rcs-to-cvs [-v] [-m message] [-f message_file] repository"
35 if [ -d /var
/tmp
]; then message_file
=/var
/tmp
/checkin.$$
; else message_file
=/usr
/tmp
/checkin.$$
; fi
43 while [ $# -ne 0 ]; do
50 echo $1 > $message_file
72 if [ -z "$CVSROOT" ]; then
73 echo "Please the environmental variable CVSROOT to the root" >&2
74 echo " of the tree you wish to update" >&2
78 if [ $got_one -eq 0 ]; then
79 echo "Please Edit this file to contain the RCS log information" >$message_file
80 echo "to be associated with this directory (please remove these lines)">>$message_file
81 ${EDITOR-vi} $message_file
88 update_dir
=${CVSROOT}/${repository}
89 [ ! -d ${update_dir} ] && mkdir
$update_dir
92 echo SCCS files detected
! >&2
99 for name
in * .
[a-zA-Z0-9
]*
102 RCS |
*~ | \
* | .\
[a-zA-Z0-9\
]\
* ) continue ;;
105 if [ $vbose -ne 0 ]; then
106 echo "Updating ${repository}/${name}"
108 if [ -d "$name" ]; then
109 if [ ! -d "${update_dir}/${name}" ]; then
110 echo "WARNING: Creating new directory ${repository}/${name}"
111 mkdir
"${update_dir}/${name}"
112 if [ $?
-ne 0 ]; then
113 echo "ERROR: mkdir failed - aborting" >&2
118 if [ $?
-ne 0 ]; then
119 echo "ERROR: Couldn\'t cd to $name - aborting" >&2
122 if [ $vbose -ne 0 ]; then
123 $0 -v -f $message_file "${repository}/${name}"
125 $0 -f $message_file "${repository}/${name}"
127 if [ $?
-ne 0 ]; then
131 else # if not directory
132 if [ ! -f "$name" ]; then
133 echo "WARNING: $name is neither a regular file"
134 echo " nor a directory - ignored"
137 file="${update_dir}/${name},v"
139 if grep -s '\$Log.*\$' "${name}"; then # If $Log keyword
140 myext
=`echo $name | sed 's,.*\.,,'`
141 [ "$myext" = "$name" ] && myext
=
143 c | csh | e | f | h | l | mac | me | mm | ms | p | r | red | s | sh | sl | cl | ml | el | tex | y | ye | yr |
"" )
147 echo "For file ${file}:"
148 grep '\$Log.*\$' "${name}"
149 echo -n "Please insert a comment leader for file ${name} > "
154 if [ ! -f "$file" ]; then # If not exists in repository
155 if [ ! -f "${update_dir}/Attic/${name},v" ]; then
156 echo "WARNING: Creating new file ${repository}/${name}"
157 if [ -f RCS
/"${name}",v
]; then
158 echo "MSG: Copying old rcs file."
159 cp RCS
/"${name}",v
"$file"
161 if [ -n "${comment}" ]; then
162 rcs
-q -i -c"${comment}" -t${message_file} -m'.' "$file"
164 ci
-q -u1.1
-t${message_file} -m'.' "$file"
165 if [ $?
-ne 0 ]; then
166 echo "ERROR: Initial check-in of $file failed - aborting" >&2
171 file="${update_dir}/Attic/${name},v"
172 echo "WARNING: IGNORED: ${repository}/Attic/${name}"
176 echo "ERROR: File exists in repository: Ignored: $file"
182 [ $got_one -eq 1 ] && rm -f $message_file