summaryrefslogtreecommitdiff
path: root/dist/cvsshow
blob: 75395957f7ffd9302250c720029ae780221bfe18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh
#
export CVS_RSH=ssh
TAG=

do_cvs()
{
   DIR=$1
   if [ ! -f $DIR/CVS/Repository ]; then
	echo "'$DIR' has no CVS/Repository!"
	exit
   fi

   if [ ! -f $DIR/CVS/Root ]; then
	echo "'$DIR' has no CVS/Root!"
	exit
   fi

   if [ -f $DIR/CVS/Tag ]; then
	TAG="-r `cat $DIR/CVS/Tag | cut -c 2-`"
   fi

   REP="`cat $DIR/CVS/Repository`"
   ROOT="`cat $DIR/CVS/Root`"

   echo "Directory $DIR is rooted at $ROOT, $TAG $REP..."
   echo "   update with cvs -z3 -d $ROOT -q co $TAG -d $DIR $REP"
}

do_svn()
{
   DIR=$1
   if [ ! -d $DIR/.svn ]; then
	echo "'$DIR' has no .svn/ subdir!"
	exit
   fi

   ROOT=`svn info | grep URL|cut -f2 -d " "`
   if [ -z "$ROOT" ]; then
      echo "Couldn't find root from $DIR/.svn/entries"
      exit 1
   fi

   echo "Directory $DIR is rooted at $ROOT..."
   echo "   update with svn co $ROOT $DIR"
}

if [ $# -eq 0 ]; then
	DIRS=.
else
	DIRS=$@
fi

for d in $DIRS
do
   if [ ! -d $d ]; then
	echo "no such directory '$d'"
	exit
   fi

   if [ -d $d/CVS ]; then
	do_cvs $d
   elif [ -d $d/.svn ]; then
	do_svn $d
   else
	echo "'$d' has neither CVS nor SVN information!"
   fi
done