aboutsummaryrefslogtreecommitdiff
path: root/devel/subversion-freebsd/files/patch-contrib--client-side--asvn
blob: c8be147d7d770e5edeec9635227790af35f10c04 (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
--- contrib/client-side/asvn.orig	Tue Jun 15 06:02:44 2004
+++ contrib/client-side/asvn	Mon Sep 11 17:07:04 2006
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/local/bin/bash 
 #-------------------------------------------------------------------------
 #    Author:		Ross Mark (rossm@controllingedge.com.au)
 #    Date:		Tue Mar 11 10:02:57 EST 2003
@@ -46,7 +46,7 @@
 TMPFILE2=/tmp/asvn.tmp2.$$
 PCWD=`/bin/pwd`
 SKIPSVN='\( -name .svn -prune -false \)'
-PRINTDETAILS="-printf \"file='%p' mode=%m user=%u(%U) group=%g(%G)\n\""
+PRINTDETAILS="-printf \"file='%p' mode=%m user=(%U) group=(%G)\n\""
 
 trap cleanup 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
 
@@ -58,7 +58,8 @@
 function basedirname()
 {
     refname="$1"
-    dir="`dirname $2`"
+    shift
+    dir="`dirname \"$*\"`"
     ref=`expr "$dir" : "$refname/\(.*\)"`
     if [ -z "$ref" ]
     then
@@ -105,10 +106,10 @@
 
 function recorddirinfo
 {
-    eval "find $PCWD $SKIPSVN -o \( -type d ! -name .svn  -print \)" |while read dirlist
+    eval "gfind \"$PCWD\" $SKIPSVN -o \( -type d ! -name .svn  -print \)" |while read dirlist
     do
-	updatedirsymlinks $1 $dirlist
-	updatedirdevices $1 $dirlist
+	updatedirsymlinks $1 "$dirlist"
+	updatedirdevices $1 "$dirlist"
     done
 }
 
@@ -126,15 +127,15 @@
     #
     # Obtain the list of devices in this directory
     #
-    find "$dir" \( \( -type b -o -type c -o -type p \) -print \)  -o  -type d ! -name "`basename $dir`" -prune | while read file
+    gfind "$dir" \( \( -type b -o -type c -o -type p \) -print \)  -o  -type d ! -name "`basename \"$dir\"`" -prune | while read file
     do
-	echo -n `find $file -printf "file='%f' mode=%m user=%u(%U) group=%g(%G)"`
-	[ -b $file ] && echo -n ' type=b'
-	[ -c $file ] && echo -n ' type=c'
-	[ -p $file ] && echo ' type=p'
-	if [ -b $file -o -c $file ] 
+	echo -n `gfind "$file" -printf "file='%f' mode=%m user=%u(%U) group=%g(%G)"`
+	[ -b "$file" ] && echo -n ' type=b'
+	[ -c "$file" ] && echo -n ' type=c'
+	[ -p "$file" ] && echo ' type=p'
+	if [ -b "$file" -o -c "$file" ] 
 	then
-	    ls -l $file |
+	    ls -l "$file" |
 		sed -e 's/^[-lcpbrdwxXstugoTS]* *[0-9] [^ ]* *[^ ]* *\([0-9]*\), *\([0-9]*\) .*/ major=\1 minor=\2/'
 	fi
 	# In this case file is the full path.
@@ -145,7 +146,7 @@
     #
     # Obtain the currently defined devices
     #
-    $SVN propget $DEV_PROP $dir >$TMPFILE1
+    $SVN propget $DEV_PROP "$dir" >$TMPFILE1
 
     #
     # If the two list are the same then there is nothing to do.
@@ -161,7 +162,7 @@
 	if [ "$CHECKIN" = "true" ]
 	then
 	    # Add the current devices to the property
-	    $SVN propset $DEV_PROP $dir -F $TMPFILE
+	    $SVN propset $DEV_PROP "$dir" -F $TMPFILE
 	else
 	    # Delete all the unwanted devices ie not in TMPFILE1
 	    cat $TMPFILE |while read line
@@ -169,8 +170,8 @@
 		file=`expr "$line" : "file='\(.*\)' mode"`
 		if ! grep -q "file='$file'" $TMPFILE1
 		then
-		    rm $file
-		    deleteignorefile $file
+		    rm "$file"
+		    deleteignorefile "$file"
 		fi
 	    done
 	fi
@@ -178,7 +179,7 @@
 	# There are no devices in this directory
 	if [ "$CHECKIN" = "true" ]
 	then
-	    $SVN propdel $DEV_PROP $dir
+	    $SVN propdel $DEV_PROP "$dir"
 	fi
     fi
 
@@ -194,10 +195,10 @@
 	    grep -q "$info" $TMPFILE && continue # This line still matches
 	    file=`expr "$info" : "file='\(.*\)' "`
 	    mode=`expr "$info" : ".*' mode=\([0-9]*\) "`
-	    user=`expr "$info" : ".* user=\([^(]*\)("`
-	    uid=`expr "$info" : ".* user=[^(]*(\([0-9]*\) "`
-	    group=`expr "$info" : ".* group=\([^(]*\)("`
-	    gid=`expr "$info" : ".* group=[^(]*(\([0-9]*\) "`
+#	    user=`expr "$info" : ".* user=\([^(]*\)("`
+	    uid=`expr "$info" : ".* user=[^(]*(\([0-9]*\)"`
+#	    group=`expr "$info" : ".* group=\([^(]*\)("`
+	    gid=`expr "$info" : ".* group=[^(]*(\([0-9]*\)"`
 	    type=`expr "$info" : ".* type=\(.\)"`
 	    major=`expr "$info" : ".* major=\([0-9]*\)"`
 	    minor=`expr "$info" : ".* minor=\([0-9]*\)"`
@@ -205,10 +206,11 @@
 	    # This file is either missing or wrong
 	    # Delete the old and create it anew.
 	    #
-	    rm -f $dir/$file
-	    mknod --mode=$mode $dir/$file $type $major $minor
-	    chown $user:$group $dir/$file
-	    addignorefile $dir/$file
+	    rm -f "$dir/$file"
+	    mknod --mode=$mode "$dir/$file" $type $major $minor
+#	    chown $user:$group $dir/$file
+	    chown $uid:$gid "$dir/$file"
+	    addignorefile "$dir/$file"
 	done
     fi
 }
@@ -228,7 +230,7 @@
     #
     # Obtain the list of symlinks in this directory
     #
-    find "$dir" \( -type l -printf "file='%f' dest='%l'\n" \)  -o  -type d ! -name "`basename $dir`" -prune |
+    gfind "$dir" \( -type l -printf "file='%f' dest='%l'\n" \)  -o  -type d ! -name "`basename \"$dir\"`" -prune |
 	sort >$TMPFILE
     
     #
@@ -243,7 +245,7 @@
     #
     # Obtain the currently defined symlinks
     #
-    $SVN propget $SYM_PROP $dir >$TMPFILE1
+    $SVN propget $SYM_PROP "$dir" >$TMPFILE1
 
     #
     # If the two list are the same then there is nothing to do.
@@ -259,7 +261,7 @@
 	if [ "$CHECKIN" = "true" ]
 	then
 	    # Add the current symlinks to the property
-	    $SVN propset $SYM_PROP $dir -F $TMPFILE
+	    $SVN propset $SYM_PROP "$dir" -F $TMPFILE
 	else
 	    # Delete all the unwanted symlinks
 	    cat $TMPFILE |while read line
@@ -268,8 +270,8 @@
 		efile="`echo $file |sed -e 's!\([\[\(\$]\)!\\\\\1!g'`"
 		if ! grep -q "file='$efile'" $TMPFILE1
 		then
-		    rm $dir/$file
-		    deleteignorefile $dir/$file
+		    rm "$dir/$file"
+		    deleteignorefile "$dir/$file"
 		fi
 	    done
 	fi
@@ -277,7 +279,7 @@
 	# There are no symlinks in this directory
 	if [ "$CHECKIN" = "true" ]
 	then
-	    $SVN propdel $SYM_PROP $dir
+	    $SVN propdel $SYM_PROP "$dir"
 	fi
     fi
 
@@ -294,10 +296,10 @@
 
 	    if [ -L $dir/$file  ]
 	    then
-		[ "`find $dir/$file -printf '%l'`" = "$dest" ] && continue
+		[ "`gfind \"$dir/$file\" -printf '%l'`" = "$dest" ] && continue
 	    fi 
-	    rm -f $dir/$file
-	    ln -s $dest $dir/$file
+	    rm -f "$dir/$file"
+	    ln -s $dest "$dir/$file"
 	done
     fi
 }
@@ -313,37 +315,39 @@
 
     # Find all the directories and files
     cp /dev/null $TMPFILE
-    eval "find $PCWD $SKIPSVN -o \( \( -type d ! -name .svn  \) -o -type f \) $PRINTDETAILS" | while read info
+    eval "gfind \"$PCWD\" $SKIPSVN -o \( \( -type d ! -name .svn  \) -o -type f \) $PRINTDETAILS" | while read info
     do
 	device=`expr "$info" : "file='\(.*\)' mode"`
 	info=`expr "$info" : "file='.*' \(mode.*\)"`
+#	echo DEBUG: device vale $device
 	if [ "$PCWD" = "$device" ]
 	then
 	    dir="."
 	    file=""
 	else
-	    dir="`basedirname $PCWD $device`"
-	    file="`basename $device`"
+	    dir="`basedirname \"$PCWD\" $device`"
+	    file=`basename "$device"`
 	fi
 	# see if the properties have changed.
-	if [ "`$SVN propget $FILE_PROP $dir/$file`" != "$info" ]
+	if [ "`$SVN propget $FILE_PROP \"$dir/$file\"`" != "$info" ]
 	then
 	    if [ "$CHECKIN" = "true" ]
 	    then
-		$SVN propset $FILE_PROP  "$info" $dir/$file
+		$SVN propset $FILE_PROP  "$info" "$dir/$file"
 	    else
 		info=`$SVN propget $FILE_PROP "$dir/$file"`
 		mode=`expr "$info" : "mode=\([0-9]*\) "`
-		user=`expr "$info" : ".* user=\([^(]*\)("`
-		uid=`expr "$info" : ".* user=[^(]*(\([0-9]*\) "`
-		group=`expr "$info" : ".* group=\([^(]*\)("`
-		gid=`expr "$info" : ".* group=[^(]*(\([0-9]*\) "`
-		if  [ "$user" = "" -o "$group" = ""  -o "$mode" = "" ]
+#		user=`expr "$info" : ".* user=\([^(]*\)("`
+		uid=`expr "$info" : ".* user=[^(]*(\([0-9]*\)"`
+#		group=`expr "$info" : ".* group=\([^(]*\)("`
+		gid=`expr "$info" : ".* group=[^(]*(\([0-9]*\)"`
+		if  [ "$uid" = "" -o "$gid" = ""  -o "$mode" = "" ]
 		then
 		    echo "property $FILE_PROP not set for $dir/$file"
 		else
-		    chown $user:$group  $dir/$file
-		    chmod $mode $dir/$file
+#	    		chown $user:$group $dir/$file
+		    chown $uid:$gid  "$dir/$file"
+		    chmod $mode "$dir/$file"
 		fi
 	    fi
 	fi
@@ -364,8 +368,9 @@
     if [ "$CHDIR" = "true" ]
     then
 	shift $(($# -1))
-	cd $1
-    PCWD="$PCWD/$1"
+        WD=`echo $1 | sed "s/\/$//" | awk -F "/" '{print $(NF)}' `
+        cd $WD
+        PCWD="$PCWD/$WD"
     fi
     recorddirinfo 
     recordpermissions 
@@ -382,7 +387,7 @@
 
 [ "$ACTION" =  "pre" ] && pre_checkin $@
 
-$SVN $@
+$SVN "$@"
 
 [ $? = 0 -a "$ACTION" = "post" ] && post_checkout $@