3 # Copyright (c) 1989-2005 The Free Software Foundation, Inc.
4 # Portions Copyright (c) 1989, Brian Berliner
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # Based on the CVS 1.0 checkin csh script.
17 # Contributed by Per Cederqvist <ceder@signum.se>.
18 # Rewritten in sh by David MacKenzie <djm@cygnus.com>.
20 #############################################################################
22 # Check in sources that previously were under RCS or no source control system.
24 # The repository is the directory where the sources should be deposited.
26 # Traverses the current directory, ensuring that an
27 # identical directory structure exists in the repository directory. It
28 # then checks the files in in the following manner:
30 # 1) If the file doesn't yet exist, check it in as revision 1.1
32 # The script also is somewhat verbose in letting the user know what is
33 # going on. It prints a diagnostic when it creates a new file, or updates
34 # a file that has been modified on the trunk.
36 # Bugs: doesn't put the files in branch 1.1.1
37 # doesn't put in release and vendor tags
39 #############################################################################
41 usage
="Usage: rcs-to-cvs [-v] [-m message] [-f message_file] repository"
44 if [ -d /var
/tmp
]; then message_file
=/var
/tmp
/checkin.$$
; else message_file
=/usr
/tmp
/checkin.$$
; fi
52 while [ $# -ne 0 ]; do
59 echo $1 > $message_file
81 if [ -z "$CVSROOT" ]; then
82 echo "Please the environmental variable CVSROOT to the root" >&2
83 echo " of the tree you wish to update" >&2
87 if [ $got_one -eq 0 ]; then
88 echo "Please Edit this file to contain the RCS log information" >$message_file
89 echo "to be associated with this directory (please remove these lines)">>$message_file
90 ${EDITOR-vi} $message_file
97 update_dir
=${CVSROOT}/${repository}
98 [ ! -d ${update_dir} ] && mkdir
$update_dir
101 echo SCCS files detected
! >&2
108 for name
in * .
[a-zA-Z0-9
]*
111 RCS |
*~ | \
* | .\
[a-zA-Z0-9\
]\
* ) continue ;;
114 if [ $vbose -ne 0 ]; then
115 echo "Updating ${repository}/${name}"
117 if [ -d "$name" ]; then
118 if [ ! -d "${update_dir}/${name}" ]; then
119 echo "WARNING: Creating new directory ${repository}/${name}"
120 mkdir
"${update_dir}/${name}"
121 if [ $?
-ne 0 ]; then
122 echo "ERROR: mkdir failed - aborting" >&2
127 if [ $?
-ne 0 ]; then
128 echo "ERROR: Couldn\'t cd to $name - aborting" >&2
131 if [ $vbose -ne 0 ]; then
132 $0 -v -f $message_file "${repository}/${name}"
134 $0 -f $message_file "${repository}/${name}"
136 if [ $?
-ne 0 ]; then
140 else # if not directory
141 if [ ! -f "$name" ]; then
142 echo "WARNING: $name is neither a regular file"
143 echo " nor a directory - ignored"
146 file="${update_dir}/${name},v"
148 if grep -s '\$Log.*\$' "${name}"; then # If $Log keyword
149 myext
=`echo $name | sed 's,.*\.,,'`
150 [ "$myext" = "$name" ] && myext
=
152 c | csh | e | f | h | l | mac | me | mm | ms | p | r | red | s | sh | sl | cl | ml | el | tex | y | ye | yr |
"" )
156 echo "For file ${file}:"
157 grep '\$Log.*\$' "${name}"
158 echo -n "Please insert a comment leader for file ${name} > "
163 if [ ! -f "$file" ]; then # If not exists in repository
164 if [ ! -f "${update_dir}/Attic/${name},v" ]; then
165 echo "WARNING: Creating new file ${repository}/${name}"
166 if [ -f RCS
/"${name}",v
]; then
167 echo "MSG: Copying old rcs file."
168 cp RCS
/"${name}",v
"$file"
170 if [ -n "${comment}" ]; then
171 rcs
-q -i -c"${comment}" -t${message_file} -m'.' "$file"
173 ci
-q -u1.1
-t${message_file} -m'.' "$file"
174 if [ $?
-ne 0 ]; then
175 echo "ERROR: Initial check-in of $file failed - aborting" >&2
180 file="${update_dir}/Attic/${name},v"
181 echo "WARNING: IGNORED: ${repository}/Attic/${name}"
185 echo "ERROR: File exists in repository: Ignored: $file"
191 [ $got_one -eq 1 ] && rm -f $message_file