OSDN Git Service

2005-10-28 Andrew Pinski <pinskia@gcc.gnu.org>
[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 if [ $# != 3 ]; then
10     echo "Note to svn users: use svn switch --relocate instead."
11     echo
12     echo "usage: `basename $0` <newroot> <modulename> <toplevel directory>"
13     exit 1
14 fi
15
16 root=$1; shift
17 module=$1; shift
18 topdir=$1; shift
19
20 rep=${root##*:}
21
22 case "$topdir" in
23 /*|./*|../*) echo >&2 "$0 wants relative path from top of checkout"; exit 1;;
24 esac
25
26 find $topdir \( -name Repository -o -name Root \) -print | while read f; do
27
28 case "$f" in
29 */CVS/Root) echo $root > "$f" ;;
30 */CVS/Repository)
31   r=${module}${f#${topdir}}
32   echo > "$f" $rep/${r%/CVS/Repository}
33   ;;
34 esac
35
36 done