chiark / gitweb /
actually build summer
[chiark-utils.git] / scripts / cvs-adjustroot
1 #!/bin/bash
2
3 set -e
4
5 usage () { echo >&2 'usage: cvs-adjustroot OLD NEW'; exit 1; }
6
7 case "$#.$1" in
8 4.--reinvoke)   reinvoke=true; shift    ;;
9 *.-*)           usage                   ;;
10 2.*)            reinvoke=false          ;;
11 1.*)            usage                   ;;
12 0.*)            usage                   ;;
13 *)              usage                   ;;
14 esac
15
16 old="$1"; shift
17 new="$1"; shift
18
19 if $reinvoke; then
20         filename="$1";
21         cmp -- "$filename" <(printf "%s\n" "$old")
22         printf "%s\n" "$new" >"$filename".new
23         mv -f -- "$filename".new "$filename"
24         exit 0
25 fi
26
27 find -path '*/CVS/Root' -exec cvs-adjustroot --reinvoke "$old" "$new" '{}' ';'