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