blob: 4703e8401b53d4b4ec604165ba2b2d21adc2d6b4 (
plain) (
blame)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
#! /bin/bash
# This script is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# See the COPYING and AUTHORS files for more details.
doit()
{
echo $*
$*
}
usage()
{
echo "Usage: cvs-take-patch patch_file_name"
exit 1
}
#
# Find the highest level directory in $1 which does not
# contain the directory $2. Return it in $MISSING
#
highest_missing()
{
START_DIR="$1"
NAME="$2"
MISSING=""
WHERE=$(dirname "$START_DIR")
PREV_WHERE=$START_DIR
while [ x"$WHERE" != x"$PREV_WHERE" ]
do
WHERE="$PREV_WHERE"
if [ ! -d "$WHERE"/"$NAME" ]
then
MISSING="$WHERE"
fi
PREV_WHERE=$(dirname "$WHERE")
done
echo highest_missing returns $MISSING
}
#
# Add all new directries to CVS, top-down
# $1: name of a directory
# $2: name of the CVS directory
#
add_cvs_dirs()
{
MISSING=foo
while [ "$MISSING" != "" ]
do
highest_missing $1 $2
if [ x"$MISSING" != "x" ]
then
if [ ! -d "$MISSING"/"$2" ]
then
doit cvs add $MISSING
fi
fi
done
}
PATCHFILE=$1
REMOVEDFILES=$(removed-by-patch $PATCHFILE)
if [ "$REMOVEDFILES" != "" ]
then
doit cvs remove $REMOVEDFILES
fi
NEWFILES=$(added-by-patch $PATCHFILE)
for i in $NEWFILES
do
DIRNAME=$(dirname $i)
echo "Looking at $DIRNAME"
add_cvs_dirs $DIRNAME CVS
done
if [ "$NEWFILES" != "" ]
then
doit cvs add $NEWFILES
fi
|