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