Vikram S. Adve | 5e1a0d9 | 2002-09-15 16:45:10 +0000 | [diff] [blame] | 1 | #!/bin/csh -f |
Vikram S. Adve | 355df3f | 2002-02-11 20:59:26 +0000 | [diff] [blame] | 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 |
Vikram S. Adve | 38bb2ff8 | 2002-10-31 15:32:24 +0000 | [diff] [blame] | 19 | set printnew = 0 |
Vikram S. Adve | 355df3f | 2002-02-11 20:59:26 +0000 | [diff] [blame] | 20 | unset options_done |
| 21 | while ( !( $?options_done ) && ($#argv > 0)) |
| 22 | switch ($argv[1]) |
| 23 | case -h : |
| 24 | usage |
| 25 | case -n : |
| 26 | set doit = 0; shift argv; breaksw |
Vikram S. Adve | 38bb2ff8 | 2002-10-31 15:32:24 +0000 | [diff] [blame] | 27 | case -new : |
| 28 | set printnew = 1; shift argv; breaksw |
Vikram S. Adve | 355df3f | 2002-02-11 20:59:26 +0000 | [diff] [blame] | 29 | default : |
| 30 | set options_done; breaksw |
| 31 | endsw |
| 32 | end |
| 33 | |
| 34 | if ($doit == 1) then |
Misha Brukman | 3578d7e | 2003-05-25 16:38:24 +0000 | [diff] [blame] | 35 | /bin/mv -f cvs.out cvs.out.bak >&/dev/null |
Vikram S. Adve | 355df3f | 2002-02-11 20:59:26 +0000 | [diff] [blame] | 36 | cvs update -P -d >& cvs.out |
Vikram S. Adve | 38bb2ff8 | 2002-10-31 15:32:24 +0000 | [diff] [blame] | 37 | ## if ($status != 0) then |
| 38 | ## echo "ERROR: CVS update failed: " |
| 39 | ## cat cvs.out |
| 40 | ## exit 1 |
Vikram S. Adve | 5e1a0d9 | 2002-09-15 16:45:10 +0000 | [diff] [blame] | 41 | endif |
Vikram S. Adve | 355df3f | 2002-02-11 20:59:26 +0000 | [diff] [blame] | 42 | else |
Vikram S. Adve | 38bb2ff8 | 2002-10-31 15:32:24 +0000 | [diff] [blame] | 43 | echo ""; echo "NOT UPDATING FILES. RESULTS FROM LAST RUN:"; echo "" |
Vikram S. Adve | 355df3f | 2002-02-11 20:59:26 +0000 | [diff] [blame] | 44 | endif |
| 45 | |
Chris Lattner | 868cb7d | 2002-04-29 19:11:01 +0000 | [diff] [blame] | 46 | echo ""; echo " FILES UPDATED:" |
| 47 | grep '^U' cvs.out |
| 48 | |
| 49 | echo ""; echo " UPDATE CONFLICTS OCCURRED FOR THE FOLLOWING FILES:" |
Vikram S. Adve | 355df3f | 2002-02-11 20:59:26 +0000 | [diff] [blame] | 50 | grep '^C' cvs.out |
| 51 | |
Chris Lattner | fecaf56 | 2002-09-16 18:09:42 +0000 | [diff] [blame] | 52 | echo ""; echo " FILES REMOVED FROM YOUR DIRECTORY:" |
| 53 | grep 'no longer in the repository' cvs.out |
| 54 | |
Chris Lattner | 868cb7d | 2002-04-29 19:11:01 +0000 | [diff] [blame] | 55 | echo ""; echo " FILES SUCCESSFULLY MERGED (or locally modified):" |
Vikram S. Adve | 355df3f | 2002-02-11 20:59:26 +0000 | [diff] [blame] | 56 | grep '^M' cvs.out | grep -v Merging |
| 57 | |
| 58 | echo ""; echo " NEW FILES AND DIRECTORIES:" |
Vikram S. Adve | 38bb2ff8 | 2002-10-31 15:32:24 +0000 | [diff] [blame] | 59 | if ($printnew != 0) then |
| 60 | 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' |
| 61 | else |
| 62 | echo '(USE "cvsupdate -n -new" TO SEE NEW FILES AND DIRECTORIES.)' |
| 63 | endif |
Vikram S. Adve | 355df3f | 2002-02-11 20:59:26 +0000 | [diff] [blame] | 64 | |
| 65 | echo "" |
| 66 | |
| 67 | |
| 68 | #========================================================= |
| 69 | # CODE TO BE EXECUTED IF INTERRUPT IS RECEIVED |
| 70 | #========================================================= |
| 71 | cleanup: |
| 72 | exit($pstatus) |