1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228
|
#!/bin/csh -f
#>
#> PACT-SYNC - synchronize the local PACT sources with those in the repository
#>
#> Usage: pact-sync [-h] [-n] [-s] [-v]
#>
#> Options: h - Display the help package
#> n - Do not change any files. Issue report only, do not
#> update, or merge any esisting files.
#> s - Sleep if Lock on
#> v - Display the Version and Release of the Source Control System
#>
#
# Modification History:
# 03-21-94 Jan Moura, LLNL: Added Usage info and options [-h], [-n], [-v]
# Removed option [-m] not used.
# 12-08-94 Jan Moura, LLNL: Resolve display of files with conflicts
# 7-27-94 Jan Moura, LLNL: Chg name of logfile, cosmetic.
####################
# include "cpyright.h"
#
unalias cd
# see PCD for the reason for this
set Here = `pwd` ; cd ; set RealHome = `pwd` ; cd $Here ; unset $Here
cd ..
if ($?USER == 0) then
if ($?LOGNAME == 0) then
set USER = "anonymous"
else
set USER = $LOGNAME
endif
endif
set WhoIAm = $USER
set Manager = manager
set Report = ""
set CvsOpt = ""
set UserDir = `pwd | sed "s|$RealHome|$home|"`/$Manager
set ConflFile = $UserDir/Confl.Sources
set HelpCode = $UserDir/$0
set SyncLogPerm = $UserDir/pact-sync.log
set SyncLogTmp = $UserDir/sync.log
set Merges = $UserDir/merge.el
set SCSRepository = ""
set SRCDate = ""
set Sleep = "NO"
# define the Source Control System (called twice)
source ./manager/pact-scs
set Opt = "$HelpCode:t $argv"
groups | grep dpact > /dev/null
if ($status == 1) then
echo ""
echo "You must be in the group of PACT developers to run PACT-SYNC"
echo ""
exit(1)
endif
#---Check the command argument list
if ($#argv > 1) then
goto Help
endif
if ($#argv == 1) then
switch ($argv[1])
case -h*: #print Usage:
goto Help
case -n: #NO update, report only
set Report = " Report ONLY..."
set CvsOpt = "-nq"
breaksw
case -s*:
set Sleep = "YES"
breaksw
case -v*: #Display version...
echo " Source Version: " $SCSVersion
echo " Software Release: " $SCSRelease
echo ""
exit(1)
default: #print Usage:
goto Help
endsw
endif
#
# check if repository locked
#
if ($Sleep == "YES") then
manager/check.lock
else
if (-e $SCSLock) then
echo ""
echo " *** REPOSITORY IS LOCKED ***"
echo ""
cat $SCSLock
echo ""
echo ""
exit(1)
endif
endif
rm -f $SyncLogTmp
rm -f $SyncLogPerm $ConflFile
# define the Source Control System (repeat to define -n cvs option)
source ./manager/pact-scs
echo ""
echo "Synchronizing Sources" $Report
echo `date`
echo "(see $SyncLogPerm for more information)"
echo ""
echo "" >>& $SyncLogPerm
echo "Synchronizing Sources" $Report >>& $SyncLogPerm
echo " Host: `uname -n` running `uname`" >>&! $SyncLogPerm
echo " User: $WhoIAm Date: `date`" >>& $SyncLogPerm
echo " " >>& $SyncLogPerm
echo "Operation: $Opt " >>& $SyncLogPerm
echo " " >>& $SyncLogPerm
# build a list of directories which $SCSName is source managing
set List = `find . -name $ADM -print`
set DirList = ""
foreach i ($List)
set DirList = (`echo "$i:h"` $DirList)
end
# sync the sources in each of the $SCSName managed directories
foreach i ($DirList)
cd $i
echo $i
echo Checking $i >& $SyncLogTmp
$Update -l >>& $SyncLogTmp
if ($status != 0) then
echo "$SCSName UPDATE failed - terminating PACT-SYNC"
echo "$SCSName UPDATE failed - terminating PACT-SYNC" >>& $SyncLogTmp
exit(1)
endif
# if "-n" option specified, then we are done (omit remainder of loop)
if ($CvsOpt == "-nq") then
cat $SyncLogTmp
echo "" >>& $SyncLogPerm
cat $SyncLogTmp >>& $SyncLogPerm
rm $SyncLogTmp
cd $UserDir:h
continue
endif
# take care of conflicting changes
awk '($1 == "C")&&($2 !~ /Makefile/) {print $2}' $SyncLogTmp > Confl
set Confl = `cat Confl`
foreach mod ($Confl)
echo " $mod had conflicting changes<<<<<<<<<<<<<<<<<<<<"
end
cat Confl >>& $ConflFile
rm Confl
cd $UserDir:h
# report changed files
awk '($1 ~ /[PUMAR]/) {print $1 " " $2}' $SyncLogTmp > Files.OK
set Files = `cat Files.OK`
while ($#Files > 1)
echo " $Files[1] $Files[2]"
shift Files
shift Files
end
rm Files.OK
cat $SyncLogTmp >>& $SyncLogPerm
rm $SyncLogTmp
end
# if there are no conflicts remove the misleading evidence
if (-z $ConflFile) then
rm $ConflFile
endif
# have EDITOR display list of files in conflict
if (-e $ConflFile) then
echo "========================================"
echo " The following files are in conflict"
echo ""
echo `cat $ConflFile`
echo ""
echo "========================================" >>& $SyncLogPerm
echo " The following files are in conflict" >>& $SyncLogPerm
echo "" >>& $SyncLogPerm
echo `cat $ConflFile` >>& $SyncLogPerm
echo "" >>& $SyncLogPerm
$EDITOR $ConflFile
if ($status != 0) then
echo "$EDITOR failed - terminating PACT-SYNC"
exit(1)
endif
endif
echo "Sources Synchronized" $Report
echo "(see $SyncLogPerm for log information)"
echo ""
echo "" >>& $SyncLogPerm
echo "Sources Synchronized" $Report >>& $SyncLogPerm
echo "" >>& $SyncLogPerm
cd $Manager
exit($status)
Help:
awk '($1 == "#>") {print}' $HelpCode #print Usage:
exit(1)
|