Check error condition after cvs returns. Also remove -c option.
[oota-llvm.git] / utils / cvsupdate
1 #!/bin/csh -f
2 #
3 # This script updates the entire tree, saves the output in cvs.out,
4 # and then separately prints out the files that had merge conflicts,
5 # those that were merged successfully, and those that are new.
6 # Note that this script uses "cvs update -P -d".
7 #
8 # USAGE:
9 #       cvsupdate       ## normal run
10 #       cvsupdate -n    ## run grep commands on output of the last run of cvs
11 #       cvsupdate -h    ## usage information
12 #
13
14 set pstatus = 0
15 onintr cleanup
16 alias usage 'echo "USAGE: $0:t [-h][-n]"; set pstatus = 1; goto cleanup'
17
18 set doit = 1
19 unset options_done
20 while ( !( $?options_done ) && ($#argv > 0))
21     switch ($argv[1])
22         case -h :
23             usage
24         case -n :
25             set doit = 0; shift argv; breaksw
26         default :
27             set options_done; breaksw
28     endsw
29 end
30
31 if ($doit == 1) then
32     /bin/mv -f cvs.out cvs.out.bak
33     cvs update -P -d >& cvs.out
34     if ($status != 0) then
35         echo "ERROR: CVS update failed: "
36         cat cvs.out
37         exit 1
38     endif
39 else
40     echo ""; echo "Not updating files."; echo ""
41 endif
42
43 echo ""; echo " FILES UPDATED:"
44 grep '^U' cvs.out
45
46 echo ""; echo " UPDATE CONFLICTS OCCURRED FOR THE FOLLOWING FILES:"
47 grep '^C' cvs.out
48
49 echo ""; echo " FILES SUCCESSFULLY MERGED (or locally modified):"
50 grep '^M' cvs.out | grep -v Merging
51
52 echo ""; echo " NEW FILES AND DIRECTORIES:"
53 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'
54
55 echo ""
56
57
58 #=========================================================
59 # CODE TO BE EXECUTED IF INTERRUPT IS RECEIVED
60 #=========================================================
61 cleanup:
62     exit($pstatus)