##// END OF EJS Templates
handle file URIs correctly, according to RFC 2396 (issue1153)...
Sune Foldager -
r9996:2770d03a stable
parent child Browse files
Show More
@@ -1197,7 +1197,19 b' def drop_scheme(scheme, path):'
1197 if path.startswith(sc):
1197 if path.startswith(sc):
1198 path = path[len(sc):]
1198 path = path[len(sc):]
1199 if path.startswith('//'):
1199 if path.startswith('//'):
1200 path = path[2:]
1200 if scheme == 'file':
1201 i = path.find('/', 2)
1202 if i == -1:
1203 return ''
1204 # On Windows, absolute paths are rooted at the current drive
1205 # root. On POSIX they are rooted at the file system root.
1206 if os.name == 'nt':
1207 droot = os.path.splitdrive(os.getcwd())[0] + '/'
1208 path = os.path.join(droot, path[i+1:])
1209 else:
1210 path = path[i:]
1211 else:
1212 path = path[2:]
1201 return path
1213 return path
1202
1214
1203 def uirepr(s):
1215 def uirepr(s):
@@ -44,10 +44,10 b' cd a'
44 hg cat a
44 hg cat a
45
45
46 echo
46 echo
47 echo % "check that we drop the file:// from the path before"
47 echo % "check that we drop the file: from the path before"
48 echo % "writing the .hgrc"
48 echo % "writing the .hgrc"
49 cd ../..
49 cd ../..
50 hg clone file://a e
50 hg clone file:a e
51 grep 'file:' e/.hg/hgrc
51 grep 'file:' e/.hg/hgrc
52
52
53 echo
53 echo
@@ -29,7 +29,7 b' updating to branch default'
29 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
29 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
30 a
30 a
31
31
32 % check that we drop the file:// from the path before
32 % check that we drop the file: from the path before
33 % writing the .hgrc
33 % writing the .hgrc
34 updating to branch default
34 updating to branch default
35 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
35 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -24,3 +24,8 b' cd ..'
24 hg init empty
24 hg init empty
25 cd empty
25 cd empty
26 hg pull -u ../test
26 hg pull -u ../test
27
28 echo % test file: uri handling
29 hg pull -q file://../test-doesnt-exist
30 hg pull -q file:../test
31 hg pull -q file://foobar`pwd`/../test
@@ -30,3 +30,5 b' adding manifests'
30 adding file changes
30 adding file changes
31 added 1 changesets with 1 changes to 1 files
31 added 1 changesets with 1 changes to 1 files
32 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
32 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
33 % test file: uri handling
34 abort: repository /test-doesnt-exist not found!
General Comments 0
You need to be logged in to leave comments. Login now