##// END OF EJS Templates
Enable path validation for copy, rename, debugwalk and other canonpath users....
Thomas Arendsen Hein -
r1976:df841634 default
parent child Browse files
Show More
@@ -185,7 +185,9 b' def canonpath(root, cwd, myname):'
185 185 name = os.path.join(root, cwd, name)
186 186 name = os.path.normpath(name)
187 187 if name.startswith(rootsep):
188 return pconvert(name[len(rootsep):])
188 name = name[len(rootsep):]
189 audit_path(name)
190 return pconvert(name)
189 191 elif name == root:
190 192 return ''
191 193 else:
@@ -179,3 +179,33 b' hg rename d1/bb d1/b'
179 179 hg status
180 180 hg debugstate | grep copy
181 181 hg update -C
182
183 echo "# check illegal path components"
184
185 hg rename d1/d11/a1 .hg/foo
186 hg status
187 hg rename d1/d11/a1 ../foo
188 hg status
189
190 mv d1/d11/a1 .hg/foo
191 hg rename --after d1/d11/a1 .hg/foo
192 hg status
193 hg update -C
194 rm .hg/foo
195
196 hg rename d1/d11/a1 .hg
197 hg status
198 hg rename d1/d11/a1 ..
199 hg status
200
201 mv d1/d11/a1 .hg
202 hg rename --after d1/d11/a1 .hg
203 hg status
204 hg update -C
205 rm .hg/a1
206
207 (cd d1/d11; hg rename ../../d2/b ../../.hg/foo)
208 hg status
209 (cd d1/d11; hg rename ../../d2/b ../../../foo)
210 hg status
211
@@ -254,3 +254,19 b' A d1/bc'
254 254 R d1/b
255 255 # idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b)
256 256 M d1/b
257 # check illegal path components
258 abort: path contains illegal component: .hg/foo
259
260 abort: ../foo not under root
261 abort: path contains illegal component: .hg/foo
262
263 ! d1/d11/a1
264 abort: path contains illegal component: .hg/a1
265
266 abort: ../a1 not under root
267 abort: path contains illegal component: .hg/a1
268
269 ! d1/d11/a1
270 abort: path contains illegal component: .hg/foo
271
272 abort: ../../../foo not under root
@@ -28,6 +28,8 b' hg debugwalk ..'
28 28 cd ..
29 29 hg debugwalk ../beans
30 30 hg debugwalk .
31 hg debugwalk .hg
32 hg debugwalk ../.hg
31 33 cd ..
32 34 hg debugwalk -Ibeans
33 35 hg debugwalk 'glob:mammals/../beans/b*'
@@ -35,6 +37,10 b" hg debugwalk '-X*/Procyonidae' mammals"
35 37 hg debugwalk path:mammals
36 38 hg debugwalk ..
37 39 hg debugwalk beans/../..
40 hg debugwalk .hg
41 hg debugwalk beans/../.hg
42 hg debugwalk beans/../.hg/data
43 hg debugwalk beans/.hg
38 44 # Don't know how to test absolute paths without always getting a false
39 45 # error.
40 46 #hg debugwalk `pwd`/beans
@@ -50,6 +50,9 b' f mammals/Procyonidae/cacomistle Procy'
50 50 f mammals/Procyonidae/coatimundi Procyonidae/coatimundi
51 51 f mammals/Procyonidae/raccoon Procyonidae/raccoon
52 52 f mammals/skunk skunk
53 .hg: No such file or directory
54 abort: path contains illegal component: .hg
55
53 56 f beans/black beans/black
54 57 f beans/borlotti beans/borlotti
55 58 f beans/kidney beans/kidney
@@ -65,6 +68,13 b' f mammals/Procyonidae/raccoon mamma'
65 68 f mammals/skunk mammals/skunk
66 69 abort: .. not under root
67 70 abort: beans/../.. not under root
71 abort: path contains illegal component: .hg
72
73 abort: path contains illegal component: .hg
74
75 abort: path contains illegal component: .hg/data
76
77 beans/.hg: No such file or directory
68 78 f fennel fennel
69 79 f fenugreek fenugreek
70 80 f fiddlehead fiddlehead
General Comments 0
You need to be logged in to leave comments. Login now