OSDN Git Service

Fix cut-n-paste error in last change.
[pf3gnuchains/gcc-fork.git] / contrib / newcvsroot
1 #! /usr/bin/env bash
2 # Written by Roland McGrath <roland@gnu.org>
3
4 # Replaces all CVS/Root and CVS/Repository files in a checked-out CVS
5 # tree. Requires shell with # and % variable substitution (e.g. bash).
6
7 # Usage: newcvsroot <newroot> <modulename> <toplevel directory>
8
9 root=$1; shift
10 module=$1; shift
11 topdir=$1; shift
12
13 rep=${root##*:}
14
15 case "$topdir" in
16 /*|./*|../*) echo >&2 "$0 wants relative path from top of checkout"; exit 1;;
17 esac
18
19 find $topdir \( -name Repository -o -name Root \) -print | while read f; do
20
21 case "$f" in
22 */CVS/Root) echo $root > $f ;;
23 */CVS/Repository)
24   r=${module}${f#${topdir}}
25   echo > $f $rep/${r%/CVS/Repository}
26   ;;
27 esac
28
29 done