##// END OF EJS Templates
tests: remove lines that enable progress extension...
timeless -
r28597:cd34bf29 default
parent child Browse files
Show More
@@ -1,362 +1,360
1 1 #require serve
2 2
3 3 $ hg init test
4 4 $ cd test
5 5 $ echo foo>foo
6 6 $ hg commit -Am 1 -d '1 0'
7 7 adding foo
8 8 $ echo bar>bar
9 9 $ hg commit -Am 2 -d '2 0'
10 10 adding bar
11 11 $ mkdir baz
12 12 $ echo bletch>baz/bletch
13 13 $ hg commit -Am 3 -d '1000000000 0'
14 14 adding baz/bletch
15 15 $ hg init subrepo
16 16 $ touch subrepo/sub
17 17 $ hg -q -R subrepo ci -Am "init subrepo"
18 18 $ echo "subrepo = subrepo" > .hgsub
19 19 $ hg add .hgsub
20 20 $ hg ci -m "add subrepo"
21 21 $ echo "[web]" >> .hg/hgrc
22 22 $ echo "name = test-archive" >> .hg/hgrc
23 23 $ echo "archivesubrepos = True" >> .hg/hgrc
24 24 $ cp .hg/hgrc .hg/hgrc-base
25 25 > test_archtype() {
26 26 > echo "allow_archive = $1" >> .hg/hgrc
27 27 > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
28 28 > cat hg.pid >> $DAEMON_PIDS
29 29 > echo % $1 allowed should give 200
30 30 > get-with-headers.py localhost:$HGPORT "archive/tip.$2" | head -n 1
31 31 > echo % $3 and $4 disallowed should both give 403
32 32 > get-with-headers.py localhost:$HGPORT "archive/tip.$3" | head -n 1
33 33 > get-with-headers.py localhost:$HGPORT "archive/tip.$4" | head -n 1
34 34 > killdaemons.py
35 35 > cat errors.log
36 36 > cp .hg/hgrc-base .hg/hgrc
37 37 > }
38 38
39 39 check http return codes
40 40
41 41 $ test_archtype gz tar.gz tar.bz2 zip
42 42 % gz allowed should give 200
43 43 200 Script output follows
44 44 % tar.bz2 and zip disallowed should both give 403
45 45 403 Archive type not allowed: bz2
46 46 403 Archive type not allowed: zip
47 47 $ test_archtype bz2 tar.bz2 zip tar.gz
48 48 % bz2 allowed should give 200
49 49 200 Script output follows
50 50 % zip and tar.gz disallowed should both give 403
51 51 403 Archive type not allowed: zip
52 52 403 Archive type not allowed: gz
53 53 $ test_archtype zip zip tar.gz tar.bz2
54 54 % zip allowed should give 200
55 55 200 Script output follows
56 56 % tar.gz and tar.bz2 disallowed should both give 403
57 57 403 Archive type not allowed: gz
58 58 403 Archive type not allowed: bz2
59 59
60 60 $ echo "allow_archive = gz bz2 zip" >> .hg/hgrc
61 61 $ hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
62 62 $ cat hg.pid >> $DAEMON_PIDS
63 63
64 64 invalid arch type should give 404
65 65
66 66 $ get-with-headers.py localhost:$HGPORT "archive/tip.invalid" | head -n 1
67 67 404 Unsupported archive type: None
68 68
69 69 $ TIP=`hg id -v | cut -f1 -d' '`
70 70 $ QTIP=`hg id -q`
71 71 $ cat > getarchive.py <<EOF
72 72 > import os, sys, urllib2
73 73 > try:
74 74 > # Set stdout to binary mode for win32 platforms
75 75 > import msvcrt
76 76 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
77 77 > except ImportError:
78 78 > pass
79 79 > if len(sys.argv) <= 3:
80 80 > node, archive = sys.argv[1:]
81 81 > requeststr = 'cmd=archive;node=%s;type=%s' % (node, archive)
82 82 > else:
83 83 > node, archive, file = sys.argv[1:]
84 84 > requeststr = 'cmd=archive;node=%s;type=%s;file=%s' % (node, archive, file)
85 85 > try:
86 86 > f = urllib2.urlopen('http://127.0.0.1:%s/?%s'
87 87 > % (os.environ['HGPORT'], requeststr))
88 88 > sys.stdout.write(f.read())
89 89 > except urllib2.HTTPError, e:
90 90 > sys.stderr.write(str(e) + '\n')
91 91 > EOF
92 92 $ python getarchive.py "$TIP" gz | gunzip | tar tf - 2>/dev/null
93 93 test-archive-1701ef1f1510/.hg_archival.txt
94 94 test-archive-1701ef1f1510/.hgsub
95 95 test-archive-1701ef1f1510/.hgsubstate
96 96 test-archive-1701ef1f1510/bar
97 97 test-archive-1701ef1f1510/baz/bletch
98 98 test-archive-1701ef1f1510/foo
99 99 test-archive-1701ef1f1510/subrepo/sub
100 100 $ python getarchive.py "$TIP" bz2 | bunzip2 | tar tf - 2>/dev/null
101 101 test-archive-1701ef1f1510/.hg_archival.txt
102 102 test-archive-1701ef1f1510/.hgsub
103 103 test-archive-1701ef1f1510/.hgsubstate
104 104 test-archive-1701ef1f1510/bar
105 105 test-archive-1701ef1f1510/baz/bletch
106 106 test-archive-1701ef1f1510/foo
107 107 test-archive-1701ef1f1510/subrepo/sub
108 108 $ python getarchive.py "$TIP" zip > archive.zip
109 109 $ unzip -t archive.zip
110 110 Archive: archive.zip
111 111 testing: test-archive-1701ef1f1510/.hg_archival.txt OK
112 112 testing: test-archive-1701ef1f1510/.hgsub OK
113 113 testing: test-archive-1701ef1f1510/.hgsubstate OK
114 114 testing: test-archive-1701ef1f1510/bar OK
115 115 testing: test-archive-1701ef1f1510/baz/bletch OK
116 116 testing: test-archive-1701ef1f1510/foo OK
117 117 testing: test-archive-1701ef1f1510/subrepo/sub OK
118 118 No errors detected in compressed data of archive.zip.
119 119
120 120 test that we can download single directories and files
121 121
122 122 $ python getarchive.py "$TIP" gz baz | gunzip | tar tf - 2>/dev/null
123 123 test-archive-1701ef1f1510/baz/bletch
124 124 $ python getarchive.py "$TIP" gz foo | gunzip | tar tf - 2>/dev/null
125 125 test-archive-1701ef1f1510/foo
126 126
127 127 test that we detect file patterns that match no files
128 128
129 129 $ python getarchive.py "$TIP" gz foobar
130 130 HTTP Error 404: file(s) not found: foobar
131 131
132 132 test that we reject unsafe patterns
133 133
134 134 $ python getarchive.py "$TIP" gz relre:baz
135 135 HTTP Error 404: file(s) not found: relre:baz
136 136
137 137 $ killdaemons.py
138 138
139 139 $ hg archive -t tar test.tar
140 140 $ tar tf test.tar
141 141 test/.hg_archival.txt
142 142 test/.hgsub
143 143 test/.hgsubstate
144 144 test/bar
145 145 test/baz/bletch
146 146 test/foo
147 147
148 148 $ hg archive --debug -t tbz2 -X baz test.tar.bz2 --config progress.debug=true
149 149 archiving: 0/4 files (0.00%)
150 150 archiving: .hgsub 1/4 files (25.00%)
151 151 archiving: .hgsubstate 2/4 files (50.00%)
152 152 archiving: bar 3/4 files (75.00%)
153 153 archiving: foo 4/4 files (100.00%)
154 154 $ bunzip2 -dc test.tar.bz2 | tar tf - 2>/dev/null
155 155 test/.hg_archival.txt
156 156 test/.hgsub
157 157 test/.hgsubstate
158 158 test/bar
159 159 test/foo
160 160
161 161 $ hg archive -t tgz -p %b-%h test-%h.tar.gz
162 162 $ gzip -dc test-$QTIP.tar.gz | tar tf - 2>/dev/null
163 163 test-1701ef1f1510/.hg_archival.txt
164 164 test-1701ef1f1510/.hgsub
165 165 test-1701ef1f1510/.hgsubstate
166 166 test-1701ef1f1510/bar
167 167 test-1701ef1f1510/baz/bletch
168 168 test-1701ef1f1510/foo
169 169
170 170 $ hg archive autodetected_test.tar
171 171 $ tar tf autodetected_test.tar
172 172 autodetected_test/.hg_archival.txt
173 173 autodetected_test/.hgsub
174 174 autodetected_test/.hgsubstate
175 175 autodetected_test/bar
176 176 autodetected_test/baz/bletch
177 177 autodetected_test/foo
178 178
179 179 The '-t' should override autodetection
180 180
181 181 $ hg archive -t tar autodetect_override_test.zip
182 182 $ tar tf autodetect_override_test.zip
183 183 autodetect_override_test.zip/.hg_archival.txt
184 184 autodetect_override_test.zip/.hgsub
185 185 autodetect_override_test.zip/.hgsubstate
186 186 autodetect_override_test.zip/bar
187 187 autodetect_override_test.zip/baz/bletch
188 188 autodetect_override_test.zip/foo
189 189
190 190 $ for ext in tar tar.gz tgz tar.bz2 tbz2 zip; do
191 191 > hg archive auto_test.$ext
192 192 > if [ -d auto_test.$ext ]; then
193 193 > echo "extension $ext was not autodetected."
194 194 > fi
195 195 > done
196 196
197 197 $ cat > md5comp.py <<EOF
198 198 > try:
199 199 > from hashlib import md5
200 200 > except ImportError:
201 201 > from md5 import md5
202 202 > import sys
203 203 > f1, f2 = sys.argv[1:3]
204 204 > h1 = md5(file(f1, 'rb').read()).hexdigest()
205 205 > h2 = md5(file(f2, 'rb').read()).hexdigest()
206 206 > print h1 == h2 or "md5 differ: " + repr((h1, h2))
207 207 > EOF
208 208
209 209 archive name is stored in the archive, so create similar archives and
210 210 rename them afterwards.
211 211
212 212 $ hg archive -t tgz tip.tar.gz
213 213 $ mv tip.tar.gz tip1.tar.gz
214 214 $ sleep 1
215 215 $ hg archive -t tgz tip.tar.gz
216 216 $ mv tip.tar.gz tip2.tar.gz
217 217 $ python md5comp.py tip1.tar.gz tip2.tar.gz
218 218 True
219 219
220 220 $ hg archive -t zip -p /illegal test.zip
221 221 abort: archive prefix contains illegal components
222 222 [255]
223 223 $ hg archive -t zip -p very/../bad test.zip
224 224
225 225 $ hg archive --config ui.archivemeta=false -t zip -r 2 test.zip
226 226 $ unzip -t test.zip
227 227 Archive: test.zip
228 228 testing: test/bar OK
229 229 testing: test/baz/bletch OK
230 230 testing: test/foo OK
231 231 No errors detected in compressed data of test.zip.
232 232
233 233 $ hg archive -t tar - | tar tf - 2>/dev/null
234 234 test-1701ef1f1510/.hg_archival.txt
235 235 test-1701ef1f1510/.hgsub
236 236 test-1701ef1f1510/.hgsubstate
237 237 test-1701ef1f1510/bar
238 238 test-1701ef1f1510/baz/bletch
239 239 test-1701ef1f1510/foo
240 240
241 241 $ hg archive -r 0 -t tar rev-%r.tar
242 242 $ [ -f rev-0.tar ]
243 243
244 244 test .hg_archival.txt
245 245
246 246 $ hg archive ../test-tags
247 247 $ cat ../test-tags/.hg_archival.txt
248 248 repo: daa7f7c60e0a224faa4ff77ca41b2760562af264
249 249 node: 1701ef1f151069b8747038e93b5186bb43a47504
250 250 branch: default
251 251 latesttag: null
252 252 latesttagdistance: 4
253 253 changessincelatesttag: 4
254 254 $ hg tag -r 2 mytag
255 255 $ hg tag -r 2 anothertag
256 256 $ hg archive -r 2 ../test-lasttag
257 257 $ cat ../test-lasttag/.hg_archival.txt
258 258 repo: daa7f7c60e0a224faa4ff77ca41b2760562af264
259 259 node: 2c0277f05ed49d1c8328fb9ba92fba7a5ebcb33e
260 260 branch: default
261 261 tag: anothertag
262 262 tag: mytag
263 263
264 264 $ hg archive -t bogus test.bogus
265 265 abort: unknown archive type 'bogus'
266 266 [255]
267 267
268 268 enable progress extension:
269 269
270 270 $ cp $HGRCPATH $HGRCPATH.no-progress
271 271 $ cat >> $HGRCPATH <<EOF
272 > [extensions]
273 > progress =
274 272 > [progress]
275 273 > assume-tty = 1
276 274 > format = topic bar number
277 275 > delay = 0
278 276 > refresh = 0
279 277 > width = 60
280 278 > EOF
281 279
282 280 $ hg archive ../with-progress
283 281 \r (no-eol) (esc)
284 282 archiving [ ] 0/6\r (no-eol) (esc)
285 283 archiving [======> ] 1/6\r (no-eol) (esc)
286 284 archiving [=============> ] 2/6\r (no-eol) (esc)
287 285 archiving [====================> ] 3/6\r (no-eol) (esc)
288 286 archiving [===========================> ] 4/6\r (no-eol) (esc)
289 287 archiving [==================================> ] 5/6\r (no-eol) (esc)
290 288 archiving [==========================================>] 6/6\r (no-eol) (esc)
291 289 \r (no-eol) (esc)
292 290
293 291 cleanup after progress extension test:
294 292
295 293 $ cp $HGRCPATH.no-progress $HGRCPATH
296 294
297 295 server errors
298 296
299 297 $ cat errors.log
300 298
301 299 empty repo
302 300
303 301 $ hg init ../empty
304 302 $ cd ../empty
305 303 $ hg archive ../test-empty
306 304 abort: no working directory: please specify a revision
307 305 [255]
308 306
309 307 old file -- date clamped to 1980
310 308
311 309 $ touch -t 197501010000 old
312 310 $ hg add old
313 311 $ hg commit -m old
314 312 $ hg archive ../old.zip
315 313 $ unzip -l ../old.zip
316 314 Archive: ../old.zip
317 315 \s*Length.* (re)
318 316 *-----* (glob)
319 317 *172*80*00:00*old/.hg_archival.txt (glob)
320 318 *0*80*00:00*old/old (glob)
321 319 *-----* (glob)
322 320 \s*172\s+2 files (re)
323 321
324 322 show an error when a provided pattern matches no files
325 323
326 324 $ hg archive -I file_that_does_not_exist.foo ../empty.zip
327 325 abort: no files match the archive pattern
328 326 [255]
329 327
330 328 $ hg archive -X * ../empty.zip
331 329 abort: no files match the archive pattern
332 330 [255]
333 331
334 332 $ cd ..
335 333
336 334 issue3600: check whether "hg archive" can create archive files which
337 335 are extracted with expected timestamp, even though TZ is not
338 336 configured as GMT.
339 337
340 338 $ mkdir issue3600
341 339 $ cd issue3600
342 340
343 341 $ hg init repo
344 342 $ echo a > repo/a
345 343 $ hg -R repo add repo/a
346 344 $ hg -R repo commit -m '#0' -d '456789012 21600'
347 345 $ cat > show_mtime.py <<EOF
348 346 > import sys, os
349 347 > print int(os.stat(sys.argv[1]).st_mtime)
350 348 > EOF
351 349
352 350 $ hg -R repo archive --prefix tar-extracted archive.tar
353 351 $ (TZ=UTC-3; export TZ; tar xf archive.tar)
354 352 $ python show_mtime.py tar-extracted/a
355 353 456789012
356 354
357 355 $ hg -R repo archive --prefix zip-extracted archive.zip
358 356 $ (TZ=UTC-3; export TZ; unzip -q archive.zip)
359 357 $ python show_mtime.py zip-extracted/a
360 358 456789012
361 359
362 360 $ cd ..
@@ -1,247 +1,245
1 1 #require svn svn-bindings
2 2
3 3 $ cat >> $HGRCPATH <<EOF
4 4 > [extensions]
5 5 > convert =
6 6 > EOF
7 7
8 8 $ svnadmin create svn-repo
9 9 $ svnadmin load -q svn-repo < "$TESTDIR/svn/move.svndump"
10 10 $ SVNREPOPATH=`pwd`/svn-repo
11 11 #if windows
12 12 $ SVNREPOURL=file:///`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
13 13 #else
14 14 $ SVNREPOURL=file://`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
15 15 #endif
16 16
17 17 Convert trunk and branches
18 18
19 19 $ hg convert --datesort "$SVNREPOURL"/subproject A-hg
20 20 initializing destination A-hg repository
21 21 scanning source...
22 22 sorting...
23 23 converting...
24 24 13 createtrunk
25 25 12 moved1
26 26 11 moved1
27 27 10 moved2
28 28 9 changeb and rm d2
29 29 8 changeb and rm d2
30 30 7 moved1again
31 31 6 moved1again
32 32 5 copyfilefrompast
33 33 4 copydirfrompast
34 34 3 add d3
35 35 2 copy dir and remove subdir
36 36 1 add d4old
37 37 0 rename d4old into d4new
38 38
39 39 $ cd A-hg
40 40 $ hg log -G --template '{rev} {desc|firstline} files: {files}\n'
41 41 o 13 rename d4old into d4new files: d4new/g d4old/g
42 42 |
43 43 o 12 add d4old files: d4old/g
44 44 |
45 45 o 11 copy dir and remove subdir files: d3/d31/e d4/d31/e d4/f
46 46 |
47 47 o 10 add d3 files: d3/d31/e d3/f
48 48 |
49 49 o 9 copydirfrompast files: d2/d
50 50 |
51 51 o 8 copyfilefrompast files: d
52 52 |
53 53 o 7 moved1again files: d1/b d1/c
54 54 |
55 55 | o 6 moved1again files:
56 56 | |
57 57 o | 5 changeb and rm d2 files: d1/b d2/d
58 58 | |
59 59 | o 4 changeb and rm d2 files: b
60 60 | |
61 61 o | 3 moved2 files: d2/d
62 62 | |
63 63 o | 2 moved1 files: d1/b d1/c
64 64 | |
65 65 | o 1 moved1 files: b c
66 66 |
67 67 o 0 createtrunk files:
68 68
69 69
70 70 Check move copy records
71 71
72 72 $ hg st --rev 12:13 --copies
73 73 A d4new/g
74 74 d4old/g
75 75 R d4old/g
76 76
77 77 Check branches
78 78
79 79 $ hg branches
80 80 default 13:* (glob)
81 81 d1 6:* (glob)
82 82 $ cd ..
83 83
84 84 $ mkdir test-replace
85 85 $ cd test-replace
86 86 $ svnadmin create svn-repo
87 87 $ svnadmin load -q svn-repo < "$TESTDIR/svn/replace.svndump"
88 88
89 89 Convert files being replaced by directories
90 90
91 91 $ hg convert svn-repo hg-repo
92 92 initializing destination hg-repo repository
93 93 scanning source...
94 94 sorting...
95 95 converting...
96 96 6 initial
97 97 5 clobber symlink
98 98 4 clobber1
99 99 3 clobber2
100 100 2 adddb
101 101 1 clobberdir
102 102 0 branch
103 103
104 104 $ cd hg-repo
105 105
106 106 Manifest before
107 107
108 108 $ hg -v manifest -r 1
109 109 644 a
110 110 644 d/b
111 111 644 d2/a
112 112 644 @ dlink
113 113 644 @ dlink2
114 114 644 dlink3
115 115
116 116 Manifest after clobber1
117 117
118 118 $ hg -v manifest -r 2
119 119 644 a/b
120 120 644 d/b
121 121 644 d2/a
122 122 644 dlink/b
123 123 644 @ dlink2
124 124 644 dlink3
125 125
126 126 Manifest after clobber2
127 127
128 128 $ hg -v manifest -r 3
129 129 644 a/b
130 130 644 d/b
131 131 644 d2/a
132 132 644 dlink/b
133 133 644 @ dlink2
134 134 644 @ dlink3
135 135
136 136 Manifest after clobberdir
137 137
138 138 $ hg -v manifest -r 6
139 139 644 a/b
140 140 644 d/b
141 141 644 d2/a
142 142 644 d2/c
143 143 644 dlink/b
144 144 644 @ dlink2
145 145 644 @ dlink3
146 146
147 147 Try updating
148 148
149 149 $ hg up -qC default
150 150 $ cd ..
151 151
152 152 Test convert progress bar
153 153
154 154 $ cat >> $HGRCPATH <<EOF
155 > [extensions]
156 > progress =
157 155 > [progress]
158 156 > assume-tty = 1
159 157 > delay = 0
160 158 > changedelay = 0
161 159 > format = topic bar number
162 160 > refresh = 0
163 161 > width = 60
164 162 > EOF
165 163
166 164 $ hg convert svn-repo hg-progress
167 165 \r (no-eol) (esc)
168 166 scanning [=====> ] 1/7\r (no-eol) (esc)
169 167 scanning [===========> ] 2/7\r (no-eol) (esc)
170 168 scanning [=================> ] 3/7\r (no-eol) (esc)
171 169 scanning [========================> ] 4/7\r (no-eol) (esc)
172 170 scanning [==============================> ] 5/7\r (no-eol) (esc)
173 171 scanning [====================================> ] 6/7\r (no-eol) (esc)
174 172 scanning [===========================================>] 7/7\r (no-eol) (esc)
175 173 \r (no-eol) (esc)
176 174 \r (no-eol) (esc)
177 175 converting [ ] 0/7\r (no-eol) (esc)
178 176 getting files [=====> ] 1/6\r (no-eol) (esc)
179 177 getting files [============> ] 2/6\r (no-eol) (esc)
180 178 getting files [==================> ] 3/6\r (no-eol) (esc)
181 179 getting files [=========================> ] 4/6\r (no-eol) (esc)
182 180 getting files [===============================> ] 5/6\r (no-eol) (esc)
183 181 getting files [======================================>] 6/6\r (no-eol) (esc)
184 182 \r (no-eol) (esc)
185 183 \r (no-eol) (esc)
186 184 converting [=====> ] 1/7\r (no-eol) (esc)
187 185 scanning paths [ ] 0/1\r (no-eol) (esc)
188 186 getting files [======================================>] 1/1\r (no-eol) (esc)
189 187 \r (no-eol) (esc)
190 188 \r (no-eol) (esc)
191 189 converting [===========> ] 2/7\r (no-eol) (esc)
192 190 scanning paths [ ] 0/2\r (no-eol) (esc)
193 191 scanning paths [==================> ] 1/2\r (no-eol) (esc)
194 192 getting files [========> ] 1/4\r (no-eol) (esc)
195 193 getting files [==================> ] 2/4\r (no-eol) (esc)
196 194 getting files [============================> ] 3/4\r (no-eol) (esc)
197 195 getting files [======================================>] 4/4\r (no-eol) (esc)
198 196 \r (no-eol) (esc)
199 197 \r (no-eol) (esc)
200 198 converting [=================> ] 3/7\r (no-eol) (esc)
201 199 scanning paths [ ] 0/1\r (no-eol) (esc)
202 200 getting files [======================================>] 1/1\r (no-eol) (esc)
203 201 \r (no-eol) (esc)
204 202 \r (no-eol) (esc)
205 203 converting [=======================> ] 4/7\r (no-eol) (esc)
206 204 scanning paths [ ] 0/1\r (no-eol) (esc)
207 205 getting files [======================================>] 1/1\r (no-eol) (esc)
208 206 \r (no-eol) (esc)
209 207 \r (no-eol) (esc)
210 208 converting [=============================> ] 5/7\r (no-eol) (esc)
211 209 scanning paths [ ] 0/1\r (no-eol) (esc)
212 210 getting files [===> ] 1/8\r (no-eol) (esc)
213 211 getting files [========> ] 2/8\r (no-eol) (esc)
214 212 getting files [=============> ] 3/8\r (no-eol) (esc)
215 213 getting files [==================> ] 4/8\r (no-eol) (esc)
216 214 getting files [=======================> ] 5/8\r (no-eol) (esc)
217 215 getting files [============================> ] 6/8\r (no-eol) (esc)
218 216 getting files [=================================> ] 7/8\r (no-eol) (esc)
219 217 getting files [======================================>] 8/8\r (no-eol) (esc)
220 218 \r (no-eol) (esc)
221 219 \r (no-eol) (esc)
222 220 converting [===================================> ] 6/7\r (no-eol) (esc)
223 221 scanning paths [ ] 0/3\r (no-eol) (esc)
224 222 scanning paths [===========> ] 1/3\r (no-eol) (esc)
225 223 scanning paths [========================> ] 2/3\r (no-eol) (esc)
226 224 getting files [===> ] 1/8\r (no-eol) (esc)
227 225 getting files [========> ] 2/8\r (no-eol) (esc)
228 226 getting files [=============> ] 3/8\r (no-eol) (esc)
229 227 getting files [==================> ] 4/8\r (no-eol) (esc)
230 228 getting files [=======================> ] 5/8\r (no-eol) (esc)
231 229 getting files [============================> ] 6/8\r (no-eol) (esc)
232 230 getting files [=================================> ] 7/8\r (no-eol) (esc)
233 231 getting files [======================================>] 8/8\r (no-eol) (esc)
234 232 \r (no-eol) (esc)
235 233 initializing destination hg-progress repository
236 234 scanning source...
237 235 sorting...
238 236 converting...
239 237 6 initial
240 238 5 clobber symlink
241 239 4 clobber1
242 240 3 clobber2
243 241 2 adddb
244 242 1 clobberdir
245 243 0 branch
246 244
247 245 $ cd ..
@@ -1,570 +1,568
1 1 Create test repository:
2 2
3 3 $ hg init repo
4 4 $ cd repo
5 5 $ echo x1 > x.txt
6 6
7 7 $ hg init foo
8 8 $ cd foo
9 9 $ echo y1 > y.txt
10 10
11 11 $ hg init bar
12 12 $ cd bar
13 13 $ echo z1 > z.txt
14 14
15 15 $ cd ..
16 16 $ echo 'bar = bar' > .hgsub
17 17
18 18 $ cd ..
19 19 $ echo 'foo = foo' > .hgsub
20 20
21 21 Add files --- .hgsub files must go first to trigger subrepos:
22 22
23 23 $ hg add -S .hgsub
24 24 $ hg add -S foo/.hgsub
25 25 $ hg add -S foo/bar
26 26 adding foo/bar/z.txt (glob)
27 27 $ hg add -S
28 28 adding x.txt
29 29 adding foo/y.txt (glob)
30 30
31 31 Test recursive status without committing anything:
32 32
33 33 $ hg status -S
34 34 A .hgsub
35 35 A foo/.hgsub
36 36 A foo/bar/z.txt
37 37 A foo/y.txt
38 38 A x.txt
39 39
40 40 Test recursive diff without committing anything:
41 41
42 42 $ hg diff --nodates -S foo
43 43 diff -r 000000000000 foo/.hgsub
44 44 --- /dev/null
45 45 +++ b/foo/.hgsub
46 46 @@ -0,0 +1,1 @@
47 47 +bar = bar
48 48 diff -r 000000000000 foo/y.txt
49 49 --- /dev/null
50 50 +++ b/foo/y.txt
51 51 @@ -0,0 +1,1 @@
52 52 +y1
53 53 diff -r 000000000000 foo/bar/z.txt
54 54 --- /dev/null
55 55 +++ b/foo/bar/z.txt
56 56 @@ -0,0 +1,1 @@
57 57 +z1
58 58
59 59 Commits:
60 60
61 61 $ hg commit -m fails
62 62 abort: uncommitted changes in subrepository 'foo'
63 63 (use --subrepos for recursive commit)
64 64 [255]
65 65
66 66 The --subrepos flag overwrite the config setting:
67 67
68 68 $ hg commit -m 0-0-0 --config ui.commitsubrepos=No --subrepos
69 69 committing subrepository foo
70 70 committing subrepository foo/bar (glob)
71 71
72 72 $ cd foo
73 73 $ echo y2 >> y.txt
74 74 $ hg commit -m 0-1-0
75 75
76 76 $ cd bar
77 77 $ echo z2 >> z.txt
78 78 $ hg commit -m 0-1-1
79 79
80 80 $ cd ..
81 81 $ hg commit -m 0-2-1
82 82
83 83 $ cd ..
84 84 $ hg commit -m 1-2-1
85 85
86 86 Change working directory:
87 87
88 88 $ echo y3 >> foo/y.txt
89 89 $ echo z3 >> foo/bar/z.txt
90 90 $ hg status -S
91 91 M foo/bar/z.txt
92 92 M foo/y.txt
93 93 $ hg diff --nodates -S
94 94 diff -r d254738c5f5e foo/y.txt
95 95 --- a/foo/y.txt
96 96 +++ b/foo/y.txt
97 97 @@ -1,2 +1,3 @@
98 98 y1
99 99 y2
100 100 +y3
101 101 diff -r 9647f22de499 foo/bar/z.txt
102 102 --- a/foo/bar/z.txt
103 103 +++ b/foo/bar/z.txt
104 104 @@ -1,2 +1,3 @@
105 105 z1
106 106 z2
107 107 +z3
108 108
109 109 Status call crossing repository boundaries:
110 110
111 111 $ hg status -S foo/bar/z.txt
112 112 M foo/bar/z.txt
113 113 $ hg status -S -I 'foo/?.txt'
114 114 M foo/y.txt
115 115 $ hg status -S -I '**/?.txt'
116 116 M foo/bar/z.txt
117 117 M foo/y.txt
118 118 $ hg diff --nodates -S -I '**/?.txt'
119 119 diff -r d254738c5f5e foo/y.txt
120 120 --- a/foo/y.txt
121 121 +++ b/foo/y.txt
122 122 @@ -1,2 +1,3 @@
123 123 y1
124 124 y2
125 125 +y3
126 126 diff -r 9647f22de499 foo/bar/z.txt
127 127 --- a/foo/bar/z.txt
128 128 +++ b/foo/bar/z.txt
129 129 @@ -1,2 +1,3 @@
130 130 z1
131 131 z2
132 132 +z3
133 133
134 134 Status from within a subdirectory:
135 135
136 136 $ mkdir dir
137 137 $ cd dir
138 138 $ echo a1 > a.txt
139 139 $ hg status -S
140 140 M foo/bar/z.txt
141 141 M foo/y.txt
142 142 ? dir/a.txt
143 143 $ hg diff --nodates -S
144 144 diff -r d254738c5f5e foo/y.txt
145 145 --- a/foo/y.txt
146 146 +++ b/foo/y.txt
147 147 @@ -1,2 +1,3 @@
148 148 y1
149 149 y2
150 150 +y3
151 151 diff -r 9647f22de499 foo/bar/z.txt
152 152 --- a/foo/bar/z.txt
153 153 +++ b/foo/bar/z.txt
154 154 @@ -1,2 +1,3 @@
155 155 z1
156 156 z2
157 157 +z3
158 158
159 159 Status with relative path:
160 160
161 161 $ hg status -S ..
162 162 M ../foo/bar/z.txt
163 163 M ../foo/y.txt
164 164 ? a.txt
165 165
166 166 XXX: filtering lfilesrepo.status() in 3.3-rc causes these files to be listed as
167 167 added instead of modified.
168 168 $ hg status -S .. --config extensions.largefiles=
169 169 M ../foo/bar/z.txt
170 170 M ../foo/y.txt
171 171 ? a.txt
172 172
173 173 $ hg diff --nodates -S ..
174 174 diff -r d254738c5f5e foo/y.txt
175 175 --- a/foo/y.txt
176 176 +++ b/foo/y.txt
177 177 @@ -1,2 +1,3 @@
178 178 y1
179 179 y2
180 180 +y3
181 181 diff -r 9647f22de499 foo/bar/z.txt
182 182 --- a/foo/bar/z.txt
183 183 +++ b/foo/bar/z.txt
184 184 @@ -1,2 +1,3 @@
185 185 z1
186 186 z2
187 187 +z3
188 188 $ cd ..
189 189
190 190 Cleanup and final commit:
191 191
192 192 $ rm -r dir
193 193 $ hg commit --subrepos -m 2-3-2
194 194 committing subrepository foo
195 195 committing subrepository foo/bar (glob)
196 196
197 197 Test explicit path commands within subrepos: add/forget
198 198 $ echo z1 > foo/bar/z2.txt
199 199 $ hg status -S
200 200 ? foo/bar/z2.txt
201 201 $ hg add foo/bar/z2.txt
202 202 $ hg status -S
203 203 A foo/bar/z2.txt
204 204 $ hg forget foo/bar/z2.txt
205 205 $ hg status -S
206 206 ? foo/bar/z2.txt
207 207 $ hg forget foo/bar/z2.txt
208 208 not removing foo/bar/z2.txt: file is already untracked (glob)
209 209 [1]
210 210 $ hg status -S
211 211 ? foo/bar/z2.txt
212 212 $ rm foo/bar/z2.txt
213 213
214 214 Log with the relationships between repo and its subrepo:
215 215
216 216 $ hg log --template '{rev}:{node|short} {desc}\n'
217 217 2:1326fa26d0c0 2-3-2
218 218 1:4b3c9ff4f66b 1-2-1
219 219 0:23376cbba0d8 0-0-0
220 220
221 221 $ hg -R foo log --template '{rev}:{node|short} {desc}\n'
222 222 3:65903cebad86 2-3-2
223 223 2:d254738c5f5e 0-2-1
224 224 1:8629ce7dcc39 0-1-0
225 225 0:af048e97ade2 0-0-0
226 226
227 227 $ hg -R foo/bar log --template '{rev}:{node|short} {desc}\n'
228 228 2:31ecbdafd357 2-3-2
229 229 1:9647f22de499 0-1-1
230 230 0:4904098473f9 0-0-0
231 231
232 232 Status between revisions:
233 233
234 234 $ hg status -S
235 235 $ hg status -S --rev 0:1
236 236 M .hgsubstate
237 237 M foo/.hgsubstate
238 238 M foo/bar/z.txt
239 239 M foo/y.txt
240 240 $ hg diff --nodates -S -I '**/?.txt' --rev 0:1
241 241 diff -r af048e97ade2 -r d254738c5f5e foo/y.txt
242 242 --- a/foo/y.txt
243 243 +++ b/foo/y.txt
244 244 @@ -1,1 +1,2 @@
245 245 y1
246 246 +y2
247 247 diff -r 4904098473f9 -r 9647f22de499 foo/bar/z.txt
248 248 --- a/foo/bar/z.txt
249 249 +++ b/foo/bar/z.txt
250 250 @@ -1,1 +1,2 @@
251 251 z1
252 252 +z2
253 253
254 254 Enable progress extension for archive tests:
255 255
256 256 $ cp $HGRCPATH $HGRCPATH.no-progress
257 257 $ cat >> $HGRCPATH <<EOF
258 > [extensions]
259 > progress =
260 258 > [progress]
261 259 > disable=False
262 260 > assume-tty = 1
263 261 > delay = 0
264 262 > # set changedelay really large so we don't see nested topics
265 263 > changedelay = 30000
266 264 > format = topic bar number
267 265 > refresh = 0
268 266 > width = 60
269 267 > EOF
270 268
271 269 Test archiving to a directory tree (the doubled lines in the output
272 270 only show up in the test output, not in real usage):
273 271
274 272 $ hg archive --subrepos ../archive
275 273 \r (no-eol) (esc)
276 274 archiving [ ] 0/3\r (no-eol) (esc)
277 275 archiving [=============> ] 1/3\r (no-eol) (esc)
278 276 archiving [===========================> ] 2/3\r (no-eol) (esc)
279 277 archiving [==========================================>] 3/3\r (no-eol) (esc)
280 278 \r (no-eol) (esc)
281 279 \r (no-eol) (esc)
282 280 archiving (foo) [ ] 0/3\r (no-eol) (esc)
283 281 archiving (foo) [===========> ] 1/3\r (no-eol) (esc)
284 282 archiving (foo) [=======================> ] 2/3\r (no-eol) (esc)
285 283 archiving (foo) [====================================>] 3/3\r (no-eol) (esc)
286 284 \r (no-eol) (esc)
287 285 \r (no-eol) (esc)
288 286 archiving (foo/bar) [ ] 0/1\r (no-eol) (glob) (esc)
289 287 archiving (foo/bar) [================================>] 1/1\r (no-eol) (glob) (esc)
290 288 \r (no-eol) (esc)
291 289 $ find ../archive | sort
292 290 ../archive
293 291 ../archive/.hg_archival.txt
294 292 ../archive/.hgsub
295 293 ../archive/.hgsubstate
296 294 ../archive/foo
297 295 ../archive/foo/.hgsub
298 296 ../archive/foo/.hgsubstate
299 297 ../archive/foo/bar
300 298 ../archive/foo/bar/z.txt
301 299 ../archive/foo/y.txt
302 300 ../archive/x.txt
303 301
304 302 Test archiving to zip file (unzip output is unstable):
305 303
306 304 $ hg archive --subrepos --prefix '.' ../archive.zip
307 305 \r (no-eol) (esc)
308 306 archiving [ ] 0/3\r (no-eol) (esc)
309 307 archiving [=============> ] 1/3\r (no-eol) (esc)
310 308 archiving [===========================> ] 2/3\r (no-eol) (esc)
311 309 archiving [==========================================>] 3/3\r (no-eol) (esc)
312 310 \r (no-eol) (esc)
313 311 \r (no-eol) (esc)
314 312 archiving (foo) [ ] 0/3\r (no-eol) (esc)
315 313 archiving (foo) [===========> ] 1/3\r (no-eol) (esc)
316 314 archiving (foo) [=======================> ] 2/3\r (no-eol) (esc)
317 315 archiving (foo) [====================================>] 3/3\r (no-eol) (esc)
318 316 \r (no-eol) (esc)
319 317 \r (no-eol) (esc)
320 318 archiving (foo/bar) [ ] 0/1\r (no-eol) (glob) (esc)
321 319 archiving (foo/bar) [================================>] 1/1\r (no-eol) (glob) (esc)
322 320 \r (no-eol) (esc)
323 321
324 322 (unzip date formating is unstable, we do not care about it and glob it out)
325 323
326 324 $ unzip -l ../archive.zip
327 325 Archive: ../archive.zip
328 326 Length [ ]* Date [ ]* Time [ ]* Name (re)
329 327 [\- ]* (re)
330 328 172 [0-9:\- ]* .hg_archival.txt (re)
331 329 10 [0-9:\- ]* .hgsub (re)
332 330 45 [0-9:\- ]* .hgsubstate (re)
333 331 3 [0-9:\- ]* x.txt (re)
334 332 10 [0-9:\- ]* foo/.hgsub (re)
335 333 45 [0-9:\- ]* foo/.hgsubstate (re)
336 334 9 [0-9:\- ]* foo/y.txt (re)
337 335 9 [0-9:\- ]* foo/bar/z.txt (re)
338 336 [\- ]* (re)
339 337 303 [ ]* 8 files (re)
340 338
341 339 Test archiving a revision that references a subrepo that is not yet
342 340 cloned:
343 341
344 342 #if hardlink
345 343 $ hg clone -U . ../empty
346 344 \r (no-eol) (esc)
347 345 linking [ <=> ] 1\r (no-eol) (esc)
348 346 linking [ <=> ] 2\r (no-eol) (esc)
349 347 linking [ <=> ] 3\r (no-eol) (esc)
350 348 linking [ <=> ] 4\r (no-eol) (esc)
351 349 linking [ <=> ] 5\r (no-eol) (esc)
352 350 linking [ <=> ] 6\r (no-eol) (esc)
353 351 linking [ <=> ] 7\r (no-eol) (esc)
354 352 linking [ <=> ] 8\r (no-eol) (esc)
355 353 \r (no-eol) (esc)
356 354 #else
357 355 $ hg clone -U . ../empty
358 356 \r (no-eol) (esc)
359 357 linking [ <=> ] 1 (no-eol)
360 358 #endif
361 359
362 360 $ cd ../empty
363 361 #if hardlink
364 362 $ hg archive --subrepos -r tip --prefix './' ../archive.tar.gz
365 363 \r (no-eol) (esc)
366 364 archiving [ ] 0/3\r (no-eol) (esc)
367 365 archiving [=============> ] 1/3\r (no-eol) (esc)
368 366 archiving [===========================> ] 2/3\r (no-eol) (esc)
369 367 archiving [==========================================>] 3/3\r (no-eol) (esc)
370 368 \r (no-eol) (esc)
371 369 \r (no-eol) (esc)
372 370 linking [ <=> ] 1\r (no-eol) (esc)
373 371 linking [ <=> ] 2\r (no-eol) (esc)
374 372 linking [ <=> ] 3\r (no-eol) (esc)
375 373 linking [ <=> ] 4\r (no-eol) (esc)
376 374 linking [ <=> ] 5\r (no-eol) (esc)
377 375 linking [ <=> ] 6\r (no-eol) (esc)
378 376 linking [ <=> ] 7\r (no-eol) (esc)
379 377 linking [ <=> ] 8\r (no-eol) (esc)
380 378 \r (no-eol) (esc)
381 379 \r (no-eol) (esc)
382 380 archiving (foo) [ ] 0/3\r (no-eol) (esc)
383 381 archiving (foo) [===========> ] 1/3\r (no-eol) (esc)
384 382 archiving (foo) [=======================> ] 2/3\r (no-eol) (esc)
385 383 archiving (foo) [====================================>] 3/3\r (no-eol) (esc)
386 384 \r (no-eol) (esc)
387 385 \r (no-eol) (esc)
388 386 linking [ <=> ] 1\r (no-eol) (esc)
389 387 linking [ <=> ] 2\r (no-eol) (esc)
390 388 linking [ <=> ] 3\r (no-eol) (esc)
391 389 linking [ <=> ] 4\r (no-eol) (esc)
392 390 linking [ <=> ] 5\r (no-eol) (esc)
393 391 linking [ <=> ] 6\r (no-eol) (esc)
394 392 \r (no-eol) (esc)
395 393 \r (no-eol) (esc)
396 394 archiving (foo/bar) [ ] 0/1\r (no-eol) (glob) (esc)
397 395 archiving (foo/bar) [================================>] 1/1\r (no-eol) (glob) (esc)
398 396 \r (no-eol) (esc)
399 397 cloning subrepo foo from $TESTTMP/repo/foo
400 398 cloning subrepo foo/bar from $TESTTMP/repo/foo/bar (glob)
401 399 #else
402 400 Note there's a slight output glitch on non-hardlink systems: the last
403 401 "linking" progress topic never gets closed, leading to slight output corruption on that platform.
404 402 $ hg archive --subrepos -r tip --prefix './' ../archive.tar.gz
405 403 \r (no-eol) (esc)
406 404 archiving [ ] 0/3\r (no-eol) (esc)
407 405 archiving [=============> ] 1/3\r (no-eol) (esc)
408 406 archiving [===========================> ] 2/3\r (no-eol) (esc)
409 407 archiving [==========================================>] 3/3\r (no-eol) (esc)
410 408 \r (no-eol) (esc)
411 409 \r (no-eol) (esc)
412 410 linking [ <=> ] 1\r (no-eol) (esc)
413 411 cloning subrepo foo/bar from $TESTTMP/repo/foo/bar (glob)
414 412 #endif
415 413
416 414 Archive + subrepos uses '/' for all component separators
417 415
418 416 $ tar -tzf ../archive.tar.gz | sort
419 417 .hg_archival.txt
420 418 .hgsub
421 419 .hgsubstate
422 420 foo/.hgsub
423 421 foo/.hgsubstate
424 422 foo/bar/z.txt
425 423 foo/y.txt
426 424 x.txt
427 425
428 426 The newly cloned subrepos contain no working copy:
429 427
430 428 $ hg -R foo summary
431 429 parent: -1:000000000000 (no revision checked out)
432 430 branch: default
433 431 commit: (clean)
434 432 update: 4 new changesets (update)
435 433
436 434 Disable progress extension and cleanup:
437 435
438 436 $ mv $HGRCPATH.no-progress $HGRCPATH
439 437
440 438 Test archiving when there is a directory in the way for a subrepo
441 439 created by archive:
442 440
443 441 $ hg clone -U . ../almost-empty
444 442 $ cd ../almost-empty
445 443 $ mkdir foo
446 444 $ echo f > foo/f
447 445 $ hg archive --subrepos -r tip archive
448 446 cloning subrepo foo from $TESTTMP/empty/foo
449 447 abort: destination '$TESTTMP/almost-empty/foo' is not empty (in subrepo foo) (glob)
450 448 [255]
451 449
452 450 Clone and test outgoing:
453 451
454 452 $ cd ..
455 453 $ hg clone repo repo2
456 454 updating to branch default
457 455 cloning subrepo foo from $TESTTMP/repo/foo
458 456 cloning subrepo foo/bar from $TESTTMP/repo/foo/bar (glob)
459 457 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
460 458 $ cd repo2
461 459 $ hg outgoing -S
462 460 comparing with $TESTTMP/repo (glob)
463 461 searching for changes
464 462 no changes found
465 463 comparing with $TESTTMP/repo/foo
466 464 searching for changes
467 465 no changes found
468 466 comparing with $TESTTMP/repo/foo/bar
469 467 searching for changes
470 468 no changes found
471 469 [1]
472 470
473 471 Make nested change:
474 472
475 473 $ echo y4 >> foo/y.txt
476 474 $ hg diff --nodates -S
477 475 diff -r 65903cebad86 foo/y.txt
478 476 --- a/foo/y.txt
479 477 +++ b/foo/y.txt
480 478 @@ -1,3 +1,4 @@
481 479 y1
482 480 y2
483 481 y3
484 482 +y4
485 483 $ hg commit --subrepos -m 3-4-2
486 484 committing subrepository foo
487 485 $ hg outgoing -S
488 486 comparing with $TESTTMP/repo (glob)
489 487 searching for changes
490 488 changeset: 3:2655b8ecc4ee
491 489 tag: tip
492 490 user: test
493 491 date: Thu Jan 01 00:00:00 1970 +0000
494 492 summary: 3-4-2
495 493
496 494 comparing with $TESTTMP/repo/foo
497 495 searching for changes
498 496 changeset: 4:e96193d6cb36
499 497 tag: tip
500 498 user: test
501 499 date: Thu Jan 01 00:00:00 1970 +0000
502 500 summary: 3-4-2
503 501
504 502 comparing with $TESTTMP/repo/foo/bar
505 503 searching for changes
506 504 no changes found
507 505
508 506
509 507 Switch to original repo and setup default path:
510 508
511 509 $ cd ../repo
512 510 $ echo '[paths]' >> .hg/hgrc
513 511 $ echo 'default = ../repo2' >> .hg/hgrc
514 512
515 513 Test incoming:
516 514
517 515 $ hg incoming -S
518 516 comparing with $TESTTMP/repo2 (glob)
519 517 searching for changes
520 518 changeset: 3:2655b8ecc4ee
521 519 tag: tip
522 520 user: test
523 521 date: Thu Jan 01 00:00:00 1970 +0000
524 522 summary: 3-4-2
525 523
526 524 comparing with $TESTTMP/repo2/foo
527 525 searching for changes
528 526 changeset: 4:e96193d6cb36
529 527 tag: tip
530 528 user: test
531 529 date: Thu Jan 01 00:00:00 1970 +0000
532 530 summary: 3-4-2
533 531
534 532 comparing with $TESTTMP/repo2/foo/bar
535 533 searching for changes
536 534 no changes found
537 535
538 536 $ hg incoming -S --bundle incoming.hg
539 537 abort: cannot combine --bundle and --subrepos
540 538 [255]
541 539
542 540 Test missing subrepo:
543 541
544 542 $ rm -r foo
545 543 $ hg status -S
546 544 warning: error "unknown revision '65903cebad86f1a84bd4f1134f62fa7dcb7a1c98'" in subrepository "foo"
547 545
548 546 Issue2619: IndexError: list index out of range on hg add with subrepos
549 547 The subrepo must sorts after the explicit filename.
550 548
551 549 $ cd ..
552 550 $ hg init test
553 551 $ cd test
554 552 $ hg init x
555 553 $ echo abc > abc.txt
556 554 $ hg ci -Am "abc"
557 555 adding abc.txt
558 556 $ echo "x = x" >> .hgsub
559 557 $ hg add .hgsub
560 558 $ touch a x/a
561 559 $ hg add a x/a
562 560
563 561 $ hg ci -Sm "added x"
564 562 committing subrepository x
565 563 $ echo abc > x/a
566 564 $ hg revert --rev '.^' "set:subrepo('glob:x*')"
567 565 abort: subrepository 'x' does not exist in 25ac2c9b3180!
568 566 [255]
569 567
570 568 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now