summaryrefslogtreecommitdiff
path: root/utils/cvsupdate
blob: f09cd2f433a31056ac8b805502dba0fb375d817d (plain)
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
#!/bin/csh -f
#
# This script updates the entire tree, saves the output in cvs.out,
# and then separately prints out the files that had merge conflicts,
# those that were merged successfully, and those that are new.
# Note that this script uses "cvs update -P -d".
#
# USAGE:
# 	cvsupdate	## normal run
# 	cvsupdate -n	## run grep commands on output of the last run of cvs
# 	cvsupdate -h	## usage information
#

set pstatus = 0
onintr cleanup
alias usage 'echo "USAGE: $0:t [-h][-n]"; set pstatus = 1; goto cleanup'

set doit = 1
set printnew = 0
unset options_done
while ( !( $?options_done ) && ($#argv > 0))
    switch ($argv[1])
	case -h :
	    usage
	case -n :
	    set doit = 0; shift argv; breaksw
	case -new :
	    set printnew = 1; shift argv; breaksw
	default :
	    set options_done; breaksw
    endsw
end

if ($doit == 1) then
    /bin/mv -f cvs.out cvs.out.bak >&/dev/null
    cvs update -P -d >& cvs.out
##    if ($status != 0) then
##        echo "ERROR: CVS update failed: "
##	cat cvs.out
##	exit 1
    endif
else
    echo ""; echo "NOT UPDATING FILES.  RESULTS FROM LAST RUN:"; echo ""
endif

echo ""; echo "	FILES UPDATED:"
grep '^U' cvs.out

echo ""; echo "	UPDATE CONFLICTS OCCURRED FOR THE FOLLOWING FILES:"
grep '^C' cvs.out

echo ""; echo " FILES REMOVED FROM YOUR DIRECTORY:"
grep 'no longer in the repository' cvs.out

echo ""; echo "	FILES SUCCESSFULLY MERGED (or locally modified):"
grep '^M' cvs.out | grep -v Merging

echo ""; echo "	NEW FILES AND DIRECTORIES:"
if ($printnew != 0) then
    grep '^\?' cvs.out | & grep -v '\.bc' | grep -v Updating | grep -v cvsup | grep -v 'cvs.out' | grep -v gnumake.out | grep -v '\.mc$' | grep -v '\.s$' | grep -v '\.native'
else
    echo '(USE "cvsupdate -n -new" TO SEE NEW FILES AND DIRECTORIES.)'
endif

echo ""


#=========================================================
# CODE TO BE EXECUTED IF INTERRUPT IS RECEIVED
#=========================================================
cleanup:
    exit($pstatus)