This commit is contained in:
gferg 2000-07-24 15:32:59 +00:00
parent aa451d9d84
commit a16d7be1f5
2 changed files with 2189 additions and 1938 deletions

File diff suppressed because it is too large Load Diff

View File

@ -44,7 +44,7 @@ Revision Control System
<author>Al Dev (Alavoor Vasudevan)
<htmlurl url="mailto:alavoor@yahoo.com"
name="alavoor@yahoo.com">
<date>v13.0, 19 July 2000
<date>v14.0, 22 July 2000
<abstract>
This document is a "practical guide" to very quickly setup CVS/RCS source code
control system. This document also has custom shell scripts which are wrappers on top of CVS. These scripts provide a easy user interface for CVS. The information in this document applies to Linux and as well as to all other flavors of Unix liks Solaris, HPUX, AIX, SCO, Sinix, BSD, SCO, etc..
@ -607,10 +607,6 @@ Copy these scripts to /usr/local/bin and this should be in the user's PATH envir
<item> <bf>sfreeze</bf> &lt;revision name&gt; &lt;directory name&gt;
To freeze the code, that is make release of entire source tree.
Click <ref id="sfreeze">
<item> <bf>saddtree</bf> &lt;revision name&gt; &lt;directory name&gt;
To add a directory tree to CVS.
Click <ref id="saddtree">
<p>
For example :
<code>
@ -1310,6 +1306,29 @@ if [ ! -e "$CVSROOT/$subdir/$fname,v" ]; then
exit
fi
# CVS directory in your local directory is required for all commands..
if [ ! -d "$homedir/$subdir/CVS" ]; then
tmpaa=` (cd "$CVSROOT/$subdir"; find * -prune -type f -print | head -1 ) `
tmpbb=`basename $tmpaa | cut -d',' -f1 `
if [ "$tmpaa" = "" -o ! -f "$CVSROOT/$subdir/$tmpbb,v" ]; then
print "\nThe directory $homedir/$subdir/CVS does not exist"
print "You must do a sget on `basename $subdir` directory. Give -"
print " cd $homedir/`dirname $subdir` "
print " sget `basename $subdir` "
exit
else
# Now try to create CVS in local dir by sget
(
cd "$homedir"
if [ "$subdir" = "." ]; then # don't use dot, will mess up cvs
cvs -r checkout -A $tmpbb
else
cvs -r checkout -A "$subdir/$tmpbb"
fi
)
fi
fi
# Get the tip revision number of the file....
# Use tmpfile as the arg cannot be set inside the sub-shell
tmpfile=$homedir/sedit-lock.tmp
@ -1522,6 +1541,29 @@ if [ "$cvs_root" = "" ]; then
fi
mkdir -p "$CVSROOT/$subdir/Locks" 2>/dev/null
# CVS directory in your local directory is required for all commands..
if [ ! -d "$homedir/$subdir/CVS" ]; then
tmpaa=` (cd "$CVSROOT/$subdir"; find * -prune -type f -print | head -1 ) `
tmpbb=`basename $tmpaa | cut -d',' -f1 `
if [ "$tmpaa" = "" -o ! -f "$CVSROOT/$subdir/$tmpbb,v" ]; then
print "\nThe directory $homedir/$subdir/CVS does not exist"
print "You must do a sget on `basename $subdir` directory. Give -"
print " cd $homedir/`dirname $subdir` "
print " sget `basename $subdir` "
exit
else
# Now try to create CVS in local dir by sget
(
cd "$homedir"
if [ "$subdir" = "." ]; then # don't use dot, will mess up cvs
cvs -r checkout -A $tmpbb
else
cvs -r checkout -A "$subdir/$tmpbb"
fi
)
fi
fi
# Get the working revision number of the file....
# Use tmpfile as the arg cannot be set inside the sub-shell
tmpfile=$homedir/sedit-lock.tmp
@ -1543,6 +1585,7 @@ if [ "$OARG1" = "" ]; then
print "The file $subdir/$fname is NEW, it is not in the CVS repository"
else
lockfile="$CVSROOT/$subdir/Locks/$fname-$OARG1"
if [ -e $lockfile ]; then
# Check if this revision is owned by you...
aa=` ls -l $lockfile | awk '{print $3}' `
@ -1802,6 +1845,29 @@ if [ ! -e "$CVSROOT/$subdir/$fname,v" ]; then
exit
fi
# CVS directory in your local directory is required for all commands..
if [ ! -d "$homedir/$subdir/CVS" ]; then
tmpaa=` (cd "$CVSROOT/$subdir"; find * -prune -type f -print | head -1 ) `
tmpbb=`basename $tmpaa | cut -d',' -f1 `
if [ "$tmpaa" = "" -o ! -f "$CVSROOT/$subdir/$tmpbb,v" ]; then
print "\nThe directory $homedir/$subdir/CVS does not exist"
print "You must do a sget on `basename $subdir` directory. Give -"
print " cd $homedir/`dirname $subdir` "
print " sget `basename $subdir` "
exit
else
# Now try to create CVS in local dir by sget
(
cd "$homedir"
if [ "$subdir" = "." ]; then # don't use dot, will mess up cvs
cvs -r checkout -A $tmpbb
else
cvs -r checkout -A "$subdir/$tmpbb"
fi
)
fi
fi
# Get the tip revision number of the file....
# Use tmpfile as the arg cannot be set inside the sub-shell
tmpfile=$homedir/sunlock-lock.tmp
@ -2077,6 +2143,29 @@ fi
#echo "subdir is : " $subdir
#echo "fname is : " $fname
# CVS directory in your local directory is required for all commands..
if [ ! -d "$homedir/$subdir/CVS" ]; then
tmpaa=` (cd "$CVSROOT/$subdir"; find * -prune -type f -print | head -1 ) `
tmpbb=`basename $tmpaa | cut -d',' -f1 `
if [ "$tmpaa" = "" -o ! -f "$CVSROOT/$subdir/$tmpbb,v" ]; then
print "\nThe directory $homedir/$subdir/CVS does not exist"
print "You must do a sget on `basename $subdir` directory. Give -"
print " cd $homedir/`dirname $subdir` "
print " sget `basename $subdir` "
exit
else
# Now try to create CVS in local dir by sget
(
cd "$homedir"
if [ "$subdir" = "." ]; then # don't use dot, will mess up cvs
cvs -r checkout -A $tmpbb
else
cvs -r checkout -A "$subdir/$tmpbb"
fi
)
fi
fi
# Create subshell
if [ -f $1 ]; then
(
@ -2197,6 +2286,29 @@ fi
#echo "subdir is : " $subdir
#echo "fname is : " $fname
# CVS directory in your local directory is required for all commands..
if [ ! -d "$homedir/$subdir/CVS" ]; then
tmpaa=` (cd "$CVSROOT/$subdir"; find * -prune -type f -print | head -1 ) `
tmpbb=`basename $tmpaa | cut -d',' -f1 `
if [ "$tmpaa" = "" -o ! -f "$CVSROOT/$subdir/$tmpbb,v" ]; then
print "\nThe directory $homedir/$subdir/CVS does not exist"
print "You must do a sget on `basename $subdir` directory. Give -"
print " cd $homedir/`dirname $subdir` "
print " sget `basename $subdir` "
exit
else
# Now try to create CVS in local dir by sget
(
cd "$homedir"
if [ "$subdir" = "." ]; then # don't use dot, will mess up cvs
cvs -r checkout -A $tmpbb
else
cvs -r checkout -A "$subdir/$tmpbb"
fi
)
fi
fi
# Operate inside a sub-shell
(
cd $homedir
@ -2308,6 +2420,29 @@ fi
#echo "subdir is : " $subdir
#echo "fname is : " $fname
# CVS directory in your local directory is required for all commands..
if [ ! -d "$homedir/$subdir/CVS" ]; then
tmpaa=` (cd "$CVSROOT/$subdir"; find * -prune -type f -print | head -1 ) `
tmpbb=`basename $tmpaa | cut -d',' -f1 `
if [ "$tmpaa" = "" -o ! -f "$CVSROOT/$subdir/$tmpbb,v" ]; then
print "\nThe directory $homedir/$subdir/CVS does not exist"
print "You must do a sget on `basename $subdir` directory. Give -"
print " cd $homedir/`dirname $subdir` "
print " sget `basename $subdir` "
exit
else
# Now try to create CVS in local dir by sget
(
cd "$homedir"
if [ "$subdir" = "." ]; then # don't use dot, will mess up cvs
cvs -r checkout -A $tmpbb
else
cvs -r checkout -A "$subdir/$tmpbb"
fi
)
fi
fi
# Operate inside sub-shell
(
cd $homedir
@ -2364,12 +2499,6 @@ if [ ! -f "$onearg" -a ! -d "$onearg" ]; then
exit
fi
# Check if file exists ....
if [ -f "$onearg" ]; then
cvs add "$onearg"
exit
fi
# Argument is a directory name .....
homedir=` echo $HOME | cut -f1 -d' ' `
if [ "$homedir" = "" ]; then
@ -2377,6 +2506,12 @@ if [ "$homedir" = "" ]; then
exit
fi
cvs_root=` echo $CVSROOT | cut -f1 -d' ' `
if [ "$cvs_root" = "" ]; then
print "\nError: \$CVSROOT is not set!!\n"
exit
fi
cur_dir=`pwd`
len=${#homedir}
len=$(($len + 2))
@ -2399,6 +2534,49 @@ fi
#echo "subdir is : " $subdir
#echo "fname is : " $fname
# CVS directory in your local directory is required for all commands..
if [ ! -d "$homedir/$subdir/CVS" ]; then
tmpaa=` (cd "$CVSROOT/$subdir"; find * -prune -type f -print | head -1 ) `
tmpbb=`basename $tmpaa | cut -d',' -f1 `
if [ "$tmpaa" = "" -o ! -f "$CVSROOT/$subdir/$tmpbb,v" ]; then
print "\nThe directory $homedir/$subdir/CVS does not exist"
print "You must do a sget on `basename $subdir` directory. Give -"
print " cd $homedir/`dirname $subdir` "
print " sget `basename $subdir` "
exit
else
# Now try to create CVS in local dir by sget
(
cd "$homedir"
if [ "$subdir" = "." ]; then # don't use dot, will mess up cvs
cvs -r checkout -A $tmpbb
else
cvs -r checkout -A "$subdir/$tmpbb"
fi
)
fi
fi
# Check if file exists ....
if [ $# -eq 1 ]; then
if [ -f "$onearg" ]; then
cvs add "$onearg"
exit
fi
elif [ $# -gt 1 ]; then
print "\n\n\nAdding all the files in the current directory to CVS"
print "Directories will not be added"
print -n "Hit return to continue or CTRL+C to abort..."
read ans
for ii in $@
do
if [ -f "$ii" ]; then
cvs add "$ii"
fi
done;
exit
fi
# When $subdir is "." then you are at the root directory
if [ "$subdir" = "." ]; then
# The $onearg is a directory and not a file at this point...
@ -2421,28 +2599,22 @@ if [ "$subdir" = "." ]; then
fi
else
# If current directory exists in CVS...
if [ -d $CVSROOT/$subdir ]; then
if [ -d "$CVSROOT/$subdir/$onearg" ]; then
print "\nDirectory $onearg already in CVS repository!"
exit
else
(
if [ -d "$homedir/$subdir/$onearg/CVS" ]; then
print "\nError: Directory $homedir/$subdir/$onearg/CVS exists!!"
print "\nAborting now ...."
exit
fi
# For import you MUST change to target directory
# and you MUST specify full-path starting with $subdir
cd "$homedir/$subdir/$onearg";
cvs import "$subdir/$onearg" Ver_1 Rel_1
)
fi
else
print "\nSub-directory $subdir does not exist in CVS"
print "You need to first add $subdir to CVS"
if [ -d "$CVSROOT/$subdir/$onearg" ]; then
print "\nDirectory $onearg already in CVS repository!"
exit
else
(
if [ -d "$homedir/$subdir/$onearg/CVS" ]; then
print "\nError: Directory $homedir/$subdir/$onearg/CVS exists!!"
print "\nAborting now ...."
exit
fi
# For import you MUST change to target directory
# and you MUST specify full-path starting with $subdir
cd "$homedir/$subdir/$onearg";
cvs import "$subdir/$onearg" Ver_1 Rel_1
)
fi
fi
</code>
@ -2516,6 +2688,29 @@ fi
#echo "subdir is : " $subdir
#echo "fname is : " $fname
# CVS directory in your local directory is required for all commands..
if [ ! -d "$homedir/$subdir/CVS" ]; then
tmpaa=` (cd "$CVSROOT/$subdir"; find * -prune -type f -print | head -1 ) `
tmpbb=`basename $tmpaa | cut -d',' -f1 `
if [ "$tmpaa" = "" -o ! -f "$CVSROOT/$subdir/$tmpbb,v" ]; then
print "\nThe directory $homedir/$subdir/CVS does not exist"
print "You must do a sget on `basename $subdir` directory. Give -"
print " cd $homedir/`dirname $subdir` "
print " sget `basename $subdir` "
exit
else
# Now try to create CVS in local dir by sget
(
cd "$homedir"
if [ "$subdir" = "." ]; then # don't use dot, will mess up cvs
cvs -r checkout -A $tmpbb
else
cvs -r checkout -A "$subdir/$tmpbb"
fi
)
fi
fi
# Operate inside a sub-shell ...
(
cd $homedir
@ -2632,6 +2827,29 @@ len=$(($len + 2))
subdir=` echo $cur_dir | cut -b $len-2000 `
#echo "subdir is : " $subdir
# CVS directory in your local directory is required for all commands..
if [ ! -d "$homedir/$subdir/CVS" ]; then
tmpaa=` (cd "$CVSROOT/$subdir"; find * -prune -type f -print | head -1 ) `
tmpbb=`basename $tmpaa | cut -d',' -f1 `
if [ "$tmpaa" = "" -o ! -f "$CVSROOT/$subdir/$tmpbb,v" ]; then
print "\nThe directory $homedir/$subdir/CVS does not exist"
print "You must do a sget on `basename $subdir` directory. Give -"
print " cd $homedir/`dirname $subdir` "
print " sget `basename $subdir` "
exit
else
# Now try to create CVS in local dir by sget
(
cd "$homedir"
if [ "$subdir" = "." ]; then # don't use dot, will mess up cvs
cvs -r checkout -A $tmpbb
else
cvs -r checkout -A "$subdir/$tmpbb"
fi
)
fi
fi
if [ "$cur_dir" != "$homedir" ]; then
print "\nYou are not in home directory $homedir!!"
print "You must give the sfreeze command "
@ -2653,72 +2871,4 @@ print "\nDone $cmdname. $cmdname successful"
-->
<sect> saddtree <label id="saddtree">
<p>
<bf>NOTE : <it>Korn shell /bin/ksh is got by installing pdksh*.rpm from Linux contrib cdrom</it></bf>
Save this file as text file and chmod a+rx on it.
<code>
#!/bin/ksh
This script is deprecated -- use sadd instead...
################################################################
# Sample Program to checkin a directory tree (let's say SAMP) into CVS
# Note that if SAMP directory is not in CVS than you would use sadd
# command and -
# cd SAMP; cvs import SAMP V_1_0 R_1_0
# After running this program do -
# cd $HOME/foo/SAMP
# cvs import foo/SAMP V1_0 Rev_1_0
################################################################
homedir=` echo $HOME | cut -f1 -d' ' `
if [ "$homedir" = "" ]; then
print "\nError: \$HOME is not set!!\n"
exit
fi
sampdir=$homedir/foo/SAMP
check_out_files()
{
# Now check out the files
tmp2f=$homedir/tmp2.baksamp.sh
cd $homedir
\rm -rf foo/SAMP
cvs -w checkout foo/SAMP
cd $homedir/foo
find SAMP -type f -print > $tmp2f
cd $homedir
for ii in `cat $tmp2f`
do
iidir=`dirname $ii`
iifile=`basename $ii`
if [ "$iifile" = "Root" -o "$iifile" = "Repository" -o "$iifile" = "Entries" ]; then
continue
fi
jjdir=` echo $iidir | cut -d'/' -f2-1000 `
cp $homedir/foo/SAMP.tobe/$jjdir/$iifile $homedir/foo/$iidir/$iifile
echo "cp $homedir/foo/SAMP.tobe/$jjdir/$iifile $homedir/foo/$iidir/$iifile "
cvs add foo/$iidir/$iifile
done
print
print "================================================"
print " Now run cvs commit foo/SAMP"
print " After commit. Do - "
print " cd foo; rm -rf SAMP and "
print " get fresh copy, sget SAMP"
print " Verify with slog filename.samp to see new revision"
print "================================================"
print
}
check_out_files
</code>
</article>