1999-11-25 Mark Mitchell <mark@codesourcery.com>
[official-gcc.git] / contrib / newcvsroot
blob4ce13526f4818f95a6df5878c8065b2003d34827
1 #! /usr/bin/env bash
2 # Written by Roland McGrath <roland@gnu.org>
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).
7 # Usage: newcvsroot <newroot> <modulename> <toplevel directory>
9 root=$1; shift
10 module=$1; shift
11 topdir=$1; shift
13 rep=${root##*:}
15 case "$topdir" in
16 /*|./*|../*) echo >&2 "$0 wants relative path from top of checkout"; exit 1;;
17 esac
19 find $topdir \( -name Repository -o -name Root \) -print | while read f; do
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}
27 esac
29 done