Mercurial > public > mercurial-scm > hg
comparison tests/test-convert-svn-source.t @ 17033:0413f68da85c
tests: cleanup of svn url handling
The subversion tests used different tricks to create properly encoded URLs,
partly due to partial support for different ways of running the tests on
windows. Now we only need/support one way of running the tests on windows.
Windows URLs should look like 'file:///c:/foo%20bar' and on Unix platforms
like 'file:///tmp/baz'.
'pwd' in the test framework will on Windows emit paths like 'c:/foo bar'.
Explicit handling of backslashes in paths is thus no longer needed and is
removed. Paths on windows do however need an extra '/' compared to other
platforms.
This change makes test-subrepo-svn.t pass on windows with msys. Other tests
might need more work.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Tue, 26 Jun 2012 03:35:22 +0200 |
parents | b12b65d2cbe4 |
children | 3dd6da761fff |
comparison
equal
deleted
inserted
replaced
17032:7dd82e0c43ea | 17033:0413f68da85c |
---|---|
1 | 1 |
2 $ "$TESTDIR/hghave" svn svn-bindings || exit 80 | 2 $ "$TESTDIR/hghave" svn svn-bindings || exit 80 |
3 | 3 |
4 $ fixpath() | |
5 > { | |
6 > tr '\\' / | |
7 > } | |
8 $ cat >> $HGRCPATH <<EOF | 4 $ cat >> $HGRCPATH <<EOF |
9 > [extensions] | 5 > [extensions] |
10 > convert = | 6 > convert = |
11 > graphlog = | 7 > graphlog = |
12 > [convert] | 8 > [convert] |
13 > svn.trunk = mytrunk | 9 > svn.trunk = mytrunk |
14 > EOF | 10 > EOF |
15 | 11 |
16 $ svnadmin create svn-repo | 12 $ svnadmin create svn-repo |
17 $ svnpath=`pwd | fixpath` | 13 $ SVNREPOPATH=`pwd`/svn-repo |
18 | 14 #if windows |
19 | 15 $ SVNREPOURL=file:///`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"` |
20 $ expr "$svnpath" : "\/" > /dev/null | 16 #else |
21 > if [ $? -ne 0 ]; then | 17 $ SVNREPOURL=file://`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"` |
22 > svnpath="/$svnpath" | 18 #endif |
23 > fi | |
24 > svnurl="file://$svnpath/svn-repo" | |
25 | 19 |
26 Now test that it works with trunk/tags layout, but no branches yet. | 20 Now test that it works with trunk/tags layout, but no branches yet. |
27 | 21 |
28 Initial svn import | 22 Initial svn import |
29 | 23 |
31 $ cd projB | 25 $ cd projB |
32 $ mkdir mytrunk | 26 $ mkdir mytrunk |
33 $ mkdir tags | 27 $ mkdir tags |
34 $ cd .. | 28 $ cd .. |
35 | 29 |
36 $ svnurl="file://$svnpath/svn-repo/proj%20B" | 30 $ svn import -m "init projB" projB "$SVNREPOURL/proj%20B" | sort |
37 $ svn import -m "init projB" projB "$svnurl" | fixpath | sort | |
38 | 31 |
39 Adding projB/mytrunk | 32 Adding projB/mytrunk |
40 Adding projB/tags | 33 Adding projB/tags |
41 Committed revision 1. | 34 Committed revision 1. |
42 | 35 |
43 Update svn repository | 36 Update svn repository |
44 | 37 |
45 $ svn co "$svnurl"/mytrunk B | fixpath | 38 $ svn co "$SVNREPOURL/proj%20B/mytrunk" B |
46 Checked out revision 1. | 39 Checked out revision 1. |
47 $ cd B | 40 $ cd B |
48 $ echo hello > 'letter .txt' | 41 $ echo hello > 'letter .txt' |
49 $ svn add 'letter .txt' | 42 $ svn add 'letter .txt' |
50 A letter .txt | 43 A letter .txt |
57 $ svn ci -m world | 50 $ svn ci -m world |
58 Sending letter .txt | 51 Sending letter .txt |
59 Transmitting file data . | 52 Transmitting file data . |
60 Committed revision 3. | 53 Committed revision 3. |
61 | 54 |
62 $ svn copy -m "tag v0.1" "$svnurl"/mytrunk "$svnurl"/tags/v0.1 | 55 $ svn copy -m "tag v0.1" "$SVNREPOURL/proj%20B/mytrunk" "$SVNREPOURL/proj%20B/tags/v0.1" |
63 | 56 |
64 Committed revision 4. | 57 Committed revision 4. |
65 | 58 |
66 $ "$TESTDIR/svn-safe-append.py" 'nice day today!' 'letter .txt' | 59 $ "$TESTDIR/svn-safe-append.py" 'nice day today!' 'letter .txt' |
67 $ svn ci -m "nice day" | 60 $ svn ci -m "nice day" |
70 Committed revision 5. | 63 Committed revision 5. |
71 $ cd .. | 64 $ cd .. |
72 | 65 |
73 Convert to hg once | 66 Convert to hg once |
74 | 67 |
75 $ hg convert "$svnurl" B-hg | 68 $ hg convert "$SVNREPOURL/proj%20B" B-hg |
76 initializing destination B-hg repository | 69 initializing destination B-hg repository |
77 scanning source... | 70 scanning source... |
78 sorting... | 71 sorting... |
79 converting... | 72 converting... |
80 3 init projB | 73 3 init projB |
94 Sending letter .txt | 87 Sending letter .txt |
95 Adding letter2.txt | 88 Adding letter2.txt |
96 Transmitting file data .. | 89 Transmitting file data .. |
97 Committed revision 6. | 90 Committed revision 6. |
98 | 91 |
99 $ svn copy -m "tag v0.2" "$svnurl"/mytrunk "$svnurl"/tags/v0.2 | 92 $ svn copy -m "tag v0.2" "$SVNREPOURL/proj%20B/mytrunk" "$SVNREPOURL/proj%20B/tags/v0.2" |
100 | 93 |
101 Committed revision 7. | 94 Committed revision 7. |
102 | 95 |
103 $ "$TESTDIR/svn-safe-append.py" "blah-blah-blah" letter2.txt | 96 $ "$TESTDIR/svn-safe-append.py" "blah-blah-blah" letter2.txt |
104 $ svn ci -m "work in progress" | 97 $ svn ci -m "work in progress" |
105 Sending letter2.txt | 98 Sending letter2.txt |
106 Transmitting file data . | 99 Transmitting file data . |
107 Committed revision 8. | 100 Committed revision 8. |
108 $ cd .. | 101 $ cd .. |
109 | 102 |
110 $ hg convert -s svn "$svnurl/non-existent-path" dest | 103 $ hg convert -s svn "$SVNREPOURL/proj%20B/non-existent-path" dest |
111 initializing destination dest repository | 104 initializing destination dest repository |
112 abort: no revision found in module /proj B/non-existent-path | 105 abort: no revision found in module /proj B/non-existent-path |
113 [255] | 106 [255] |
114 | 107 |
115 ######################################## | 108 ######################################## |
116 | 109 |
117 Test incremental conversion | 110 Test incremental conversion |
118 | 111 |
119 $ hg convert "$svnurl" B-hg | 112 $ hg convert "$SVNREPOURL/proj%20B" B-hg |
120 scanning source... | 113 scanning source... |
121 sorting... | 114 sorting... |
122 converting... | 115 converting... |
123 1 second letter | 116 1 second letter |
124 0 work in progress | 117 0 work in progress |
148 v0.1 | 141 v0.1 |
149 $ cd .. | 142 $ cd .. |
150 | 143 |
151 Test filemap | 144 Test filemap |
152 $ echo 'include letter2.txt' > filemap | 145 $ echo 'include letter2.txt' > filemap |
153 $ hg convert --filemap filemap "$svnurl"/mytrunk fmap | 146 $ hg convert --filemap filemap "$SVNREPOURL/proj%20B/mytrunk" fmap |
154 initializing destination fmap repository | 147 initializing destination fmap repository |
155 scanning source... | 148 scanning source... |
156 sorting... | 149 sorting... |
157 converting... | 150 converting... |
158 5 init projB | 151 5 init projB |
168 | | 161 | |
169 o 0 second letter files: letter2.txt | 162 o 0 second letter files: letter2.txt |
170 | 163 |
171 | 164 |
172 Test stop revision | 165 Test stop revision |
173 $ hg convert --rev 1 "$svnurl"/mytrunk stoprev | 166 $ hg convert --rev 1 "$SVNREPOURL/proj%20B/mytrunk" stoprev |
174 initializing destination stoprev repository | 167 initializing destination stoprev repository |
175 scanning source... | 168 scanning source... |
176 sorting... | 169 sorting... |
177 converting... | 170 converting... |
178 0 init projB | 171 0 init projB |
198 scanning source... | 191 scanning source... |
199 sorting... | 192 sorting... |
200 converting... | 193 converting... |
201 1 init projA | 194 1 init projA |
202 0 adddir | 195 0 adddir |
203 $ hg --config convert.svn.trunk= convert file://$svnpath/svn-empty/trunk | 196 $ hg --config convert.svn.trunk= convert "$SVNREPOURL/../svn-empty/trunk" |
204 assuming destination trunk-hg | 197 assuming destination trunk-hg |
205 initializing destination trunk-hg repository | 198 initializing destination trunk-hg repository |
206 scanning source... | 199 scanning source... |
207 sorting... | 200 sorting... |
208 converting... | 201 converting... |