##// END OF EJS Templates
tests: make test-archive.t pass on py3.9 (issue6504)...
Martin von Zweigbergk -
r47740:dc8976cc default
parent child Browse files
Show More
@@ -1,636 +1,636 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
21
22 $ cat >> $HGRCPATH <<EOF
22 $ cat >> $HGRCPATH <<EOF
23 > [extensions]
23 > [extensions]
24 > share =
24 > share =
25 > EOF
25 > EOF
26
26
27 hg subrepos are shared when the parent repo is shared
27 hg subrepos are shared when the parent repo is shared
28
28
29 $ cd ..
29 $ cd ..
30 $ hg share test shared1
30 $ hg share test shared1
31 updating working directory
31 updating working directory
32 sharing subrepo subrepo from $TESTTMP/test/subrepo
32 sharing subrepo subrepo from $TESTTMP/test/subrepo
33 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
33 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 $ cat shared1/subrepo/.hg/sharedpath
34 $ cat shared1/subrepo/.hg/sharedpath
35 $TESTTMP/test/subrepo/.hg (no-eol)
35 $TESTTMP/test/subrepo/.hg (no-eol)
36
36
37 hg subrepos are shared into existence on demand if the parent was shared
37 hg subrepos are shared into existence on demand if the parent was shared
38
38
39 $ hg clone -qr 1 test clone1
39 $ hg clone -qr 1 test clone1
40 $ hg share clone1 share2
40 $ hg share clone1 share2
41 updating working directory
41 updating working directory
42 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
42 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
43 $ hg -R clone1 -q pull
43 $ hg -R clone1 -q pull
44 $ hg -R share2 update tip
44 $ hg -R share2 update tip
45 sharing subrepo subrepo from $TESTTMP/test/subrepo
45 sharing subrepo subrepo from $TESTTMP/test/subrepo
46 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
46 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
47 $ cat share2/subrepo/.hg/sharedpath
47 $ cat share2/subrepo/.hg/sharedpath
48 $TESTTMP/test/subrepo/.hg (no-eol)
48 $TESTTMP/test/subrepo/.hg (no-eol)
49 $ echo 'mod' > share2/subrepo/sub
49 $ echo 'mod' > share2/subrepo/sub
50 $ hg -R share2 ci -Sqm 'subrepo mod'
50 $ hg -R share2 ci -Sqm 'subrepo mod'
51 $ hg -R clone1 update -C tip
51 $ hg -R clone1 update -C tip
52 cloning subrepo subrepo from $TESTTMP/test/subrepo
52 cloning subrepo subrepo from $TESTTMP/test/subrepo
53 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
53 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
54 $ find share2 | egrep 'sharedpath|00.+\.i' | sort
54 $ find share2 | egrep 'sharedpath|00.+\.i' | sort
55 share2/.hg/sharedpath
55 share2/.hg/sharedpath
56 share2/subrepo/.hg/sharedpath
56 share2/subrepo/.hg/sharedpath
57 $ hg -R share2 unshare
57 $ hg -R share2 unshare
58 unsharing subrepo 'subrepo'
58 unsharing subrepo 'subrepo'
59 $ find share2 | egrep 'sharedpath|00.+\.i' | sort
59 $ find share2 | egrep 'sharedpath|00.+\.i' | sort
60 share2/.hg/00changelog.i
60 share2/.hg/00changelog.i
61 share2/.hg/sharedpath.old
61 share2/.hg/sharedpath.old
62 share2/.hg/store/00changelog.i
62 share2/.hg/store/00changelog.i
63 share2/.hg/store/00manifest.i
63 share2/.hg/store/00manifest.i
64 share2/subrepo/.hg/00changelog.i
64 share2/subrepo/.hg/00changelog.i
65 share2/subrepo/.hg/sharedpath.old
65 share2/subrepo/.hg/sharedpath.old
66 share2/subrepo/.hg/store/00changelog.i
66 share2/subrepo/.hg/store/00changelog.i
67 share2/subrepo/.hg/store/00manifest.i
67 share2/subrepo/.hg/store/00manifest.i
68 $ hg -R share2/subrepo log -r tip -T compact
68 $ hg -R share2/subrepo log -r tip -T compact
69 1[tip] 559dcc9bfa65 1970-01-01 00:00 +0000 test
69 1[tip] 559dcc9bfa65 1970-01-01 00:00 +0000 test
70 subrepo mod
70 subrepo mod
71
71
72 $ rm -rf clone1
72 $ rm -rf clone1
73
73
74 $ hg clone -qr 1 test clone1
74 $ hg clone -qr 1 test clone1
75 $ hg share clone1 shared3
75 $ hg share clone1 shared3
76 updating working directory
76 updating working directory
77 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
77 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
78 $ hg -R clone1 -q pull
78 $ hg -R clone1 -q pull
79 $ hg -R shared3 archive --config ui.archivemeta=False -r tip -S archive
79 $ hg -R shared3 archive --config ui.archivemeta=False -r tip -S archive
80 sharing subrepo subrepo from $TESTTMP/test/subrepo
80 sharing subrepo subrepo from $TESTTMP/test/subrepo
81 $ cat shared3/subrepo/.hg/sharedpath
81 $ cat shared3/subrepo/.hg/sharedpath
82 $TESTTMP/test/subrepo/.hg (no-eol)
82 $TESTTMP/test/subrepo/.hg (no-eol)
83 $ diff -r archive test
83 $ diff -r archive test
84 Only in test: .hg
84 Only in test: .hg
85 Common subdirectories: archive/baz and test/baz (?)
85 Common subdirectories: archive/baz and test/baz (?)
86 Common subdirectories: archive/subrepo and test/subrepo (?)
86 Common subdirectories: archive/subrepo and test/subrepo (?)
87 Only in test/subrepo: .hg
87 Only in test/subrepo: .hg
88 [1]
88 [1]
89 $ rm -rf archive
89 $ rm -rf archive
90
90
91 $ cd test
91 $ cd test
92 $ echo "[web]" >> .hg/hgrc
92 $ echo "[web]" >> .hg/hgrc
93 $ echo "name = test-archive" >> .hg/hgrc
93 $ echo "name = test-archive" >> .hg/hgrc
94 $ echo "archivesubrepos = True" >> .hg/hgrc
94 $ echo "archivesubrepos = True" >> .hg/hgrc
95 $ cp .hg/hgrc .hg/hgrc-base
95 $ cp .hg/hgrc .hg/hgrc-base
96 > test_archtype() {
96 > test_archtype() {
97 > echo "allow-archive = $1" >> .hg/hgrc
97 > echo "allow-archive = $1" >> .hg/hgrc
98 > test_archtype_run "$@"
98 > test_archtype_run "$@"
99 > }
99 > }
100 > test_archtype_deprecated() {
100 > test_archtype_deprecated() {
101 > echo "allow$1 = True" >> .hg/hgrc
101 > echo "allow$1 = True" >> .hg/hgrc
102 > test_archtype_run "$@"
102 > test_archtype_run "$@"
103 > }
103 > }
104 > test_archtype_run() {
104 > test_archtype_run() {
105 > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log \
105 > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log \
106 > --config extensions.blackbox= --config blackbox.track=develwarn
106 > --config extensions.blackbox= --config blackbox.track=develwarn
107 > cat hg.pid >> $DAEMON_PIDS
107 > cat hg.pid >> $DAEMON_PIDS
108 > echo % $1 allowed should give 200
108 > echo % $1 allowed should give 200
109 > get-with-headers.py --bodyfile body localhost:$HGPORT "archive/tip.$2" -
109 > get-with-headers.py --bodyfile body localhost:$HGPORT "archive/tip.$2" -
110 > f --size --sha1 body
110 > f --size --sha1 body
111 > echo % $3 and $4 disallowed should both give 403
111 > echo % $3 and $4 disallowed should both give 403
112 > get-with-headers.py --bodyfile body localhost:$HGPORT "archive/tip.$3" -
112 > get-with-headers.py --bodyfile body localhost:$HGPORT "archive/tip.$3" -
113 > f --size --sha1 body
113 > f --size --sha1 body
114 > get-with-headers.py --bodyfile body localhost:$HGPORT "archive/tip.$4" -
114 > get-with-headers.py --bodyfile body localhost:$HGPORT "archive/tip.$4" -
115 > f --size --sha1 body
115 > f --size --sha1 body
116 > killdaemons.py
116 > killdaemons.py
117 > cat errors.log
117 > cat errors.log
118 > hg blackbox --config extensions.blackbox= --config blackbox.track=
118 > hg blackbox --config extensions.blackbox= --config blackbox.track=
119 > cp .hg/hgrc-base .hg/hgrc
119 > cp .hg/hgrc-base .hg/hgrc
120 > }
120 > }
121
121
122 check http return codes
122 check http return codes
123
123
124 $ test_archtype gz tar.gz tar.bz2 zip
124 $ test_archtype gz tar.gz tar.bz2 zip
125 % gz allowed should give 200
125 % gz allowed should give 200
126 200 Script output follows
126 200 Script output follows
127 content-disposition: attachment; filename=test-archive-1701ef1f1510.tar.gz
127 content-disposition: attachment; filename=test-archive-1701ef1f1510.tar.gz
128 content-type: application/x-gzip
128 content-type: application/x-gzip
129 date: $HTTP_DATE$
129 date: $HTTP_DATE$
130 etag: W/"*" (glob)
130 etag: W/"*" (glob)
131 server: testing stub value
131 server: testing stub value
132 transfer-encoding: chunked
132 transfer-encoding: chunked
133
133
134 body: size=408, sha1=8fa06531bddecc365a9f5edb0f88b65974bfe505 (no-py38 !)
134 body: size=408, sha1=8fa06531bddecc365a9f5edb0f88b65974bfe505 (no-py38 !)
135 body: size=506, sha1=70926a04cb8887d0bcccf5380488100a10222def (py38 no-py39 !)
135 body: size=506, sha1=70926a04cb8887d0bcccf5380488100a10222def (py38 no-py39 !)
136 body: size=505, sha1=eb823c293bedff0df4070b854e2c5cbb06d6ec62 (py39 !)
136 body: size=505, sha1=eb823c293bedff0df4070b854e2c5cbb06d6ec62 (py39 !)
137 % tar.bz2 and zip disallowed should both give 403
137 % tar.bz2 and zip disallowed should both give 403
138 403 Archive type not allowed: bz2
138 403 Archive type not allowed: bz2
139 content-type: text/html; charset=ascii
139 content-type: text/html; charset=ascii
140 date: $HTTP_DATE$
140 date: $HTTP_DATE$
141 etag: W/"*" (glob)
141 etag: W/"*" (glob)
142 server: testing stub value
142 server: testing stub value
143 transfer-encoding: chunked
143 transfer-encoding: chunked
144
144
145 body: size=1451, sha1=4c5cf0f574446c44feb7f88f4e0e2a56bd92c352
145 body: size=1451, sha1=4c5cf0f574446c44feb7f88f4e0e2a56bd92c352
146 403 Archive type not allowed: zip
146 403 Archive type not allowed: zip
147 content-type: text/html; charset=ascii
147 content-type: text/html; charset=ascii
148 date: $HTTP_DATE$
148 date: $HTTP_DATE$
149 etag: W/"*" (glob)
149 etag: W/"*" (glob)
150 server: testing stub value
150 server: testing stub value
151 transfer-encoding: chunked
151 transfer-encoding: chunked
152
152
153 body: size=1451, sha1=cbfa5574b337348bfd0564cc534474d002e7d6c7
153 body: size=1451, sha1=cbfa5574b337348bfd0564cc534474d002e7d6c7
154 $ test_archtype bz2 tar.bz2 zip tar.gz
154 $ test_archtype bz2 tar.bz2 zip tar.gz
155 % bz2 allowed should give 200
155 % bz2 allowed should give 200
156 200 Script output follows
156 200 Script output follows
157 content-disposition: attachment; filename=test-archive-1701ef1f1510.tar.bz2
157 content-disposition: attachment; filename=test-archive-1701ef1f1510.tar.bz2
158 content-type: application/x-bzip2
158 content-type: application/x-bzip2
159 date: $HTTP_DATE$
159 date: $HTTP_DATE$
160 etag: W/"*" (glob)
160 etag: W/"*" (glob)
161 server: testing stub value
161 server: testing stub value
162 transfer-encoding: chunked
162 transfer-encoding: chunked
163
163
164 body: size=426, sha1=8d87f5aba6e14f1bfea6c232985982c278b2fb0b (no-py38 !)
164 body: size=426, sha1=8d87f5aba6e14f1bfea6c232985982c278b2fb0b (no-py38 !)
165 body: size=506, sha1=1bd1f8e8d3701704bd4385038bd9c09b81c77f4e (py38 no-py39 !)
165 body: size=506, sha1=1bd1f8e8d3701704bd4385038bd9c09b81c77f4e (py38 no-py39 !)
166 body: size=503, sha1=2d8ce8bb3816603b9683a1804a5a02c11224cb01 (py39 !)
166 body: size=503, sha1=2d8ce8bb3816603b9683a1804a5a02c11224cb01 (py39 !)
167 % zip and tar.gz disallowed should both give 403
167 % zip and tar.gz disallowed should both give 403
168 403 Archive type not allowed: zip
168 403 Archive type not allowed: zip
169 content-type: text/html; charset=ascii
169 content-type: text/html; charset=ascii
170 date: $HTTP_DATE$
170 date: $HTTP_DATE$
171 etag: W/"*" (glob)
171 etag: W/"*" (glob)
172 server: testing stub value
172 server: testing stub value
173 transfer-encoding: chunked
173 transfer-encoding: chunked
174
174
175 body: size=1451, sha1=cbfa5574b337348bfd0564cc534474d002e7d6c7
175 body: size=1451, sha1=cbfa5574b337348bfd0564cc534474d002e7d6c7
176 403 Archive type not allowed: gz
176 403 Archive type not allowed: gz
177 content-type: text/html; charset=ascii
177 content-type: text/html; charset=ascii
178 date: $HTTP_DATE$
178 date: $HTTP_DATE$
179 etag: W/"*" (glob)
179 etag: W/"*" (glob)
180 server: testing stub value
180 server: testing stub value
181 transfer-encoding: chunked
181 transfer-encoding: chunked
182
182
183 body: size=1450, sha1=71f0b12d59f85fdcfe8ff493e2dc66863f2f7734
183 body: size=1450, sha1=71f0b12d59f85fdcfe8ff493e2dc66863f2f7734
184 $ test_archtype zip zip tar.gz tar.bz2
184 $ test_archtype zip zip tar.gz tar.bz2
185 % zip allowed should give 200
185 % zip allowed should give 200
186 200 Script output follows
186 200 Script output follows
187 content-disposition: attachment; filename=test-archive-1701ef1f1510.zip
187 content-disposition: attachment; filename=test-archive-1701ef1f1510.zip
188 content-type: application/zip
188 content-type: application/zip
189 date: $HTTP_DATE$
189 date: $HTTP_DATE$
190 etag: W/"*" (glob)
190 etag: W/"*" (glob)
191 server: testing stub value
191 server: testing stub value
192 transfer-encoding: chunked
192 transfer-encoding: chunked
193
193
194 body: size=(1377|1461|1489), sha1=(677b14d3d048778d5eb5552c14a67e6192068650|be6d3983aa13dfe930361b2569291cdedd02b537|1897e496871aa89ad685a92b936f5fa0d008b9e8) (re)
194 body: size=(1377|1461|1489), sha1=(677b14d3d048778d5eb5552c14a67e6192068650|be6d3983aa13dfe930361b2569291cdedd02b537|1897e496871aa89ad685a92b936f5fa0d008b9e8) (re)
195 % tar.gz and tar.bz2 disallowed should both give 403
195 % tar.gz and tar.bz2 disallowed should both give 403
196 403 Archive type not allowed: gz
196 403 Archive type not allowed: gz
197 content-type: text/html; charset=ascii
197 content-type: text/html; charset=ascii
198 date: $HTTP_DATE$
198 date: $HTTP_DATE$
199 etag: W/"*" (glob)
199 etag: W/"*" (glob)
200 server: testing stub value
200 server: testing stub value
201 transfer-encoding: chunked
201 transfer-encoding: chunked
202
202
203 body: size=1450, sha1=71f0b12d59f85fdcfe8ff493e2dc66863f2f7734
203 body: size=1450, sha1=71f0b12d59f85fdcfe8ff493e2dc66863f2f7734
204 403 Archive type not allowed: bz2
204 403 Archive type not allowed: bz2
205 content-type: text/html; charset=ascii
205 content-type: text/html; charset=ascii
206 date: $HTTP_DATE$
206 date: $HTTP_DATE$
207 etag: W/"*" (glob)
207 etag: W/"*" (glob)
208 server: testing stub value
208 server: testing stub value
209 transfer-encoding: chunked
209 transfer-encoding: chunked
210
210
211 body: size=1451, sha1=4c5cf0f574446c44feb7f88f4e0e2a56bd92c352
211 body: size=1451, sha1=4c5cf0f574446c44feb7f88f4e0e2a56bd92c352
212
212
213 check http return codes (with deprecated option)
213 check http return codes (with deprecated option)
214
214
215 $ test_archtype_deprecated gz tar.gz tar.bz2 zip
215 $ test_archtype_deprecated gz tar.gz tar.bz2 zip
216 % gz allowed should give 200
216 % gz allowed should give 200
217 200 Script output follows
217 200 Script output follows
218 content-disposition: attachment; filename=test-archive-1701ef1f1510.tar.gz
218 content-disposition: attachment; filename=test-archive-1701ef1f1510.tar.gz
219 content-type: application/x-gzip
219 content-type: application/x-gzip
220 date: $HTTP_DATE$
220 date: $HTTP_DATE$
221 etag: W/"*" (glob)
221 etag: W/"*" (glob)
222 server: testing stub value
222 server: testing stub value
223 transfer-encoding: chunked
223 transfer-encoding: chunked
224
224
225 body: size=408, sha1=8fa06531bddecc365a9f5edb0f88b65974bfe505 (no-py38 !)
225 body: size=408, sha1=8fa06531bddecc365a9f5edb0f88b65974bfe505 (no-py38 !)
226 body: size=506, sha1=70926a04cb8887d0bcccf5380488100a10222def (py38 no-py39 !)
226 body: size=506, sha1=70926a04cb8887d0bcccf5380488100a10222def (py38 no-py39 !)
227 body: size=505, sha1=eb823c293bedff0df4070b854e2c5cbb06d6ec62 (py39 !)
227 body: size=505, sha1=eb823c293bedff0df4070b854e2c5cbb06d6ec62 (py39 !)
228 % tar.bz2 and zip disallowed should both give 403
228 % tar.bz2 and zip disallowed should both give 403
229 403 Archive type not allowed: bz2
229 403 Archive type not allowed: bz2
230 content-type: text/html; charset=ascii
230 content-type: text/html; charset=ascii
231 date: $HTTP_DATE$
231 date: $HTTP_DATE$
232 etag: W/"*" (glob)
232 etag: W/"*" (glob)
233 server: testing stub value
233 server: testing stub value
234 transfer-encoding: chunked
234 transfer-encoding: chunked
235
235
236 body: size=1451, sha1=4c5cf0f574446c44feb7f88f4e0e2a56bd92c352
236 body: size=1451, sha1=4c5cf0f574446c44feb7f88f4e0e2a56bd92c352
237 403 Archive type not allowed: zip
237 403 Archive type not allowed: zip
238 content-type: text/html; charset=ascii
238 content-type: text/html; charset=ascii
239 date: $HTTP_DATE$
239 date: $HTTP_DATE$
240 etag: W/"*" (glob)
240 etag: W/"*" (glob)
241 server: testing stub value
241 server: testing stub value
242 transfer-encoding: chunked
242 transfer-encoding: chunked
243
243
244 body: size=1451, sha1=cbfa5574b337348bfd0564cc534474d002e7d6c7
244 body: size=1451, sha1=cbfa5574b337348bfd0564cc534474d002e7d6c7
245 $ test_archtype_deprecated bz2 tar.bz2 zip tar.gz
245 $ test_archtype_deprecated bz2 tar.bz2 zip tar.gz
246 % bz2 allowed should give 200
246 % bz2 allowed should give 200
247 200 Script output follows
247 200 Script output follows
248 content-disposition: attachment; filename=test-archive-1701ef1f1510.tar.bz2
248 content-disposition: attachment; filename=test-archive-1701ef1f1510.tar.bz2
249 content-type: application/x-bzip2
249 content-type: application/x-bzip2
250 date: $HTTP_DATE$
250 date: $HTTP_DATE$
251 etag: W/"*" (glob)
251 etag: W/"*" (glob)
252 server: testing stub value
252 server: testing stub value
253 transfer-encoding: chunked
253 transfer-encoding: chunked
254
254
255 body: size=426, sha1=8d87f5aba6e14f1bfea6c232985982c278b2fb0b (no-py38 !)
255 body: size=426, sha1=8d87f5aba6e14f1bfea6c232985982c278b2fb0b (no-py38 !)
256 body: size=506, sha1=1bd1f8e8d3701704bd4385038bd9c09b81c77f4e (py38 no-py39 !)
256 body: size=506, sha1=1bd1f8e8d3701704bd4385038bd9c09b81c77f4e (py38 no-py39 !)
257 body: size=503, sha1=2d8ce8bb3816603b9683a1804a5a02c11224cb01 (py39 !)
257 body: size=503, sha1=2d8ce8bb3816603b9683a1804a5a02c11224cb01 (py39 !)
258 % zip and tar.gz disallowed should both give 403
258 % zip and tar.gz disallowed should both give 403
259 403 Archive type not allowed: zip
259 403 Archive type not allowed: zip
260 content-type: text/html; charset=ascii
260 content-type: text/html; charset=ascii
261 date: $HTTP_DATE$
261 date: $HTTP_DATE$
262 etag: W/"*" (glob)
262 etag: W/"*" (glob)
263 server: testing stub value
263 server: testing stub value
264 transfer-encoding: chunked
264 transfer-encoding: chunked
265
265
266 body: size=1451, sha1=cbfa5574b337348bfd0564cc534474d002e7d6c7
266 body: size=1451, sha1=cbfa5574b337348bfd0564cc534474d002e7d6c7
267 403 Archive type not allowed: gz
267 403 Archive type not allowed: gz
268 content-type: text/html; charset=ascii
268 content-type: text/html; charset=ascii
269 date: $HTTP_DATE$
269 date: $HTTP_DATE$
270 etag: W/"*" (glob)
270 etag: W/"*" (glob)
271 server: testing stub value
271 server: testing stub value
272 transfer-encoding: chunked
272 transfer-encoding: chunked
273
273
274 body: size=1450, sha1=71f0b12d59f85fdcfe8ff493e2dc66863f2f7734
274 body: size=1450, sha1=71f0b12d59f85fdcfe8ff493e2dc66863f2f7734
275 $ test_archtype_deprecated zip zip tar.gz tar.bz2
275 $ test_archtype_deprecated zip zip tar.gz tar.bz2
276 % zip allowed should give 200
276 % zip allowed should give 200
277 200 Script output follows
277 200 Script output follows
278 content-disposition: attachment; filename=test-archive-1701ef1f1510.zip
278 content-disposition: attachment; filename=test-archive-1701ef1f1510.zip
279 content-type: application/zip
279 content-type: application/zip
280 date: $HTTP_DATE$
280 date: $HTTP_DATE$
281 etag: W/"*" (glob)
281 etag: W/"*" (glob)
282 server: testing stub value
282 server: testing stub value
283 transfer-encoding: chunked
283 transfer-encoding: chunked
284
284
285 body: size=(1377|1461|1489), sha1=(677b14d3d048778d5eb5552c14a67e6192068650|be6d3983aa13dfe930361b2569291cdedd02b537|1897e496871aa89ad685a92b936f5fa0d008b9e8) (re)
285 body: size=(1377|1461|1489), sha1=(677b14d3d048778d5eb5552c14a67e6192068650|be6d3983aa13dfe930361b2569291cdedd02b537|1897e496871aa89ad685a92b936f5fa0d008b9e8) (re)
286 % tar.gz and tar.bz2 disallowed should both give 403
286 % tar.gz and tar.bz2 disallowed should both give 403
287 403 Archive type not allowed: gz
287 403 Archive type not allowed: gz
288 content-type: text/html; charset=ascii
288 content-type: text/html; charset=ascii
289 date: $HTTP_DATE$
289 date: $HTTP_DATE$
290 etag: W/"*" (glob)
290 etag: W/"*" (glob)
291 server: testing stub value
291 server: testing stub value
292 transfer-encoding: chunked
292 transfer-encoding: chunked
293
293
294 body: size=1450, sha1=71f0b12d59f85fdcfe8ff493e2dc66863f2f7734
294 body: size=1450, sha1=71f0b12d59f85fdcfe8ff493e2dc66863f2f7734
295 403 Archive type not allowed: bz2
295 403 Archive type not allowed: bz2
296 content-type: text/html; charset=ascii
296 content-type: text/html; charset=ascii
297 date: $HTTP_DATE$
297 date: $HTTP_DATE$
298 etag: W/"*" (glob)
298 etag: W/"*" (glob)
299 server: testing stub value
299 server: testing stub value
300 transfer-encoding: chunked
300 transfer-encoding: chunked
301
301
302 body: size=1451, sha1=4c5cf0f574446c44feb7f88f4e0e2a56bd92c352
302 body: size=1451, sha1=4c5cf0f574446c44feb7f88f4e0e2a56bd92c352
303
303
304 $ echo "allow-archive = gz bz2 zip" >> .hg/hgrc
304 $ echo "allow-archive = gz bz2 zip" >> .hg/hgrc
305 $ hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
305 $ hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
306 $ cat hg.pid >> $DAEMON_PIDS
306 $ cat hg.pid >> $DAEMON_PIDS
307
307
308 check archive links' order
308 check archive links' order
309
309
310 $ get-with-headers.py localhost:$HGPORT "?revcount=1" | grep '/archive/tip.'
310 $ get-with-headers.py localhost:$HGPORT "?revcount=1" | grep '/archive/tip.'
311 <a href="/archive/tip.zip">zip</a>
311 <a href="/archive/tip.zip">zip</a>
312 <a href="/archive/tip.tar.gz">gz</a>
312 <a href="/archive/tip.tar.gz">gz</a>
313 <a href="/archive/tip.tar.bz2">bz2</a>
313 <a href="/archive/tip.tar.bz2">bz2</a>
314
314
315 invalid arch type should give 404
315 invalid arch type should give 404
316
316
317 $ get-with-headers.py localhost:$HGPORT "archive/tip.invalid" | head -n 1
317 $ get-with-headers.py localhost:$HGPORT "archive/tip.invalid" | head -n 1
318 404 Unsupported archive type: None
318 404 Unsupported archive type: None
319
319
320 $ TIP=`hg id -v | cut -f1 -d' '`
320 $ TIP=`hg id -v | cut -f1 -d' '`
321 $ QTIP=`hg id -q`
321 $ QTIP=`hg id -q`
322 $ cat > getarchive.py <<EOF
322 $ cat > getarchive.py <<EOF
323 > from __future__ import absolute_import
323 > from __future__ import absolute_import
324 > import os
324 > import os
325 > import sys
325 > import sys
326 > from mercurial import (
326 > from mercurial import (
327 > util,
327 > util,
328 > )
328 > )
329 > try:
329 > try:
330 > # Set stdout to binary mode for win32 platforms
330 > # Set stdout to binary mode for win32 platforms
331 > import msvcrt
331 > import msvcrt
332 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
332 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
333 > except ImportError:
333 > except ImportError:
334 > pass
334 > pass
335 > if len(sys.argv) <= 3:
335 > if len(sys.argv) <= 3:
336 > node, archive = sys.argv[1:]
336 > node, archive = sys.argv[1:]
337 > requeststr = 'cmd=archive;node=%s;type=%s' % (node, archive)
337 > requeststr = 'cmd=archive&node=%s&type=%s' % (node, archive)
338 > else:
338 > else:
339 > node, archive, file = sys.argv[1:]
339 > node, archive, file = sys.argv[1:]
340 > requeststr = 'cmd=archive;node=%s;type=%s;file=%s' % (node, archive, file)
340 > requeststr = 'cmd=archive&node=%s&type=%s&file=%s' % (node, archive, file)
341 > try:
341 > try:
342 > stdout = sys.stdout.buffer
342 > stdout = sys.stdout.buffer
343 > except AttributeError:
343 > except AttributeError:
344 > stdout = sys.stdout
344 > stdout = sys.stdout
345 > try:
345 > try:
346 > f = util.urlreq.urlopen('http://$LOCALIP:%s/?%s'
346 > f = util.urlreq.urlopen('http://$LOCALIP:%s/?%s'
347 > % (os.environ['HGPORT'], requeststr))
347 > % (os.environ['HGPORT'], requeststr))
348 > stdout.write(f.read())
348 > stdout.write(f.read())
349 > except util.urlerr.httperror as e:
349 > except util.urlerr.httperror as e:
350 > sys.stderr.write(str(e) + '\n')
350 > sys.stderr.write(str(e) + '\n')
351 > EOF
351 > EOF
352 $ "$PYTHON" getarchive.py "$TIP" gz | gunzip | tar tf - 2>/dev/null
352 $ "$PYTHON" getarchive.py "$TIP" gz | gunzip | tar tf - 2>/dev/null
353 test-archive-1701ef1f1510/.hg_archival.txt
353 test-archive-1701ef1f1510/.hg_archival.txt
354 test-archive-1701ef1f1510/.hgsub
354 test-archive-1701ef1f1510/.hgsub
355 test-archive-1701ef1f1510/.hgsubstate
355 test-archive-1701ef1f1510/.hgsubstate
356 test-archive-1701ef1f1510/bar
356 test-archive-1701ef1f1510/bar
357 test-archive-1701ef1f1510/baz/bletch
357 test-archive-1701ef1f1510/baz/bletch
358 test-archive-1701ef1f1510/foo
358 test-archive-1701ef1f1510/foo
359 test-archive-1701ef1f1510/subrepo/sub
359 test-archive-1701ef1f1510/subrepo/sub
360 $ "$PYTHON" getarchive.py "$TIP" bz2 | bunzip2 | tar tf - 2>/dev/null
360 $ "$PYTHON" getarchive.py "$TIP" bz2 | bunzip2 | tar tf - 2>/dev/null
361 test-archive-1701ef1f1510/.hg_archival.txt
361 test-archive-1701ef1f1510/.hg_archival.txt
362 test-archive-1701ef1f1510/.hgsub
362 test-archive-1701ef1f1510/.hgsub
363 test-archive-1701ef1f1510/.hgsubstate
363 test-archive-1701ef1f1510/.hgsubstate
364 test-archive-1701ef1f1510/bar
364 test-archive-1701ef1f1510/bar
365 test-archive-1701ef1f1510/baz/bletch
365 test-archive-1701ef1f1510/baz/bletch
366 test-archive-1701ef1f1510/foo
366 test-archive-1701ef1f1510/foo
367 test-archive-1701ef1f1510/subrepo/sub
367 test-archive-1701ef1f1510/subrepo/sub
368 $ "$PYTHON" getarchive.py "$TIP" zip > archive.zip
368 $ "$PYTHON" getarchive.py "$TIP" zip > archive.zip
369 $ unzip -t archive.zip
369 $ unzip -t archive.zip
370 Archive: archive.zip
370 Archive: archive.zip
371 testing: test-archive-1701ef1f1510/.hg_archival.txt*OK (glob)
371 testing: test-archive-1701ef1f1510/.hg_archival.txt*OK (glob)
372 testing: test-archive-1701ef1f1510/.hgsub*OK (glob)
372 testing: test-archive-1701ef1f1510/.hgsub*OK (glob)
373 testing: test-archive-1701ef1f1510/.hgsubstate*OK (glob)
373 testing: test-archive-1701ef1f1510/.hgsubstate*OK (glob)
374 testing: test-archive-1701ef1f1510/bar*OK (glob)
374 testing: test-archive-1701ef1f1510/bar*OK (glob)
375 testing: test-archive-1701ef1f1510/baz/bletch*OK (glob)
375 testing: test-archive-1701ef1f1510/baz/bletch*OK (glob)
376 testing: test-archive-1701ef1f1510/foo*OK (glob)
376 testing: test-archive-1701ef1f1510/foo*OK (glob)
377 testing: test-archive-1701ef1f1510/subrepo/sub*OK (glob)
377 testing: test-archive-1701ef1f1510/subrepo/sub*OK (glob)
378 No errors detected in compressed data of archive.zip.
378 No errors detected in compressed data of archive.zip.
379
379
380 test that we can download single directories and files
380 test that we can download single directories and files
381
381
382 $ "$PYTHON" getarchive.py "$TIP" gz baz | gunzip | tar tf - 2>/dev/null
382 $ "$PYTHON" getarchive.py "$TIP" gz baz | gunzip | tar tf - 2>/dev/null
383 test-archive-1701ef1f1510/baz/bletch
383 test-archive-1701ef1f1510/baz/bletch
384 $ "$PYTHON" getarchive.py "$TIP" gz foo | gunzip | tar tf - 2>/dev/null
384 $ "$PYTHON" getarchive.py "$TIP" gz foo | gunzip | tar tf - 2>/dev/null
385 test-archive-1701ef1f1510/foo
385 test-archive-1701ef1f1510/foo
386
386
387 test that we detect file patterns that match no files
387 test that we detect file patterns that match no files
388
388
389 $ "$PYTHON" getarchive.py "$TIP" gz foobar
389 $ "$PYTHON" getarchive.py "$TIP" gz foobar
390 HTTP Error 404: file(s) not found: foobar
390 HTTP Error 404: file(s) not found: foobar
391
391
392 test that we reject unsafe patterns
392 test that we reject unsafe patterns
393
393
394 $ "$PYTHON" getarchive.py "$TIP" gz relre:baz
394 $ "$PYTHON" getarchive.py "$TIP" gz relre:baz
395 HTTP Error 404: file(s) not found: relre:baz
395 HTTP Error 404: file(s) not found: relre:baz
396
396
397 $ killdaemons.py
397 $ killdaemons.py
398
398
399 $ hg archive -t tar test.tar
399 $ hg archive -t tar test.tar
400 $ tar tf test.tar
400 $ tar tf test.tar
401 test/.hg_archival.txt
401 test/.hg_archival.txt
402 test/.hgsub
402 test/.hgsub
403 test/.hgsubstate
403 test/.hgsubstate
404 test/bar
404 test/bar
405 test/baz/bletch
405 test/baz/bletch
406 test/foo
406 test/foo
407
407
408 $ hg archive --debug -t tbz2 -X baz test.tar.bz2 --config progress.debug=true
408 $ hg archive --debug -t tbz2 -X baz test.tar.bz2 --config progress.debug=true
409 archiving: 0/4 files (0.00%)
409 archiving: 0/4 files (0.00%)
410 archiving: .hgsub 1/4 files (25.00%)
410 archiving: .hgsub 1/4 files (25.00%)
411 archiving: .hgsubstate 2/4 files (50.00%)
411 archiving: .hgsubstate 2/4 files (50.00%)
412 archiving: bar 3/4 files (75.00%)
412 archiving: bar 3/4 files (75.00%)
413 archiving: foo 4/4 files (100.00%)
413 archiving: foo 4/4 files (100.00%)
414 $ bunzip2 -dc test.tar.bz2 | tar tf - 2>/dev/null
414 $ bunzip2 -dc test.tar.bz2 | tar tf - 2>/dev/null
415 test/.hg_archival.txt
415 test/.hg_archival.txt
416 test/.hgsub
416 test/.hgsub
417 test/.hgsubstate
417 test/.hgsubstate
418 test/bar
418 test/bar
419 test/foo
419 test/foo
420
420
421 $ hg archive -t tgz -p %b-%h test-%h.tar.gz
421 $ hg archive -t tgz -p %b-%h test-%h.tar.gz
422 $ gzip -dc test-$QTIP.tar.gz | tar tf - 2>/dev/null
422 $ gzip -dc test-$QTIP.tar.gz | tar tf - 2>/dev/null
423 test-1701ef1f1510/.hg_archival.txt
423 test-1701ef1f1510/.hg_archival.txt
424 test-1701ef1f1510/.hgsub
424 test-1701ef1f1510/.hgsub
425 test-1701ef1f1510/.hgsubstate
425 test-1701ef1f1510/.hgsubstate
426 test-1701ef1f1510/bar
426 test-1701ef1f1510/bar
427 test-1701ef1f1510/baz/bletch
427 test-1701ef1f1510/baz/bletch
428 test-1701ef1f1510/foo
428 test-1701ef1f1510/foo
429
429
430 $ hg archive autodetected_test.tar
430 $ hg archive autodetected_test.tar
431 $ tar tf autodetected_test.tar
431 $ tar tf autodetected_test.tar
432 autodetected_test/.hg_archival.txt
432 autodetected_test/.hg_archival.txt
433 autodetected_test/.hgsub
433 autodetected_test/.hgsub
434 autodetected_test/.hgsubstate
434 autodetected_test/.hgsubstate
435 autodetected_test/bar
435 autodetected_test/bar
436 autodetected_test/baz/bletch
436 autodetected_test/baz/bletch
437 autodetected_test/foo
437 autodetected_test/foo
438
438
439 The '-t' should override autodetection
439 The '-t' should override autodetection
440
440
441 $ hg archive -t tar autodetect_override_test.zip
441 $ hg archive -t tar autodetect_override_test.zip
442 $ tar tf autodetect_override_test.zip
442 $ tar tf autodetect_override_test.zip
443 autodetect_override_test.zip/.hg_archival.txt
443 autodetect_override_test.zip/.hg_archival.txt
444 autodetect_override_test.zip/.hgsub
444 autodetect_override_test.zip/.hgsub
445 autodetect_override_test.zip/.hgsubstate
445 autodetect_override_test.zip/.hgsubstate
446 autodetect_override_test.zip/bar
446 autodetect_override_test.zip/bar
447 autodetect_override_test.zip/baz/bletch
447 autodetect_override_test.zip/baz/bletch
448 autodetect_override_test.zip/foo
448 autodetect_override_test.zip/foo
449
449
450 $ for ext in tar tar.gz tgz tar.bz2 tbz2 zip; do
450 $ for ext in tar tar.gz tgz tar.bz2 tbz2 zip; do
451 > hg archive auto_test.$ext
451 > hg archive auto_test.$ext
452 > if [ -d auto_test.$ext ]; then
452 > if [ -d auto_test.$ext ]; then
453 > echo "extension $ext was not autodetected."
453 > echo "extension $ext was not autodetected."
454 > fi
454 > fi
455 > done
455 > done
456
456
457 $ cat > md5comp.py <<EOF
457 $ cat > md5comp.py <<EOF
458 > from __future__ import absolute_import, print_function
458 > from __future__ import absolute_import, print_function
459 > import hashlib
459 > import hashlib
460 > import sys
460 > import sys
461 > f1, f2 = sys.argv[1:3]
461 > f1, f2 = sys.argv[1:3]
462 > h1 = hashlib.md5(open(f1, 'rb').read()).hexdigest()
462 > h1 = hashlib.md5(open(f1, 'rb').read()).hexdigest()
463 > h2 = hashlib.md5(open(f2, 'rb').read()).hexdigest()
463 > h2 = hashlib.md5(open(f2, 'rb').read()).hexdigest()
464 > print(h1 == h2 or "md5 differ: " + repr((h1, h2)))
464 > print(h1 == h2 or "md5 differ: " + repr((h1, h2)))
465 > EOF
465 > EOF
466
466
467 archive name is stored in the archive, so create similar archives and
467 archive name is stored in the archive, so create similar archives and
468 rename them afterwards.
468 rename them afterwards.
469
469
470 $ hg archive -t tgz tip.tar.gz
470 $ hg archive -t tgz tip.tar.gz
471 $ mv tip.tar.gz tip1.tar.gz
471 $ mv tip.tar.gz tip1.tar.gz
472 $ sleep 1
472 $ sleep 1
473 $ hg archive -t tgz tip.tar.gz
473 $ hg archive -t tgz tip.tar.gz
474 $ mv tip.tar.gz tip2.tar.gz
474 $ mv tip.tar.gz tip2.tar.gz
475 $ "$PYTHON" md5comp.py tip1.tar.gz tip2.tar.gz
475 $ "$PYTHON" md5comp.py tip1.tar.gz tip2.tar.gz
476 True
476 True
477
477
478 $ hg archive -t zip -p /illegal test.zip
478 $ hg archive -t zip -p /illegal test.zip
479 abort: archive prefix contains illegal components
479 abort: archive prefix contains illegal components
480 [255]
480 [255]
481 $ hg archive -t zip -p very/../bad test.zip
481 $ hg archive -t zip -p very/../bad test.zip
482
482
483 $ hg archive --config ui.archivemeta=false -t zip -r 2 test.zip
483 $ hg archive --config ui.archivemeta=false -t zip -r 2 test.zip
484 $ unzip -t test.zip
484 $ unzip -t test.zip
485 Archive: test.zip
485 Archive: test.zip
486 testing: test/bar*OK (glob)
486 testing: test/bar*OK (glob)
487 testing: test/baz/bletch*OK (glob)
487 testing: test/baz/bletch*OK (glob)
488 testing: test/foo*OK (glob)
488 testing: test/foo*OK (glob)
489 No errors detected in compressed data of test.zip.
489 No errors detected in compressed data of test.zip.
490
490
491 $ hg archive -t tar - | tar tf - 2>/dev/null
491 $ hg archive -t tar - | tar tf - 2>/dev/null
492 test-1701ef1f1510/.hg_archival.txt
492 test-1701ef1f1510/.hg_archival.txt
493 test-1701ef1f1510/.hgsub
493 test-1701ef1f1510/.hgsub
494 test-1701ef1f1510/.hgsubstate
494 test-1701ef1f1510/.hgsubstate
495 test-1701ef1f1510/bar
495 test-1701ef1f1510/bar
496 test-1701ef1f1510/baz/bletch
496 test-1701ef1f1510/baz/bletch
497 test-1701ef1f1510/foo
497 test-1701ef1f1510/foo
498
498
499 $ hg archive -r 0 -t tar rev-%r.tar
499 $ hg archive -r 0 -t tar rev-%r.tar
500 $ [ -f rev-0.tar ]
500 $ [ -f rev-0.tar ]
501
501
502 test .hg_archival.txt
502 test .hg_archival.txt
503
503
504 $ hg archive ../test-tags
504 $ hg archive ../test-tags
505 $ cat ../test-tags/.hg_archival.txt
505 $ cat ../test-tags/.hg_archival.txt
506 repo: daa7f7c60e0a224faa4ff77ca41b2760562af264
506 repo: daa7f7c60e0a224faa4ff77ca41b2760562af264
507 node: 1701ef1f151069b8747038e93b5186bb43a47504
507 node: 1701ef1f151069b8747038e93b5186bb43a47504
508 branch: default
508 branch: default
509 latesttag: null
509 latesttag: null
510 latesttagdistance: 4
510 latesttagdistance: 4
511 changessincelatesttag: 4
511 changessincelatesttag: 4
512 $ hg tag -r 2 mytag
512 $ hg tag -r 2 mytag
513 $ hg tag -r 2 anothertag
513 $ hg tag -r 2 anothertag
514 $ hg archive -r 2 ../test-lasttag
514 $ hg archive -r 2 ../test-lasttag
515 $ cat ../test-lasttag/.hg_archival.txt
515 $ cat ../test-lasttag/.hg_archival.txt
516 repo: daa7f7c60e0a224faa4ff77ca41b2760562af264
516 repo: daa7f7c60e0a224faa4ff77ca41b2760562af264
517 node: 2c0277f05ed49d1c8328fb9ba92fba7a5ebcb33e
517 node: 2c0277f05ed49d1c8328fb9ba92fba7a5ebcb33e
518 branch: default
518 branch: default
519 tag: anothertag
519 tag: anothertag
520 tag: mytag
520 tag: mytag
521
521
522 $ hg archive -t bogus test.bogus
522 $ hg archive -t bogus test.bogus
523 abort: unknown archive type 'bogus'
523 abort: unknown archive type 'bogus'
524 [255]
524 [255]
525
525
526 enable progress extension:
526 enable progress extension:
527
527
528 $ cp $HGRCPATH $HGRCPATH.no-progress
528 $ cp $HGRCPATH $HGRCPATH.no-progress
529 $ cat >> $HGRCPATH <<EOF
529 $ cat >> $HGRCPATH <<EOF
530 > [progress]
530 > [progress]
531 > assume-tty = 1
531 > assume-tty = 1
532 > format = topic bar number
532 > format = topic bar number
533 > delay = 0
533 > delay = 0
534 > refresh = 0
534 > refresh = 0
535 > width = 60
535 > width = 60
536 > EOF
536 > EOF
537
537
538 $ hg archive ../with-progress
538 $ hg archive ../with-progress
539 \r (no-eol) (esc)
539 \r (no-eol) (esc)
540 archiving [ ] 0/6\r (no-eol) (esc)
540 archiving [ ] 0/6\r (no-eol) (esc)
541 archiving [======> ] 1/6\r (no-eol) (esc)
541 archiving [======> ] 1/6\r (no-eol) (esc)
542 archiving [=============> ] 2/6\r (no-eol) (esc)
542 archiving [=============> ] 2/6\r (no-eol) (esc)
543 archiving [====================> ] 3/6\r (no-eol) (esc)
543 archiving [====================> ] 3/6\r (no-eol) (esc)
544 archiving [===========================> ] 4/6\r (no-eol) (esc)
544 archiving [===========================> ] 4/6\r (no-eol) (esc)
545 archiving [==================================> ] 5/6\r (no-eol) (esc)
545 archiving [==================================> ] 5/6\r (no-eol) (esc)
546 archiving [==========================================>] 6/6\r (no-eol) (esc)
546 archiving [==========================================>] 6/6\r (no-eol) (esc)
547 \r (no-eol) (esc)
547 \r (no-eol) (esc)
548
548
549 cleanup after progress extension test:
549 cleanup after progress extension test:
550
550
551 $ cp $HGRCPATH.no-progress $HGRCPATH
551 $ cp $HGRCPATH.no-progress $HGRCPATH
552
552
553 server errors
553 server errors
554
554
555 $ cat errors.log
555 $ cat errors.log
556
556
557 empty repo
557 empty repo
558
558
559 $ hg init ../empty
559 $ hg init ../empty
560 $ cd ../empty
560 $ cd ../empty
561 $ hg archive ../test-empty
561 $ hg archive ../test-empty
562 abort: no working directory: please specify a revision
562 abort: no working directory: please specify a revision
563 [10]
563 [10]
564
564
565 old file -- date clamped to 1980
565 old file -- date clamped to 1980
566
566
567 $ touch -t 197501010000 old
567 $ touch -t 197501010000 old
568 $ hg add old
568 $ hg add old
569 $ hg commit -m old
569 $ hg commit -m old
570 $ hg archive ../old.zip
570 $ hg archive ../old.zip
571 $ unzip -l ../old.zip | grep -v -- ----- | egrep -v files$
571 $ unzip -l ../old.zip | grep -v -- ----- | egrep -v files$
572 Archive: ../old.zip
572 Archive: ../old.zip
573 \s*Length.* (re)
573 \s*Length.* (re)
574 *172*80*00:00*old/.hg_archival.txt (glob)
574 *172*80*00:00*old/.hg_archival.txt (glob)
575 *0*80*00:00*old/old (glob)
575 *0*80*00:00*old/old (glob)
576
576
577 test xz support only available in Python 3.4
577 test xz support only available in Python 3.4
578
578
579 #if lzma
579 #if lzma
580 $ hg archive ../archive.txz
580 $ hg archive ../archive.txz
581 $ which xz >/dev/null && xz -l ../archive.txz | head -n1 || true
581 $ which xz >/dev/null && xz -l ../archive.txz | head -n1 || true
582 Strms Blocks Compressed Uncompressed Ratio Check Filename (xz !)
582 Strms Blocks Compressed Uncompressed Ratio Check Filename (xz !)
583 $ rm -f ../archive.txz
583 $ rm -f ../archive.txz
584 #endif
584 #endif
585 #if py3 no-lzma
585 #if py3 no-lzma
586 $ hg archive ../archive.txz
586 $ hg archive ../archive.txz
587 abort: lzma module is not available
587 abort: lzma module is not available
588 [255]
588 [255]
589 #endif
589 #endif
590 #if no-py3
590 #if no-py3
591 $ hg archive ../archive.txz
591 $ hg archive ../archive.txz
592 abort: xz compression is only available in Python 3
592 abort: xz compression is only available in Python 3
593 [255]
593 [255]
594 #endif
594 #endif
595
595
596 show an error when a provided pattern matches no files
596 show an error when a provided pattern matches no files
597
597
598 $ hg archive -I file_that_does_not_exist.foo ../empty.zip
598 $ hg archive -I file_that_does_not_exist.foo ../empty.zip
599 abort: no files match the archive pattern
599 abort: no files match the archive pattern
600 [255]
600 [255]
601
601
602 $ hg archive -X * ../empty.zip
602 $ hg archive -X * ../empty.zip
603 abort: no files match the archive pattern
603 abort: no files match the archive pattern
604 [255]
604 [255]
605
605
606 $ cd ..
606 $ cd ..
607
607
608 issue3600: check whether "hg archive" can create archive files which
608 issue3600: check whether "hg archive" can create archive files which
609 are extracted with expected timestamp, even though TZ is not
609 are extracted with expected timestamp, even though TZ is not
610 configured as GMT.
610 configured as GMT.
611
611
612 $ mkdir issue3600
612 $ mkdir issue3600
613 $ cd issue3600
613 $ cd issue3600
614
614
615 $ hg init repo
615 $ hg init repo
616 $ echo a > repo/a
616 $ echo a > repo/a
617 $ hg -R repo add repo/a
617 $ hg -R repo add repo/a
618 $ hg -R repo commit -m '#0' -d '456789012 21600'
618 $ hg -R repo commit -m '#0' -d '456789012 21600'
619 $ cat > show_mtime.py <<EOF
619 $ cat > show_mtime.py <<EOF
620 > from __future__ import absolute_import, print_function
620 > from __future__ import absolute_import, print_function
621 > import os
621 > import os
622 > import sys
622 > import sys
623 > print(int(os.stat(sys.argv[1]).st_mtime))
623 > print(int(os.stat(sys.argv[1]).st_mtime))
624 > EOF
624 > EOF
625
625
626 $ hg -R repo archive --prefix tar-extracted archive.tar
626 $ hg -R repo archive --prefix tar-extracted archive.tar
627 $ (TZ=UTC-3; export TZ; tar xf archive.tar)
627 $ (TZ=UTC-3; export TZ; tar xf archive.tar)
628 $ "$PYTHON" show_mtime.py tar-extracted/a
628 $ "$PYTHON" show_mtime.py tar-extracted/a
629 456789012
629 456789012
630
630
631 $ hg -R repo archive --prefix zip-extracted archive.zip
631 $ hg -R repo archive --prefix zip-extracted archive.zip
632 $ (TZ=UTC-3; export TZ; unzip -q archive.zip)
632 $ (TZ=UTC-3; export TZ; unzip -q archive.zip)
633 $ "$PYTHON" show_mtime.py zip-extracted/a
633 $ "$PYTHON" show_mtime.py zip-extracted/a
634 456789012
634 456789012
635
635
636 $ cd ..
636 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now