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