##// END OF EJS Templates
tests: cleanup of svn url handling...
Mads Kiilerich -
r17033:0413f68d default
parent child Browse files
Show More
@@ -1,108 +1,105 b''
1 1
2 2 $ "$TESTDIR/hghave" svn svn-bindings || exit 80
3 $ fix_path()
4 > {
5 > tr '\\' /
6 > }
7 3 $ echo "[extensions]" >> $HGRCPATH
8 4 $ echo "convert = " >> $HGRCPATH
9 5 $ echo "mq = " >> $HGRCPATH
10 $ svnpath=`pwd | fix_path`/svn-repo
11 $ svnadmin create "$svnpath"
12 $ cat > "$svnpath"/hooks/pre-revprop-change <<EOF
6
7 $ SVNREPOPATH=`pwd`/svn-repo
8 #if windows
9 $ SVNREPOURL=file:///`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
10 #else
11 $ SVNREPOURL=file://`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
12 #endif
13
14 $ svnadmin create "$SVNREPOPATH"
15 $ cat > "$SVNREPOPATH"/hooks/pre-revprop-change <<EOF
13 16 > #!/bin/sh
14 17 >
15 18 > REPOS="$1"
16 19 > REV="$2"
17 20 > USER="$3"
18 21 > PROPNAME="$4"
19 22 > ACTION="$5"
20 23 >
21 24 > if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi
22 25 > if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-branch" ]; then exit 0; fi
23 26 > if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-rev" ]; then exit 0; fi
24 27 >
25 28 > echo "Changing prohibited revision property" >&2
26 29 > exit 1
27 30 > EOF
28 $ chmod +x "$svnpath"/hooks/pre-revprop-change
29 $
30 $ # SVN wants all paths to start with a slash. Unfortunately,
31 $ # Windows ones don't. Handle that.
32 $ svnurl="$svnpath"
33 $ expr "$svnurl" : "\/" > /dev/null || svnurl="/$svnurl"
34 $ svnurl="file://$svnurl"
35 $ svn co "$svnurl" "$svnpath"-wc
31 $ chmod +x "$SVNREPOPATH"/hooks/pre-revprop-change
32 $ svn co "$SVNREPOURL" "$SVNREPOPATH"-wc
36 33 Checked out revision 0.
37 $ cd "$svnpath"-wc
34 $ cd "$SVNREPOPATH"-wc
38 35 $ echo a > a
39 36 $ svn add a
40 37 A a
41 38 $ svn ci -m'added a' a
42 39 Adding a
43 40 Transmitting file data .
44 41 Committed revision 1.
45 42 $ cd ..
46 43
47 44 initial roundtrip
48 45
49 $ hg convert -s svn -d hg "$svnpath"-wc "$svnpath"-hg | grep -v initializing
46 $ hg convert -s svn -d hg "$SVNREPOPATH"-wc "$SVNREPOPATH"-hg | grep -v initializing
50 47 scanning source...
51 48 sorting...
52 49 converting...
53 50 0 added a
54 $ hg convert -s hg -d svn "$svnpath"-hg "$svnpath"-wc
51 $ hg convert -s hg -d svn "$SVNREPOPATH"-hg "$SVNREPOPATH"-wc
55 52 scanning source...
56 53 sorting...
57 54 converting...
58 55
59 56 second roundtrip should do nothing
60 57
61 $ hg convert -s svn -d hg "$svnpath"-wc "$svnpath"-hg
58 $ hg convert -s svn -d hg "$SVNREPOPATH"-wc "$SVNREPOPATH"-hg
62 59 scanning source...
63 60 sorting...
64 61 converting...
65 $ hg convert -s hg -d svn "$svnpath"-hg "$svnpath"-wc
62 $ hg convert -s hg -d svn "$SVNREPOPATH"-hg "$SVNREPOPATH"-wc
66 63 scanning source...
67 64 sorting...
68 65 converting...
69 66
70 67 new hg rev
71 68
72 $ hg clone "$svnpath"-hg "$svnpath"-work
69 $ hg clone "$SVNREPOPATH"-hg "$SVNREPOPATH"-work
73 70 updating to branch default
74 71 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
75 $ cd "$svnpath"-work
72 $ cd "$SVNREPOPATH"-work
76 73 $ echo b > b
77 74 $ hg add b
78 75 $ hg ci -mb
79 76
80 77 adding an empty revision
81 78
82 79 $ hg qnew -m emtpy empty
83 80 $ hg qfinish -a
84 81 $ cd ..
85 82
86 83 echo hg to svn
87 84
88 $ hg --cwd "$svnpath"-hg pull -q "$svnpath"-work
89 $ hg convert -s hg -d svn "$svnpath"-hg "$svnpath"-wc
85 $ hg --cwd "$SVNREPOPATH"-hg pull -q "$SVNREPOPATH"-work
86 $ hg convert -s hg -d svn "$SVNREPOPATH"-hg "$SVNREPOPATH"-wc
90 87 scanning source...
91 88 sorting...
92 89 converting...
93 90 1 b
94 91 0 emtpy
95 92
96 93 svn back to hg should do nothing
97 94
98 $ hg convert -s svn -d hg "$svnpath"-wc "$svnpath"-hg
95 $ hg convert -s svn -d hg "$SVNREPOPATH"-wc "$SVNREPOPATH"-hg
99 96 scanning source...
100 97 sorting...
101 98 converting...
102 99
103 100 hg back to svn should do nothing
104 101
105 $ hg convert -s hg -d svn "$svnpath"-hg "$svnpath"-wc
102 $ hg convert -s hg -d svn "$SVNREPOPATH"-hg "$SVNREPOPATH"-wc
106 103 scanning source...
107 104 sorting...
108 105 converting...
@@ -1,251 +1,243 b''
1 1
2 2 $ "$TESTDIR/hghave" svn svn-bindings || exit 80
3 3
4 $ fixpath()
5 > {
6 > tr '\\' /
7 > }
8 4 $ cat >> $HGRCPATH <<EOF
9 5 > [extensions]
10 6 > convert =
11 7 > graphlog =
12 8 > EOF
13 9
14 10 $ svnadmin create svn-repo
15 11 $ svnadmin load -q svn-repo < "$TESTDIR/svn/move.svndump"
16 $ svnpath=`pwd | fixpath`
17
18 SVN wants all paths to start with a slash. Unfortunately,
19 Windows ones don't. Handle that.
20
21 $ expr "$svnpath" : "\/" > /dev/null
22 > if [ $? -ne 0 ]; then
23 > svnpath="/$svnpath"
24 > fi
25 > svnurl="file://$svnpath/svn-repo"
12 $ SVNREPOPATH=`pwd`/svn-repo
13 #if windows
14 $ SVNREPOURL=file:///`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
15 #else
16 $ SVNREPOURL=file://`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
17 #endif
26 18
27 19 Convert trunk and branches
28 20
29 $ hg convert --datesort "$svnurl"/subproject A-hg
21 $ hg convert --datesort "$SVNREPOURL"/subproject A-hg
30 22 initializing destination A-hg repository
31 23 scanning source...
32 24 sorting...
33 25 converting...
34 26 13 createtrunk
35 27 12 moved1
36 28 11 moved1
37 29 10 moved2
38 30 9 changeb and rm d2
39 31 8 changeb and rm d2
40 32 7 moved1again
41 33 6 moved1again
42 34 5 copyfilefrompast
43 35 4 copydirfrompast
44 36 3 add d3
45 37 2 copy dir and remove subdir
46 38 1 add d4old
47 39 0 rename d4old into d4new
48 40
49 41 $ cd A-hg
50 42 $ hg glog --template '{rev} {desc|firstline} files: {files}\n'
51 43 o 13 rename d4old into d4new files: d4new/g d4old/g
52 44 |
53 45 o 12 add d4old files: d4old/g
54 46 |
55 47 o 11 copy dir and remove subdir files: d3/d31/e d4/d31/e d4/f
56 48 |
57 49 o 10 add d3 files: d3/d31/e d3/f
58 50 |
59 51 o 9 copydirfrompast files: d2/d
60 52 |
61 53 o 8 copyfilefrompast files: d
62 54 |
63 55 o 7 moved1again files: d1/b d1/c
64 56 |
65 57 | o 6 moved1again files:
66 58 | |
67 59 o | 5 changeb and rm d2 files: d1/b d2/d
68 60 | |
69 61 | o 4 changeb and rm d2 files: b
70 62 | |
71 63 o | 3 moved2 files: d2/d
72 64 | |
73 65 o | 2 moved1 files: d1/b d1/c
74 66 | |
75 67 | o 1 moved1 files: b c
76 68 |
77 69 o 0 createtrunk files:
78 70
79 71
80 72 Check move copy records
81 73
82 74 $ hg st --rev 12:13 --copies
83 75 A d4new/g
84 76 d4old/g
85 77 R d4old/g
86 78
87 79 Check branches
88 80
89 81 $ hg branches
90 82 default 13:* (glob)
91 83 d1 6:* (glob)
92 84 $ cd ..
93 85
94 86 $ mkdir test-replace
95 87 $ cd test-replace
96 88 $ svnadmin create svn-repo
97 89 $ svnadmin load -q svn-repo < "$TESTDIR/svn/replace.svndump"
98 90
99 91 Convert files being replaced by directories
100 92
101 93 $ hg convert svn-repo hg-repo
102 94 initializing destination hg-repo repository
103 95 scanning source...
104 96 sorting...
105 97 converting...
106 98 6 initial
107 99 5 clobber symlink
108 100 4 clobber1
109 101 3 clobber2
110 102 2 adddb
111 103 1 branch
112 104 0 clobberdir
113 105
114 106 $ cd hg-repo
115 107
116 108 Manifest before
117 109
118 110 $ hg -v manifest -r 1
119 111 644 a
120 112 644 d/b
121 113 644 d2/a
122 114 644 @ dlink
123 115 644 @ dlink2
124 116 644 dlink3
125 117
126 118 Manifest after clobber1
127 119
128 120 $ hg -v manifest -r 2
129 121 644 a/b
130 122 644 d/b
131 123 644 d2/a
132 124 644 dlink/b
133 125 644 @ dlink2
134 126 644 dlink3
135 127
136 128 Manifest after clobber2
137 129
138 130 $ hg -v manifest -r 3
139 131 644 a/b
140 132 644 d/b
141 133 644 d2/a
142 134 644 dlink/b
143 135 644 @ dlink2
144 136 644 @ dlink3
145 137
146 138 Manifest after clobberdir
147 139
148 140 $ hg -v manifest -r 6
149 141 644 a/b
150 142 644 d/b
151 143 644 d2/a
152 144 644 d2/c
153 145 644 dlink/b
154 146 644 @ dlink2
155 147 644 @ dlink3
156 148
157 149 Try updating
158 150
159 151 $ hg up -qC default
160 152 $ cd ..
161 153
162 154 Test convert progress bar'
163 155
164 156 $ cat >> $HGRCPATH <<EOF
165 157 > [extensions]
166 158 > progress =
167 159 > [progress]
168 160 > assume-tty = 1
169 161 > delay = 0
170 162 > changedelay = 0
171 163 > format = topic bar number
172 164 > refresh = 0
173 165 > width = 60
174 166 > EOF
175 167
176 168 $ hg convert svn-repo hg-progress 2>&1 | "$TESTDIR/filtercr.py"
177 169
178 170 scanning [ <=> ] 1
179 171 scanning [ <=> ] 2
180 172 scanning [ <=> ] 3
181 173 scanning [ <=> ] 4
182 174 scanning [ <=> ] 5
183 175 scanning [ <=> ] 6
184 176 scanning [ <=> ] 7
185 177
186 178 converting [ ] 0/7
187 179 getting files [=====> ] 1/6
188 180 getting files [============> ] 2/6
189 181 getting files [==================> ] 3/6
190 182 getting files [=========================> ] 4/6
191 183 getting files [===============================> ] 5/6
192 184 getting files [======================================>] 6/6
193 185
194 186 converting [=====> ] 1/7
195 187 scanning paths [ ] 0/1
196 188 getting files [======================================>] 1/1
197 189
198 190 converting [===========> ] 2/7
199 191 scanning paths [ ] 0/2
200 192 scanning paths [==================> ] 1/2
201 193 getting files [========> ] 1/4
202 194 getting files [==================> ] 2/4
203 195 getting files [============================> ] 3/4
204 196 getting files [======================================>] 4/4
205 197
206 198 converting [=================> ] 3/7
207 199 scanning paths [ ] 0/1
208 200 getting files [======================================>] 1/1
209 201
210 202 converting [=======================> ] 4/7
211 203 scanning paths [ ] 0/1
212 204 getting files [======================================>] 1/1
213 205
214 206 converting [=============================> ] 5/7
215 207 scanning paths [ ] 0/3
216 208 scanning paths [===========> ] 1/3
217 209 scanning paths [========================> ] 2/3
218 210 getting files [===> ] 1/8
219 211 getting files [========> ] 2/8
220 212 getting files [=============> ] 3/8
221 213 getting files [==================> ] 4/8
222 214 getting files [=======================> ] 5/8
223 215 getting files [============================> ] 6/8
224 216 getting files [=================================> ] 7/8
225 217 getting files [======================================>] 8/8
226 218
227 219 converting [===================================> ] 6/7
228 220 scanning paths [ ] 0/1
229 221 getting files [===> ] 1/8
230 222 getting files [========> ] 2/8
231 223 getting files [=============> ] 3/8
232 224 getting files [==================> ] 4/8
233 225 getting files [=======================> ] 5/8
234 226 getting files [============================> ] 6/8
235 227 getting files [=================================> ] 7/8
236 228 getting files [======================================>] 8/8
237 229
238 230 initializing destination hg-progress repository
239 231 scanning source...
240 232 sorting...
241 233 converting...
242 234 6 initial
243 235 5 clobber symlink
244 236 4 clobber1
245 237 3 clobber2
246 238 2 adddb
247 239 1 branch
248 240 0 clobberdir
249 241
250 242
251 243 $ cd ..
@@ -1,436 +1,432 b''
1 1 $ "$TESTDIR/hghave" svn13 || exit 80
2 2
3 $ fixpath()
4 > {
5 > tr '\\' /
6 > }
7 3 $ svnupanddisplay()
8 4 > {
9 5 > (
10 6 > cd $1;
11 7 > svn up -q;
12 > svn st -v | fixpath | sed 's/ */ /g' | sort
8 > svn st -v | sed 's/ */ /g' | sort
13 9 > limit=''
14 10 > if [ $2 -gt 0 ]; then
15 11 > limit="--limit=$2"
16 12 > fi
17 13 > svn log --xml -v $limit | python "$TESTDIR/svnxml.py"
18 14 > )
19 15 > }
20 16
21 17 $ cat >> $HGRCPATH <<EOF
22 18 > [extensions]
23 19 > convert =
24 20 > graphlog =
25 21 > EOF
26 22
27 23 $ hg init a
28 24
29 25 Add
30 26
31 27 $ echo a > a/a
32 28 $ mkdir -p a/d1/d2
33 29 $ echo b > a/d1/d2/b
34 30 $ hg --cwd a ci -d '0 0' -A -m 'add a file'
35 31 adding a
36 32 adding d1/d2/b
37 33
38 34 Modify
39 35
40 36 $ "$TESTDIR/svn-safe-append.py" a a/a
41 37 $ hg --cwd a ci -d '1 0' -m 'modify a file'
42 38 $ hg --cwd a tip -q
43 39 1:e0e2b8a9156b
44 40
45 41 $ hg convert -d svn a
46 42 assuming destination a-hg
47 43 initializing svn repository 'a-hg'
48 44 initializing svn working copy 'a-hg-wc'
49 45 scanning source...
50 46 sorting...
51 47 converting...
52 48 1 add a file
53 49 0 modify a file
54 50 $ svnupanddisplay a-hg-wc 2
55 51 2 1 test d1
56 52 2 1 test d1/d2
57 53 2 1 test d1/d2/b
58 54 2 2 test .
59 55 2 2 test a
60 56 revision: 2
61 57 author: test
62 58 msg: modify a file
63 59 M /a
64 60 revision: 1
65 61 author: test
66 62 msg: add a file
67 63 A /a
68 64 A /d1
69 65 A /d1/d2
70 66 A /d1/d2/b
71 67 $ ls a a-hg-wc
72 68 a:
73 69 a
74 70 d1
75 71
76 72 a-hg-wc:
77 73 a
78 74 d1
79 75 $ cmp a/a a-hg-wc/a
80 76
81 77 Rename
82 78
83 79 $ hg --cwd a mv a b
84 80 $ hg --cwd a ci -d '2 0' -m 'rename a file'
85 81 $ hg --cwd a tip -q
86 82 2:eb5169441d43
87 83
88 84 $ hg convert -d svn a
89 85 assuming destination a-hg
90 86 initializing svn working copy 'a-hg-wc'
91 87 scanning source...
92 88 sorting...
93 89 converting...
94 90 0 rename a file
95 91 $ svnupanddisplay a-hg-wc 1
96 92 3 1 test d1
97 93 3 1 test d1/d2
98 94 3 1 test d1/d2/b
99 95 3 3 test .
100 96 3 3 test b
101 97 revision: 3
102 98 author: test
103 99 msg: rename a file
104 100 D /a
105 101 A /b (from /a@2)
106 102 $ ls a a-hg-wc
107 103 a:
108 104 b
109 105 d1
110 106
111 107 a-hg-wc:
112 108 b
113 109 d1
114 110
115 111 Copy
116 112
117 113 $ hg --cwd a cp b c
118 114
119 115 $ hg --cwd a ci -d '3 0' -m 'copy a file'
120 116 $ hg --cwd a tip -q
121 117 3:60effef6ab48
122 118
123 119 $ hg convert -d svn a
124 120 assuming destination a-hg
125 121 initializing svn working copy 'a-hg-wc'
126 122 scanning source...
127 123 sorting...
128 124 converting...
129 125 0 copy a file
130 126 $ svnupanddisplay a-hg-wc 1
131 127 4 1 test d1
132 128 4 1 test d1/d2
133 129 4 1 test d1/d2/b
134 130 4 3 test b
135 131 4 4 test .
136 132 4 4 test c
137 133 revision: 4
138 134 author: test
139 135 msg: copy a file
140 136 A /c (from /b@3)
141 137 $ ls a a-hg-wc
142 138 a:
143 139 b
144 140 c
145 141 d1
146 142
147 143 a-hg-wc:
148 144 b
149 145 c
150 146 d1
151 147
152 148 $ hg --cwd a rm b
153 149
154 150 Remove
155 151
156 152 $ hg --cwd a ci -d '4 0' -m 'remove a file'
157 153 $ hg --cwd a tip -q
158 154 4:87bbe3013fb6
159 155
160 156 $ hg convert -d svn a
161 157 assuming destination a-hg
162 158 initializing svn working copy 'a-hg-wc'
163 159 scanning source...
164 160 sorting...
165 161 converting...
166 162 0 remove a file
167 163 $ svnupanddisplay a-hg-wc 1
168 164 5 1 test d1
169 165 5 1 test d1/d2
170 166 5 1 test d1/d2/b
171 167 5 4 test c
172 168 5 5 test .
173 169 revision: 5
174 170 author: test
175 171 msg: remove a file
176 172 D /b
177 173 $ ls a a-hg-wc
178 174 a:
179 175 c
180 176 d1
181 177
182 178 a-hg-wc:
183 179 c
184 180 d1
185 181
186 182 Executable
187 183
188 184 #if execbit
189 185 $ chmod +x a/c
190 186 #else
191 187 $ echo fake >> a/c
192 188 #endif
193 189 $ hg --cwd a ci -d '5 0' -m 'make a file executable'
194 190 #if execbit
195 191 $ hg --cwd a tip -q
196 192 5:ff42e473c340
197 193 #else
198 194 $ hg --cwd a tip -q
199 195 5:817a700c8cf1
200 196 #endif
201 197
202 198 $ hg convert -d svn a
203 199 assuming destination a-hg
204 200 initializing svn working copy 'a-hg-wc'
205 201 scanning source...
206 202 sorting...
207 203 converting...
208 204 0 make a file executable
209 205 $ svnupanddisplay a-hg-wc 1
210 206 6 1 test d1
211 207 6 1 test d1/d2
212 208 6 1 test d1/d2/b
213 209 6 6 test .
214 210 6 6 test c
215 211 revision: 6
216 212 author: test
217 213 msg: make a file executable
218 214 M /c
219 215 #if execbit
220 216 $ test -x a-hg-wc/c
221 217 #endif
222 218
223 219 #if symlink
224 220
225 221 Symlinks
226 222
227 223 $ ln -s a/missing a/link
228 224 $ hg --cwd a commit -Am 'add symlink'
229 225 adding link
230 226 $ hg --cwd a mv link newlink
231 227 $ hg --cwd a commit -m 'move symlink'
232 228 $ hg convert -d svn a
233 229 assuming destination a-hg
234 230 initializing svn working copy 'a-hg-wc'
235 231 scanning source...
236 232 sorting...
237 233 converting...
238 234 1 add symlink
239 235 0 move symlink
240 236 $ svnupanddisplay a-hg-wc 1
241 237 8 1 test d1
242 238 8 1 test d1/d2
243 239 8 1 test d1/d2/b
244 240 8 6 test c
245 241 8 8 test .
246 242 8 8 test newlink
247 243 revision: 8
248 244 author: test
249 245 msg: move symlink
250 246 D /link
251 247 A /newlink (from /link@7)
252 248
253 249 #endif
254 250
255 251 $ rm -rf a a-hg a-hg-wc
256 252
257 253
258 254 Executable in new directory
259 255
260 256 $ hg init a
261 257
262 258 $ mkdir a/d1
263 259 $ echo a > a/d1/a
264 260 #if execbit
265 261 $ chmod +x a/d1/a
266 262 #else
267 263 $ echo fake >> a/d1/a
268 264 #endif
269 265 $ hg --cwd a ci -d '0 0' -A -m 'add executable file in new directory'
270 266 adding d1/a
271 267
272 268 $ hg convert -d svn a
273 269 assuming destination a-hg
274 270 initializing svn repository 'a-hg'
275 271 initializing svn working copy 'a-hg-wc'
276 272 scanning source...
277 273 sorting...
278 274 converting...
279 275 0 add executable file in new directory
280 276 $ svnupanddisplay a-hg-wc 1
281 277 1 1 test .
282 278 1 1 test d1
283 279 1 1 test d1/a
284 280 revision: 1
285 281 author: test
286 282 msg: add executable file in new directory
287 283 A /d1
288 284 A /d1/a
289 285 #if execbit
290 286 $ test -x a-hg-wc/d1/a
291 287 #endif
292 288
293 289 Copy to new directory
294 290
295 291 $ mkdir a/d2
296 292 $ hg --cwd a cp d1/a d2/a
297 293 $ hg --cwd a ci -d '1 0' -A -m 'copy file to new directory'
298 294
299 295 $ hg convert -d svn a
300 296 assuming destination a-hg
301 297 initializing svn working copy 'a-hg-wc'
302 298 scanning source...
303 299 sorting...
304 300 converting...
305 301 0 copy file to new directory
306 302 $ svnupanddisplay a-hg-wc 1
307 303 2 1 test d1
308 304 2 1 test d1/a
309 305 2 2 test .
310 306 2 2 test d2
311 307 2 2 test d2/a
312 308 revision: 2
313 309 author: test
314 310 msg: copy file to new directory
315 311 A /d2
316 312 A /d2/a (from /d1/a@1)
317 313
318 314 Branchy history
319 315
320 316 $ hg init b
321 317 $ echo base > b/b
322 318 $ hg --cwd b ci -d '0 0' -Ambase
323 319 adding b
324 320
325 321 $ "$TESTDIR/svn-safe-append.py" left-1 b/b
326 322 $ echo left-1 > b/left-1
327 323 $ hg --cwd b ci -d '1 0' -Amleft-1
328 324 adding left-1
329 325
330 326 $ "$TESTDIR/svn-safe-append.py" left-2 b/b
331 327 $ echo left-2 > b/left-2
332 328 $ hg --cwd b ci -d '2 0' -Amleft-2
333 329 adding left-2
334 330
335 331 $ hg --cwd b up 0
336 332 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
337 333
338 334 $ "$TESTDIR/svn-safe-append.py" right-1 b/b
339 335 $ echo right-1 > b/right-1
340 336 $ hg --cwd b ci -d '3 0' -Amright-1
341 337 adding right-1
342 338 created new head
343 339
344 340 $ "$TESTDIR/svn-safe-append.py" right-2 b/b
345 341 $ echo right-2 > b/right-2
346 342 $ hg --cwd b ci -d '4 0' -Amright-2
347 343 adding right-2
348 344
349 345 $ hg --cwd b up -C 2
350 346 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
351 347 $ hg --cwd b merge
352 348 merging b
353 349 warning: conflicts during merge.
354 350 merging b incomplete! (edit conflicts, then use 'hg resolve --mark')
355 351 2 files updated, 0 files merged, 0 files removed, 1 files unresolved
356 352 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
357 353 [1]
358 354 $ hg --cwd b revert -r 2 b
359 355 $ hg --cwd b resolve -m b
360 356 $ hg --cwd b ci -d '5 0' -m 'merge'
361 357
362 358 Expect 4 changes
363 359
364 360 $ hg convert -d svn b
365 361 assuming destination b-hg
366 362 initializing svn repository 'b-hg'
367 363 initializing svn working copy 'b-hg-wc'
368 364 scanning source...
369 365 sorting...
370 366 converting...
371 367 5 base
372 368 4 left-1
373 369 3 left-2
374 370 2 right-1
375 371 1 right-2
376 372 0 merge
377 373
378 374 $ svnupanddisplay b-hg-wc 0
379 375 4 2 test left-1
380 376 4 3 test b
381 377 4 3 test left-2
382 378 4 4 test .
383 379 4 4 test right-1
384 380 4 4 test right-2
385 381 revision: 4
386 382 author: test
387 383 msg: merge
388 384 A /right-1
389 385 A /right-2
390 386 revision: 3
391 387 author: test
392 388 msg: left-2
393 389 M /b
394 390 A /left-2
395 391 revision: 2
396 392 author: test
397 393 msg: left-1
398 394 M /b
399 395 A /left-1
400 396 revision: 1
401 397 author: test
402 398 msg: base
403 399 A /b
404 400
405 401 Tags are not supported, but must not break conversion
406 402
407 403 $ rm -rf a a-hg a-hg-wc
408 404 $ hg init a
409 405 $ echo a > a/a
410 406 $ hg --cwd a ci -d '0 0' -A -m 'Add file a'
411 407 adding a
412 408 $ hg --cwd a tag -d '1 0' -m 'Tagged as v1.0' v1.0
413 409
414 410 $ hg convert -d svn a
415 411 assuming destination a-hg
416 412 initializing svn repository 'a-hg'
417 413 initializing svn working copy 'a-hg-wc'
418 414 scanning source...
419 415 sorting...
420 416 converting...
421 417 1 Add file a
422 418 0 Tagged as v1.0
423 419 writing Subversion tags is not yet implemented
424 420 $ svnupanddisplay a-hg-wc 2
425 421 2 1 test a
426 422 2 2 test .
427 423 2 2 test .hgtags
428 424 revision: 2
429 425 author: test
430 426 msg: Tagged as v1.0
431 427 A /.hgtags
432 428 revision: 1
433 429 author: test
434 430 msg: Add file a
435 431 A /a
436 432 $ rm -rf a a-hg a-hg-wc
@@ -1,210 +1,203 b''
1 1
2 2 $ "$TESTDIR/hghave" svn svn-bindings || exit 80
3 3
4 $ fixpath()
5 > {
6 > tr '\\' /
7 > }
8 4 $ cat >> $HGRCPATH <<EOF
9 5 > [extensions]
10 6 > convert =
11 7 > graphlog =
12 8 > [convert]
13 9 > svn.trunk = mytrunk
14 10 > EOF
15 11
16 12 $ svnadmin create svn-repo
17 $ svnpath=`pwd | fixpath`
18
19
20 $ expr "$svnpath" : "\/" > /dev/null
21 > if [ $? -ne 0 ]; then
22 > svnpath="/$svnpath"
23 > fi
24 > svnurl="file://$svnpath/svn-repo"
13 $ SVNREPOPATH=`pwd`/svn-repo
14 #if windows
15 $ SVNREPOURL=file:///`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
16 #else
17 $ SVNREPOURL=file://`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
18 #endif
25 19
26 20 Now test that it works with trunk/tags layout, but no branches yet.
27 21
28 22 Initial svn import
29 23
30 24 $ mkdir projB
31 25 $ cd projB
32 26 $ mkdir mytrunk
33 27 $ mkdir tags
34 28 $ cd ..
35 29
36 $ svnurl="file://$svnpath/svn-repo/proj%20B"
37 $ svn import -m "init projB" projB "$svnurl" | fixpath | sort
30 $ svn import -m "init projB" projB "$SVNREPOURL/proj%20B" | sort
38 31
39 32 Adding projB/mytrunk
40 33 Adding projB/tags
41 34 Committed revision 1.
42 35
43 36 Update svn repository
44 37
45 $ svn co "$svnurl"/mytrunk B | fixpath
38 $ svn co "$SVNREPOURL/proj%20B/mytrunk" B
46 39 Checked out revision 1.
47 40 $ cd B
48 41 $ echo hello > 'letter .txt'
49 42 $ svn add 'letter .txt'
50 43 A letter .txt
51 44 $ svn ci -m hello
52 45 Adding letter .txt
53 46 Transmitting file data .
54 47 Committed revision 2.
55 48
56 49 $ "$TESTDIR/svn-safe-append.py" world 'letter .txt'
57 50 $ svn ci -m world
58 51 Sending letter .txt
59 52 Transmitting file data .
60 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 57 Committed revision 4.
65 58
66 59 $ "$TESTDIR/svn-safe-append.py" 'nice day today!' 'letter .txt'
67 60 $ svn ci -m "nice day"
68 61 Sending letter .txt
69 62 Transmitting file data .
70 63 Committed revision 5.
71 64 $ cd ..
72 65
73 66 Convert to hg once
74 67
75 $ hg convert "$svnurl" B-hg
68 $ hg convert "$SVNREPOURL/proj%20B" B-hg
76 69 initializing destination B-hg repository
77 70 scanning source...
78 71 sorting...
79 72 converting...
80 73 3 init projB
81 74 2 hello
82 75 1 world
83 76 0 nice day
84 77 updating tags
85 78
86 79 Update svn repository again
87 80
88 81 $ cd B
89 82 $ "$TESTDIR/svn-safe-append.py" "see second letter" 'letter .txt'
90 83 $ echo "nice to meet you" > letter2.txt
91 84 $ svn add letter2.txt
92 85 A letter2.txt
93 86 $ svn ci -m "second letter"
94 87 Sending letter .txt
95 88 Adding letter2.txt
96 89 Transmitting file data ..
97 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 94 Committed revision 7.
102 95
103 96 $ "$TESTDIR/svn-safe-append.py" "blah-blah-blah" letter2.txt
104 97 $ svn ci -m "work in progress"
105 98 Sending letter2.txt
106 99 Transmitting file data .
107 100 Committed revision 8.
108 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 104 initializing destination dest repository
112 105 abort: no revision found in module /proj B/non-existent-path
113 106 [255]
114 107
115 108 ########################################
116 109
117 110 Test incremental conversion
118 111
119 $ hg convert "$svnurl" B-hg
112 $ hg convert "$SVNREPOURL/proj%20B" B-hg
120 113 scanning source...
121 114 sorting...
122 115 converting...
123 116 1 second letter
124 117 0 work in progress
125 118 updating tags
126 119
127 120 $ cd B-hg
128 121 $ hg glog --template '{rev} {desc|firstline} files: {files}\n'
129 122 o 7 update tags files: .hgtags
130 123 |
131 124 o 6 work in progress files: letter2.txt
132 125 |
133 126 o 5 second letter files: letter .txt letter2.txt
134 127 |
135 128 o 4 update tags files: .hgtags
136 129 |
137 130 o 3 nice day files: letter .txt
138 131 |
139 132 o 2 world files: letter .txt
140 133 |
141 134 o 1 hello files: letter .txt
142 135 |
143 136 o 0 init projB files:
144 137
145 138 $ hg tags -q
146 139 tip
147 140 v0.2
148 141 v0.1
149 142 $ cd ..
150 143
151 144 Test filemap
152 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 147 initializing destination fmap repository
155 148 scanning source...
156 149 sorting...
157 150 converting...
158 151 5 init projB
159 152 4 hello
160 153 3 world
161 154 2 nice day
162 155 1 second letter
163 156 0 work in progress
164 157 $ hg -R fmap branch -q
165 158 default
166 159 $ hg glog -R fmap --template '{rev} {desc|firstline} files: {files}\n'
167 160 o 1 work in progress files: letter2.txt
168 161 |
169 162 o 0 second letter files: letter2.txt
170 163
171 164
172 165 Test stop revision
173 $ hg convert --rev 1 "$svnurl"/mytrunk stoprev
166 $ hg convert --rev 1 "$SVNREPOURL/proj%20B/mytrunk" stoprev
174 167 initializing destination stoprev repository
175 168 scanning source...
176 169 sorting...
177 170 converting...
178 171 0 init projB
179 172 $ hg -R stoprev branch -q
180 173 default
181 174
182 175 Check convert_revision extra-records.
183 176 This is also the only place testing more than one extra field in a revision.
184 177
185 178 $ cd stoprev
186 179 $ hg tip --debug | grep extra
187 180 extra: branch=default
188 181 extra: convert_revision=svn:........-....-....-....-............/proj B/mytrunk@1 (re)
189 182 $ cd ..
190 183
191 184 Test converting empty heads (issue3347)
192 185
193 186 $ svnadmin create svn-empty
194 187 $ svnadmin load -q svn-empty < "$TESTDIR/svn/empty.svndump"
195 188 $ hg --config convert.svn.trunk= convert svn-empty
196 189 assuming destination svn-empty-hg
197 190 initializing destination svn-empty-hg repository
198 191 scanning source...
199 192 sorting...
200 193 converting...
201 194 1 init projA
202 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 197 assuming destination trunk-hg
205 198 initializing destination trunk-hg repository
206 199 scanning source...
207 200 sorting...
208 201 converting...
209 202 1 init projA
210 203 0 adddir
@@ -1,52 +1,54 b''
1 1 $ "$TESTDIR/hghave" svn13 || exit 80
2 2
3 3 $ echo "[extensions]" >> $HGRCPATH
4 4 $ echo "mq=" >> $HGRCPATH
5 5 $ echo "[diff]" >> $HGRCPATH
6 6 $ echo "nodates=1" >> $HGRCPATH
7 7
8 8 fn to create new repository, and cd into it
9 9 $ mkrepo() {
10 10 > hg init $1
11 11 > cd $1
12 12 > hg qinit
13 13 > }
14 14
15 15
16 16 handle svn subrepos safely
17 17
18 18 $ svnadmin create svn-repo-2499
19 $ curpath=`pwd | tr '\\\\' /`
20 $ expr "$svnpath" : "\/" > /dev/null
21 > if [ $? -ne 0 ]; then
22 > curpath="/$curpath"
23 > fi
24 $ svnurl="file://$curpath/svn-repo-2499/project"
19
20 $ SVNREPOPATH=`pwd`/svn-repo-2499/project
21 #if windows
22 $ SVNREPOURL=file:///`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
23 #else
24 $ SVNREPOURL=file://`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
25 #endif
26
25 27 $ mkdir -p svn-project-2499/trunk
26 $ svn import -m 'init project' svn-project-2499 "$svnurl"
28 $ svn import -m 'init project' svn-project-2499 "$SVNREPOURL"
27 29 Adding svn-project-2499/trunk (glob)
28 30
29 31 Committed revision 1.
30 32
31 33 qnew on repo w/svn subrepo
32 34 $ mkrepo repo-2499-svn-subrepo
33 $ svn co "$svnurl"/trunk sub
35 $ svn co "$SVNREPOURL"/trunk sub
34 36 Checked out revision 1.
35 37 $ echo 'sub = [svn]sub' >> .hgsub
36 38 $ hg add .hgsub
37 39 $ hg status -S -X '**/format'
38 40 A .hgsub
39 41 $ hg qnew -m0 0.diff
40 42 $ cd sub
41 43 $ echo a > a
42 44 $ svn add a
43 45 A a
44 46 $ svn st
45 47 A* a (glob)
46 48 $ cd ..
47 49 $ hg status -S # doesn't show status for svn subrepos (yet)
48 50 $ hg qnew -m1 1.diff
49 51 abort: uncommitted changes in subrepository sub
50 52 [255]
51 53
52 54 $ cd ..
@@ -1,609 +1,603 b''
1 1 $ "$TESTDIR/hghave" svn15 || exit 80
2 2
3 $ fix_path()
4 > {
5 > tr '\\' /
6 > }
7
8 SVN wants all paths to start with a slash. Unfortunately, Windows ones
9 don't. Handle that.
10
11 $ escapedwd=`pwd | fix_path`
12 $ expr "$escapedwd" : '\/' > /dev/null || escapedwd="/$escapedwd"
13 $ escapedwd=`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$escapedwd"`
3 $ SVNREPOPATH=`pwd`/svn-repo
4 #if windows
5 $ SVNREPOURL=file:///`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
6 #else
7 $ SVNREPOURL=file://`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
8 #endif
14 9
15 10 create subversion repo
16 11
17 $ SVNREPO="file://$escapedwd/svn-repo"
18 12 $ WCROOT="`pwd`/svn-wc"
19 13 $ svnadmin create svn-repo
20 $ svn co "$SVNREPO" svn-wc
14 $ svn co "$SVNREPOURL" svn-wc
21 15 Checked out revision 0.
22 16 $ cd svn-wc
23 17 $ mkdir src
24 18 $ echo alpha > src/alpha
25 19 $ svn add src
26 20 A src
27 21 A src/alpha (glob)
28 22 $ mkdir externals
29 23 $ echo other > externals/other
30 24 $ svn add externals
31 25 A externals
32 26 A externals/other (glob)
33 27 $ svn ci -m 'Add alpha'
34 28 Adding externals
35 29 Adding externals/other (glob)
36 30 Adding src
37 31 Adding src/alpha (glob)
38 32 Transmitting file data ..
39 33 Committed revision 1.
40 34 $ svn up -q
41 $ echo "externals -r1 $SVNREPO/externals" > extdef
35 $ echo "externals -r1 $SVNREPOURL/externals" > extdef
42 36 $ svn propset -F extdef svn:externals src
43 37 property 'svn:externals' set on 'src'
44 38 $ svn ci -m 'Setting externals'
45 39 Sending src
46 40
47 41 Committed revision 2.
48 42 $ cd ..
49 43
50 44 create hg repo
51 45
52 46 $ mkdir sub
53 47 $ cd sub
54 48 $ hg init t
55 49 $ cd t
56 50
57 51 first revision, no sub
58 52
59 53 $ echo a > a
60 54 $ hg ci -Am0
61 55 adding a
62 56
63 57 add first svn sub with leading whitespaces
64 58
65 $ echo "s = [svn] $SVNREPO/src" >> .hgsub
66 $ echo "subdir/s = [svn] $SVNREPO/src" >> .hgsub
67 $ svn co --quiet "$SVNREPO"/src s
59 $ echo "s = [svn] $SVNREPOURL/src" >> .hgsub
60 $ echo "subdir/s = [svn] $SVNREPOURL/src" >> .hgsub
61 $ svn co --quiet "$SVNREPOURL"/src s
68 62 $ mkdir subdir
69 $ svn co --quiet "$SVNREPO"/src subdir/s
63 $ svn co --quiet "$SVNREPOURL"/src subdir/s
70 64 $ hg add .hgsub
71 65 $ hg ci -m1
72 66
73 67 make sure we avoid empty commits (issue2445)
74 68
75 69 $ hg sum
76 70 parent: 1:* tip (glob)
77 71 1
78 72 branch: default
79 73 commit: (clean)
80 74 update: (current)
81 75 $ hg ci -moops
82 76 nothing changed
83 77 [1]
84 78
85 79 debugsub
86 80
87 81 $ hg debugsub
88 82 path s
89 83 source file://*/svn-repo/src (glob)
90 84 revision 2
91 85 path subdir/s
92 86 source file://*/svn-repo/src (glob)
93 87 revision 2
94 88
95 89 change file in svn and hg, commit
96 90
97 91 $ echo a >> a
98 92 $ echo alpha >> s/alpha
99 93 $ hg sum
100 94 parent: 1:* tip (glob)
101 95 1
102 96 branch: default
103 97 commit: 1 modified, 1 subrepos
104 98 update: (current)
105 99 $ hg commit --subrepos -m 'Message!' | grep -v Updating
106 100 committing subrepository s
107 101 Sending*s/alpha (glob)
108 102 Transmitting file data .
109 103 Committed revision 3.
110 104
111 105 Fetching external item into '*s/externals'* (glob)
112 106 External at revision 1.
113 107
114 108 At revision 3.
115 109 $ hg debugsub
116 110 path s
117 111 source file://*/svn-repo/src (glob)
118 112 revision 3
119 113 path subdir/s
120 114 source file://*/svn-repo/src (glob)
121 115 revision 2
122 116
123 117 missing svn file, commit should fail
124 118
125 119 $ rm s/alpha
126 120 $ hg commit --subrepos -m 'abort on missing file'
127 121 committing subrepository s
128 122 abort: cannot commit missing svn entries
129 123 [255]
130 124 $ svn revert s/alpha > /dev/null
131 125
132 126 add an unrelated revision in svn and update the subrepo to without
133 127 bringing any changes.
134 128
135 $ svn mkdir "$SVNREPO/unrelated" -m 'create unrelated'
129 $ svn mkdir "$SVNREPOURL/unrelated" -m 'create unrelated'
136 130
137 131 Committed revision 4.
138 132 $ svn up -q s
139 133 $ hg sum
140 134 parent: 2:* tip (glob)
141 135 Message!
142 136 branch: default
143 137 commit: (clean)
144 138 update: (current)
145 139
146 140 $ echo a > s/a
147 141
148 142 should be empty despite change to s/a
149 143
150 144 $ hg st
151 145
152 146 add a commit from svn
153 147
154 $ cd "$WCROOT"/src
148 $ cd "$WCROOT/src"
155 149 $ svn up -q
156 150 $ echo xyz >> alpha
157 151 $ svn propset svn:mime-type 'text/xml' alpha
158 152 property 'svn:mime-type' set on 'alpha'
159 153 $ svn ci -m 'amend a from svn'
160 154 Sending *alpha (glob)
161 155 Transmitting file data .
162 156 Committed revision 5.
163 157 $ cd ../../sub/t
164 158
165 159 this commit from hg will fail
166 160
167 161 $ echo zzz >> s/alpha
168 162 $ (hg ci --subrepos -m 'amend alpha from hg' 2>&1; echo "[$?]") | grep -vi 'out of date'
169 163 committing subrepository s
170 164 abort: svn:*Commit failed (details follow): (glob)
171 165 [255]
172 166 $ svn revert -q s/alpha
173 167
174 168 this commit fails because of meta changes
175 169
176 170 $ svn propset svn:mime-type 'text/html' s/alpha
177 171 property 'svn:mime-type' set on 's/alpha' (glob)
178 172 $ (hg ci --subrepos -m 'amend alpha from hg' 2>&1; echo "[$?]") | grep -vi 'out of date'
179 173 committing subrepository s
180 174 abort: svn:*Commit failed (details follow): (glob)
181 175 [255]
182 176 $ svn revert -q s/alpha
183 177
184 178 this commit fails because of externals changes
185 179
186 180 $ echo zzz > s/externals/other
187 181 $ hg ci --subrepos -m 'amend externals from hg'
188 182 committing subrepository s
189 183 abort: cannot commit svn externals
190 184 [255]
191 185 $ hg diff --subrepos -r 1:2 | grep -v diff
192 186 --- a/.hgsubstate Thu Jan 01 00:00:00 1970 +0000
193 187 +++ b/.hgsubstate Thu Jan 01 00:00:00 1970 +0000
194 188 @@ -1,2 +1,2 @@
195 189 -2 s
196 190 +3 s
197 191 2 subdir/s
198 192 --- a/a Thu Jan 01 00:00:00 1970 +0000
199 193 +++ b/a Thu Jan 01 00:00:00 1970 +0000
200 194 @@ -1,1 +1,2 @@
201 195 a
202 196 +a
203 197 $ svn revert -q s/externals/other
204 198
205 199 this commit fails because of externals meta changes
206 200
207 201 $ svn propset svn:mime-type 'text/html' s/externals/other
208 202 property 'svn:mime-type' set on 's/externals/other' (glob)
209 203 $ hg ci --subrepos -m 'amend externals from hg'
210 204 committing subrepository s
211 205 abort: cannot commit svn externals
212 206 [255]
213 207 $ svn revert -q s/externals/other
214 208
215 209 clone
216 210
217 211 $ cd ..
218 $ hg clone t tc | fix_path
212 $ hg clone t tc
219 213 updating to branch default
220 A tc/s/alpha
221 U tc/s
214 A tc/s/alpha (glob)
215 U tc/s (glob)
222 216
223 217 Fetching external item into 'tc/s/externals'* (glob)
224 A tc/s/externals/other
218 A tc/s/externals/other (glob)
225 219 Checked out external at revision 1.
226 220
227 221 Checked out revision 3.
228 A tc/subdir/s/alpha
229 U tc/subdir/s
222 A tc/subdir/s/alpha (glob)
223 U tc/subdir/s (glob)
230 224
231 225 Fetching external item into 'tc/subdir/s/externals'* (glob)
232 A tc/subdir/s/externals/other
226 A tc/subdir/s/externals/other (glob)
233 227 Checked out external at revision 1.
234 228
235 229 Checked out revision 2.
236 230 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
237 231 $ cd tc
238 232
239 233 debugsub in clone
240 234
241 235 $ hg debugsub
242 236 path s
243 237 source file://*/svn-repo/src (glob)
244 238 revision 3
245 239 path subdir/s
246 240 source file://*/svn-repo/src (glob)
247 241 revision 2
248 242
249 243 verify subrepo is contained within the repo directory
250 244
251 245 $ python -c "import os.path; print os.path.exists('s')"
252 246 True
253 247
254 248 update to nullrev (must delete the subrepo)
255 249
256 250 $ hg up null
257 251 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
258 252 $ ls
259 253
260 254 Check hg update --clean
261 $ cd $TESTTMP/sub/t
255 $ cd "$TESTTMP/sub/t"
262 256 $ cd s
263 257 $ echo c0 > alpha
264 258 $ echo c1 > f1
265 259 $ echo c1 > f2
266 260 $ svn add f1 -q
267 261 $ svn status | sort
268 262
269 263 ? * a (glob)
270 264 ? * f2 (glob)
271 265 A * f1 (glob)
272 266 M * alpha (glob)
273 267 Performing status on external item at 'externals'* (glob)
274 268 X * externals (glob)
275 269 $ cd ../..
276 270 $ hg -R t update -C
277 271
278 272 Fetching external item into 't/s/externals'* (glob)
279 273 Checked out external at revision 1.
280 274
281 275 Checked out revision 3.
282 276 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
283 277 $ cd t/s
284 278 $ svn status | sort
285 279
286 280 ? * a (glob)
287 281 ? * f1 (glob)
288 282 ? * f2 (glob)
289 283 Performing status on external item at 'externals'* (glob)
290 284 X * externals (glob)
291 285
292 286 Sticky subrepositories, no changes
293 $ cd $TESTTMP/sub/t
287 $ cd "$TESTTMP/sub/t"
294 288 $ hg id -n
295 289 2
296 290 $ cd s
297 291 $ svnversion
298 292 3
299 293 $ cd ..
300 294 $ hg update 1
301 295 U *s/alpha (glob)
302 296
303 297 Fetching external item into '*s/externals'* (glob)
304 298 Checked out external at revision 1.
305 299
306 300 Checked out revision 2.
307 301 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
308 302 $ hg id -n
309 303 1
310 304 $ cd s
311 305 $ svnversion
312 306 2
313 307 $ cd ..
314 308
315 309 Sticky subrepositorys, file changes
316 310 $ touch s/f1
317 311 $ cd s
318 312 $ svn add f1
319 313 A f1
320 314 $ cd ..
321 315 $ hg id -n
322 316 1
323 317 $ cd s
324 318 $ svnversion
325 319 2M
326 320 $ cd ..
327 321 $ hg update tip
328 322 subrepository sources for s differ
329 323 use (l)ocal source (2) or (r)emote source (3)?
330 324 l
331 325 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
332 326 $ hg id -n
333 327 2+
334 328 $ cd s
335 329 $ svnversion
336 330 2M
337 331 $ cd ..
338 332 $ hg update --clean tip
339 333 U *s/alpha (glob)
340 334
341 335 Fetching external item into '*s/externals'* (glob)
342 336 Checked out external at revision 1.
343 337
344 338 Checked out revision 3.
345 339 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
346 340
347 341 Sticky subrepository, revision updates
348 342 $ hg id -n
349 343 2
350 344 $ cd s
351 345 $ svnversion
352 346 3
353 347 $ cd ..
354 348 $ cd s
355 349 $ svn update -qr 1
356 350 $ cd ..
357 351 $ hg update 1
358 352 subrepository sources for s differ (in checked out version)
359 353 use (l)ocal source (1) or (r)emote source (2)?
360 354 l
361 355 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
362 356 $ hg id -n
363 357 1+
364 358 $ cd s
365 359 $ svnversion
366 360 1
367 361 $ cd ..
368 362
369 363 Sticky subrepository, file changes and revision updates
370 364 $ touch s/f1
371 365 $ cd s
372 366 $ svn add f1
373 367 A f1
374 368 $ svnversion
375 369 1M
376 370 $ cd ..
377 371 $ hg id -n
378 372 1+
379 373 $ hg update tip
380 374 subrepository sources for s differ
381 375 use (l)ocal source (1) or (r)emote source (3)?
382 376 l
383 377 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
384 378 $ hg id -n
385 379 2
386 380 $ cd s
387 381 $ svnversion
388 382 1M
389 383 $ cd ..
390 384
391 385 Sticky repository, update --clean
392 386 $ hg update --clean tip | grep -v 's[/\]externals[/\]other'
393 387 U *s/alpha (glob)
394 388 U *s (glob)
395 389
396 390 Fetching external item into '*s/externals'* (glob)
397 391 Checked out external at revision 1.
398 392
399 393 Checked out revision 3.
400 394 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
401 395 $ hg id -n
402 396 2
403 397 $ cd s
404 398 $ svnversion
405 399 3
406 400 $ cd ..
407 401
408 402 Test subrepo already at intended revision:
409 403 $ cd s
410 404 $ svn update -qr 2
411 405 $ cd ..
412 406 $ hg update 1
413 407 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
414 408 $ hg id -n
415 409 1+
416 410 $ cd s
417 411 $ svnversion
418 412 2
419 413 $ cd ..
420 414
421 415 Test case where subversion would fail to update the subrepo because there
422 416 are unknown directories being replaced by tracked ones (happens with rebase).
423 417
424 $ cd $WCROOT/src
418 $ cd "$WCROOT/src"
425 419 $ mkdir dir
426 420 $ echo epsilon.py > dir/epsilon.py
427 421 $ svn add dir
428 422 A dir
429 423 A dir/epsilon.py (glob)
430 424 $ svn ci -m 'Add dir/epsilon.py'
431 425 Adding *dir (glob)
432 426 Adding *dir/epsilon.py (glob)
433 427 Transmitting file data .
434 428 Committed revision 6.
435 429 $ cd ../..
436 430 $ hg init rebaserepo
437 431 $ cd rebaserepo
438 $ svn co -r5 --quiet "$SVNREPO"/src s
439 $ echo "s = [svn] $SVNREPO/src" >> .hgsub
432 $ svn co -r5 --quiet "$SVNREPOURL"/src s
433 $ echo "s = [svn] $SVNREPOURL/src" >> .hgsub
440 434 $ hg add .hgsub
441 435 $ hg ci -m addsub
442 436 $ echo a > a
443 437 $ hg ci -Am adda
444 438 adding a
445 439 $ hg up 0
446 440 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
447 441 $ svn up -qr6 s
448 442 $ hg ci -m updatesub
449 443 created new head
450 444 $ echo pyc > s/dir/epsilon.pyc
451 445 $ hg up 1
452 446 D *s/dir (glob)
453 447
454 448 Fetching external item into '*s/externals'* (glob)
455 449 Checked out external at revision 1.
456 450
457 451 Checked out revision 5.
458 452 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
459 453 $ hg up -q 2
460 454
461 455 Modify one of the externals to point to a different path so we can
462 456 test having obstructions when switching branches on checkout:
463 457 $ hg checkout tip
464 458 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
465 $ echo "obstruct = [svn] $SVNREPO/externals" >> .hgsub
466 $ svn co -r5 --quiet "$SVNREPO"/externals obstruct
459 $ echo "obstruct = [svn] $SVNREPOURL/externals" >> .hgsub
460 $ svn co -r5 --quiet "$SVNREPOURL"/externals obstruct
467 461 $ hg commit -m 'Start making obstructed working copy'
468 462 $ hg book other
469 463 $ hg co -r 'p1(tip)'
470 464 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
471 $ echo "obstruct = [svn] $SVNREPO/src" >> .hgsub
472 $ svn co -r5 --quiet "$SVNREPO"/src obstruct
465 $ echo "obstruct = [svn] $SVNREPOURL/src" >> .hgsub
466 $ svn co -r5 --quiet "$SVNREPOURL"/src obstruct
473 467 $ hg commit -m 'Other branch which will be obstructed'
474 468 created new head
475 469
476 470 Switching back to the head where we have another path mapped to the
477 471 same subrepo should work if the subrepo is clean.
478 472 $ hg co other
479 473 A *obstruct/other (glob)
480 474 Checked out revision 1.
481 475 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
482 476
483 477 This is surprising, but is also correct based on the current code:
484 478 $ echo "updating should (maybe) fail" > obstruct/other
485 479 $ hg co tip
486 480 abort: crosses branches (merge branches or use --clean to discard changes)
487 481 [255]
488 482
489 483 Point to a Subversion branch which has since been deleted and recreated
490 484 First, create that condition in the repository.
491 485
492 486 $ hg ci --subrepos -m cleanup | grep -v Updating
493 487 committing subrepository obstruct
494 488 Sending obstruct/other (glob)
495 489 Transmitting file data .
496 490 Committed revision 7.
497 491 At revision 7.
498 $ svn mkdir -m "baseline" $SVNREPO/trunk
492 $ svn mkdir -m "baseline" $SVNREPOURL/trunk
499 493
500 494 Committed revision 8.
501 $ svn copy -m "initial branch" $SVNREPO/trunk $SVNREPO/branch
495 $ svn copy -m "initial branch" $SVNREPOURL/trunk $SVNREPOURL/branch
502 496
503 497 Committed revision 9.
504 $ svn co --quiet "$SVNREPO"/branch tempwc
498 $ svn co --quiet "$SVNREPOURL"/branch tempwc
505 499 $ cd tempwc
506 500 $ echo "something old" > somethingold
507 501 $ svn add somethingold
508 502 A somethingold
509 503 $ svn ci -m 'Something old'
510 504 Adding somethingold
511 505 Transmitting file data .
512 506 Committed revision 10.
513 $ svn rm -m "remove branch" $SVNREPO/branch
507 $ svn rm -m "remove branch" $SVNREPOURL/branch
514 508
515 509 Committed revision 11.
516 $ svn copy -m "recreate branch" $SVNREPO/trunk $SVNREPO/branch
510 $ svn copy -m "recreate branch" $SVNREPOURL/trunk $SVNREPOURL/branch
517 511
518 512 Committed revision 12.
519 513 $ svn up -q
520 514 $ echo "something new" > somethingnew
521 515 $ svn add somethingnew
522 516 A somethingnew
523 517 $ svn ci -m 'Something new'
524 518 Adding somethingnew
525 519 Transmitting file data .
526 520 Committed revision 13.
527 521 $ cd ..
528 522 $ rm -rf tempwc
529 $ svn co "$SVNREPO/branch"@10 recreated
523 $ svn co "$SVNREPOURL/branch"@10 recreated
530 524 A recreated/somethingold (glob)
531 525 Checked out revision 10.
532 $ echo "recreated = [svn] $SVNREPO/branch" >> .hgsub
526 $ echo "recreated = [svn] $SVNREPOURL/branch" >> .hgsub
533 527 $ hg ci -m addsub
534 528 $ cd recreated
535 529 $ svn up -q
536 530 $ cd ..
537 531 $ hg ci -m updatesub
538 532 $ hg up -r-2
539 533 D *recreated/somethingnew (glob)
540 534 A *recreated/somethingold (glob)
541 535 Checked out revision 10.
542 536 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
543 537 $ test -f recreated/somethingold
544 538
545 539 Test archive
546 540
547 541 $ hg archive -S ../archive-all --debug
548 542 archiving: 0/2 files (0.00%)
549 543 archiving: .hgsub 1/2 files (50.00%)
550 544 archiving: .hgsubstate 2/2 files (100.00%)
551 545 archiving (obstruct): 0/1 files (0.00%)
552 546 archiving (obstruct): 1/1 files (100.00%)
553 547 archiving (s): 0/2 files (0.00%)
554 548 archiving (s): 1/2 files (50.00%)
555 549 archiving (s): 2/2 files (100.00%)
556 550 archiving (recreated): 0/1 files (0.00%)
557 551 archiving (recreated): 1/1 files (100.00%)
558 552
559 553 Test forgetting files, not implemented in svn subrepo, used to
560 554 traceback
561 555
562 556 #if no-windows
563 557 $ hg forget 'notafile*'
564 558 notafile*: No such file or directory
565 559 [1]
566 560 #else
567 561 $ hg forget 'notafile'
568 562 notafile: * (glob)
569 563 [1]
570 564 #endif
571 565
572 566 Test a subrepo referencing a just moved svn path. Last commit rev will
573 567 be different from the revision, and the path will be different as
574 568 well.
575 569
576 $ cd $WCROOT
570 $ cd "$WCROOT"
577 571 $ svn up > /dev/null
578 572 $ mkdir trunk/subdir branches
579 573 $ echo a > trunk/subdir/a
580 574 $ svn add trunk/subdir branches
581 575 A trunk/subdir (glob)
582 576 A trunk/subdir/a (glob)
583 577 A branches
584 578 $ svn ci -m addsubdir
585 579 Adding branches
586 580 Adding trunk/subdir (glob)
587 581 Adding trunk/subdir/a (glob)
588 582 Transmitting file data .
589 583 Committed revision 14.
590 $ svn cp -m branchtrunk $SVNREPO/trunk $SVNREPO/branches/somebranch
584 $ svn cp -m branchtrunk $SVNREPOURL/trunk $SVNREPOURL/branches/somebranch
591 585
592 586 Committed revision 15.
593 587 $ cd ..
594 588
595 589 $ hg init repo2
596 590 $ cd repo2
597 $ svn co $SVNREPO/branches/somebranch/subdir
591 $ svn co $SVNREPOURL/branches/somebranch/subdir
598 592 A subdir/a (glob)
599 593 Checked out revision 15.
600 $ echo "subdir = [svn] $SVNREPO/branches/somebranch/subdir" > .hgsub
594 $ echo "subdir = [svn] $SVNREPOURL/branches/somebranch/subdir" > .hgsub
601 595 $ hg add .hgsub
602 596 $ hg ci -m addsub
603 597 $ hg up null
604 598 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
605 599 $ hg up
606 600 A *subdir/a (glob)
607 601 Checked out revision 15.
608 602 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
609 603 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now