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:" |
Vikram S. Adve | ab9ef2a | 2004-10-30 23:11:26 +0000 | [diff] [blame] | 47 | grep '^[UP] ' cvs.out |
Chris Lattner | 868cb7d | 2002-04-29 19:11:01 +0000 | [diff] [blame] | 48 | |
| 49 | echo ""; echo " UPDATE CONFLICTS OCCURRED FOR THE FOLLOWING FILES:" |
Vikram S. Adve | ab9ef2a | 2004-10-30 23:11:26 +0000 | [diff] [blame] | 50 | grep '^C ' cvs.out |
Vikram S. Adve | 355df3f | 2002-02-11 20:59:26 +0000 | [diff] [blame] | 51 | |
Vikram S. Adve | 65dea6e | 2004-10-29 17:43:19 +0000 | [diff] [blame] | 52 | echo ""; echo " NEW FILES THAT NEED TO BE COMMITTED:" |
Vikram S. Adve | ab9ef2a | 2004-10-30 23:11:26 +0000 | [diff] [blame] | 53 | grep '^[AR] ' cvs.out |
Vikram S. Adve | 65dea6e | 2004-10-29 17:43:19 +0000 | [diff] [blame] | 54 | |
Vikram S. Adve | ab9ef2a | 2004-10-30 23:11:26 +0000 | [diff] [blame] | 55 | echo ""; echo " FILES REMOVED FROM YOUR DIRECTORY:" |
Chris Lattner | fecaf56 | 2002-09-16 18:09:42 +0000 | [diff] [blame] | 56 | grep 'no longer in the repository' cvs.out |
| 57 | |
Chris Lattner | 868cb7d | 2002-04-29 19:11:01 +0000 | [diff] [blame] | 58 | echo ""; echo " FILES SUCCESSFULLY MERGED (or locally modified):" |
Vikram S. Adve | ab9ef2a | 2004-10-30 23:11:26 +0000 | [diff] [blame] | 59 | grep '^M ' cvs.out |
Vikram S. Adve | 355df3f | 2002-02-11 20:59:26 +0000 | [diff] [blame] | 60 | |
| 61 | echo ""; echo " NEW FILES AND DIRECTORIES:" |
Vikram S. Adve | 38bb2ff8 | 2002-10-31 15:32:24 +0000 | [diff] [blame] | 62 | if ($printnew != 0) then |
| 63 | 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' |
| 64 | else |
| 65 | echo '(USE "cvsupdate -n -new" TO SEE NEW FILES AND DIRECTORIES.)' |
| 66 | endif |
Vikram S. Adve | 355df3f | 2002-02-11 20:59:26 +0000 | [diff] [blame] | 67 | |
| 68 | echo "" |
| 69 | |
| 70 | |
| 71 | #========================================================= |
| 72 | # CODE TO BE EXECUTED IF INTERRUPT IS RECEIVED |
| 73 | #========================================================= |
| 74 | cleanup: |
| 75 | exit($pstatus) |