##// END OF EJS Templates
hgweb: test the order of archive links
av6 -
r30747:4259df51 default
parent child Browse files
Show More
@@ -1,371 +1,378 b''
1 #require serve
1 #require serve
2
2
3 $ hg init test
3 $ hg init test
4 $ cd test
4 $ cd test
5 $ echo foo>foo
5 $ echo foo>foo
6 $ hg commit -Am 1 -d '1 0'
6 $ hg commit -Am 1 -d '1 0'
7 adding foo
7 adding foo
8 $ echo bar>bar
8 $ echo bar>bar
9 $ hg commit -Am 2 -d '2 0'
9 $ hg commit -Am 2 -d '2 0'
10 adding bar
10 adding bar
11 $ mkdir baz
11 $ mkdir baz
12 $ echo bletch>baz/bletch
12 $ echo bletch>baz/bletch
13 $ hg commit -Am 3 -d '1000000000 0'
13 $ hg commit -Am 3 -d '1000000000 0'
14 adding baz/bletch
14 adding baz/bletch
15 $ hg init subrepo
15 $ hg init subrepo
16 $ touch subrepo/sub
16 $ touch subrepo/sub
17 $ hg -q -R subrepo ci -Am "init subrepo"
17 $ hg -q -R subrepo ci -Am "init subrepo"
18 $ echo "subrepo = subrepo" > .hgsub
18 $ echo "subrepo = subrepo" > .hgsub
19 $ hg add .hgsub
19 $ hg add .hgsub
20 $ hg ci -m "add subrepo"
20 $ hg ci -m "add subrepo"
21 $ echo "[web]" >> .hg/hgrc
21 $ echo "[web]" >> .hg/hgrc
22 $ echo "name = test-archive" >> .hg/hgrc
22 $ echo "name = test-archive" >> .hg/hgrc
23 $ echo "archivesubrepos = True" >> .hg/hgrc
23 $ echo "archivesubrepos = True" >> .hg/hgrc
24 $ cp .hg/hgrc .hg/hgrc-base
24 $ cp .hg/hgrc .hg/hgrc-base
25 > test_archtype() {
25 > test_archtype() {
26 > echo "allow_archive = $1" >> .hg/hgrc
26 > echo "allow_archive = $1" >> .hg/hgrc
27 > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
27 > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
28 > cat hg.pid >> $DAEMON_PIDS
28 > cat hg.pid >> $DAEMON_PIDS
29 > echo % $1 allowed should give 200
29 > echo % $1 allowed should give 200
30 > get-with-headers.py localhost:$HGPORT "archive/tip.$2" | head -n 1
30 > get-with-headers.py localhost:$HGPORT "archive/tip.$2" | head -n 1
31 > echo % $3 and $4 disallowed should both give 403
31 > echo % $3 and $4 disallowed should both give 403
32 > get-with-headers.py localhost:$HGPORT "archive/tip.$3" | head -n 1
32 > get-with-headers.py localhost:$HGPORT "archive/tip.$3" | head -n 1
33 > get-with-headers.py localhost:$HGPORT "archive/tip.$4" | head -n 1
33 > get-with-headers.py localhost:$HGPORT "archive/tip.$4" | head -n 1
34 > killdaemons.py
34 > killdaemons.py
35 > cat errors.log
35 > cat errors.log
36 > cp .hg/hgrc-base .hg/hgrc
36 > cp .hg/hgrc-base .hg/hgrc
37 > }
37 > }
38
38
39 check http return codes
39 check http return codes
40
40
41 $ test_archtype gz tar.gz tar.bz2 zip
41 $ test_archtype gz tar.gz tar.bz2 zip
42 % gz allowed should give 200
42 % gz allowed should give 200
43 200 Script output follows
43 200 Script output follows
44 % tar.bz2 and zip disallowed should both give 403
44 % tar.bz2 and zip disallowed should both give 403
45 403 Archive type not allowed: bz2
45 403 Archive type not allowed: bz2
46 403 Archive type not allowed: zip
46 403 Archive type not allowed: zip
47 $ test_archtype bz2 tar.bz2 zip tar.gz
47 $ test_archtype bz2 tar.bz2 zip tar.gz
48 % bz2 allowed should give 200
48 % bz2 allowed should give 200
49 200 Script output follows
49 200 Script output follows
50 % zip and tar.gz disallowed should both give 403
50 % zip and tar.gz disallowed should both give 403
51 403 Archive type not allowed: zip
51 403 Archive type not allowed: zip
52 403 Archive type not allowed: gz
52 403 Archive type not allowed: gz
53 $ test_archtype zip zip tar.gz tar.bz2
53 $ test_archtype zip zip tar.gz tar.bz2
54 % zip allowed should give 200
54 % zip allowed should give 200
55 200 Script output follows
55 200 Script output follows
56 % tar.gz and tar.bz2 disallowed should both give 403
56 % tar.gz and tar.bz2 disallowed should both give 403
57 403 Archive type not allowed: gz
57 403 Archive type not allowed: gz
58 403 Archive type not allowed: bz2
58 403 Archive type not allowed: bz2
59
59
60 $ echo "allow_archive = gz bz2 zip" >> .hg/hgrc
60 $ echo "allow_archive = gz bz2 zip" >> .hg/hgrc
61 $ hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
61 $ hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
62 $ cat hg.pid >> $DAEMON_PIDS
62 $ cat hg.pid >> $DAEMON_PIDS
63
63
64 check archive links' order
65
66 $ get-with-headers.py localhost:$HGPORT "?revcount=1" | grep '/archive/tip.'
67 <a href="/archive/tip.zip">zip</a>
68 <a href="/archive/tip.tar.gz">gz</a>
69 <a href="/archive/tip.tar.bz2">bz2</a>
70
64 invalid arch type should give 404
71 invalid arch type should give 404
65
72
66 $ get-with-headers.py localhost:$HGPORT "archive/tip.invalid" | head -n 1
73 $ get-with-headers.py localhost:$HGPORT "archive/tip.invalid" | head -n 1
67 404 Unsupported archive type: None
74 404 Unsupported archive type: None
68
75
69 $ TIP=`hg id -v | cut -f1 -d' '`
76 $ TIP=`hg id -v | cut -f1 -d' '`
70 $ QTIP=`hg id -q`
77 $ QTIP=`hg id -q`
71 $ cat > getarchive.py <<EOF
78 $ cat > getarchive.py <<EOF
72 > from __future__ import absolute_import
79 > from __future__ import absolute_import
73 > import os
80 > import os
74 > import sys
81 > import sys
75 > from mercurial import (
82 > from mercurial import (
76 > util,
83 > util,
77 > )
84 > )
78 > try:
85 > try:
79 > # Set stdout to binary mode for win32 platforms
86 > # Set stdout to binary mode for win32 platforms
80 > import msvcrt
87 > import msvcrt
81 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
88 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
82 > except ImportError:
89 > except ImportError:
83 > pass
90 > pass
84 > if len(sys.argv) <= 3:
91 > if len(sys.argv) <= 3:
85 > node, archive = sys.argv[1:]
92 > node, archive = sys.argv[1:]
86 > requeststr = 'cmd=archive;node=%s;type=%s' % (node, archive)
93 > requeststr = 'cmd=archive;node=%s;type=%s' % (node, archive)
87 > else:
94 > else:
88 > node, archive, file = sys.argv[1:]
95 > node, archive, file = sys.argv[1:]
89 > requeststr = 'cmd=archive;node=%s;type=%s;file=%s' % (node, archive, file)
96 > requeststr = 'cmd=archive;node=%s;type=%s;file=%s' % (node, archive, file)
90 > try:
97 > try:
91 > stdout = sys.stdout.buffer
98 > stdout = sys.stdout.buffer
92 > except AttributeError:
99 > except AttributeError:
93 > stdout = sys.stdout
100 > stdout = sys.stdout
94 > try:
101 > try:
95 > f = util.urlreq.urlopen('http://127.0.0.1:%s/?%s'
102 > f = util.urlreq.urlopen('http://127.0.0.1:%s/?%s'
96 > % (os.environ['HGPORT'], requeststr))
103 > % (os.environ['HGPORT'], requeststr))
97 > stdout.write(f.read())
104 > stdout.write(f.read())
98 > except util.urlerr.httperror as e:
105 > except util.urlerr.httperror as e:
99 > sys.stderr.write(str(e) + '\n')
106 > sys.stderr.write(str(e) + '\n')
100 > EOF
107 > EOF
101 $ python getarchive.py "$TIP" gz | gunzip | tar tf - 2>/dev/null
108 $ python getarchive.py "$TIP" gz | gunzip | tar tf - 2>/dev/null
102 test-archive-1701ef1f1510/.hg_archival.txt
109 test-archive-1701ef1f1510/.hg_archival.txt
103 test-archive-1701ef1f1510/.hgsub
110 test-archive-1701ef1f1510/.hgsub
104 test-archive-1701ef1f1510/.hgsubstate
111 test-archive-1701ef1f1510/.hgsubstate
105 test-archive-1701ef1f1510/bar
112 test-archive-1701ef1f1510/bar
106 test-archive-1701ef1f1510/baz/bletch
113 test-archive-1701ef1f1510/baz/bletch
107 test-archive-1701ef1f1510/foo
114 test-archive-1701ef1f1510/foo
108 test-archive-1701ef1f1510/subrepo/sub
115 test-archive-1701ef1f1510/subrepo/sub
109 $ python getarchive.py "$TIP" bz2 | bunzip2 | tar tf - 2>/dev/null
116 $ python getarchive.py "$TIP" bz2 | bunzip2 | tar tf - 2>/dev/null
110 test-archive-1701ef1f1510/.hg_archival.txt
117 test-archive-1701ef1f1510/.hg_archival.txt
111 test-archive-1701ef1f1510/.hgsub
118 test-archive-1701ef1f1510/.hgsub
112 test-archive-1701ef1f1510/.hgsubstate
119 test-archive-1701ef1f1510/.hgsubstate
113 test-archive-1701ef1f1510/bar
120 test-archive-1701ef1f1510/bar
114 test-archive-1701ef1f1510/baz/bletch
121 test-archive-1701ef1f1510/baz/bletch
115 test-archive-1701ef1f1510/foo
122 test-archive-1701ef1f1510/foo
116 test-archive-1701ef1f1510/subrepo/sub
123 test-archive-1701ef1f1510/subrepo/sub
117 $ python getarchive.py "$TIP" zip > archive.zip
124 $ python getarchive.py "$TIP" zip > archive.zip
118 $ unzip -t archive.zip
125 $ unzip -t archive.zip
119 Archive: archive.zip
126 Archive: archive.zip
120 testing: test-archive-1701ef1f1510/.hg_archival.txt*OK (glob)
127 testing: test-archive-1701ef1f1510/.hg_archival.txt*OK (glob)
121 testing: test-archive-1701ef1f1510/.hgsub*OK (glob)
128 testing: test-archive-1701ef1f1510/.hgsub*OK (glob)
122 testing: test-archive-1701ef1f1510/.hgsubstate*OK (glob)
129 testing: test-archive-1701ef1f1510/.hgsubstate*OK (glob)
123 testing: test-archive-1701ef1f1510/bar*OK (glob)
130 testing: test-archive-1701ef1f1510/bar*OK (glob)
124 testing: test-archive-1701ef1f1510/baz/bletch*OK (glob)
131 testing: test-archive-1701ef1f1510/baz/bletch*OK (glob)
125 testing: test-archive-1701ef1f1510/foo*OK (glob)
132 testing: test-archive-1701ef1f1510/foo*OK (glob)
126 testing: test-archive-1701ef1f1510/subrepo/sub*OK (glob)
133 testing: test-archive-1701ef1f1510/subrepo/sub*OK (glob)
127 No errors detected in compressed data of archive.zip.
134 No errors detected in compressed data of archive.zip.
128
135
129 test that we can download single directories and files
136 test that we can download single directories and files
130
137
131 $ python getarchive.py "$TIP" gz baz | gunzip | tar tf - 2>/dev/null
138 $ python getarchive.py "$TIP" gz baz | gunzip | tar tf - 2>/dev/null
132 test-archive-1701ef1f1510/baz/bletch
139 test-archive-1701ef1f1510/baz/bletch
133 $ python getarchive.py "$TIP" gz foo | gunzip | tar tf - 2>/dev/null
140 $ python getarchive.py "$TIP" gz foo | gunzip | tar tf - 2>/dev/null
134 test-archive-1701ef1f1510/foo
141 test-archive-1701ef1f1510/foo
135
142
136 test that we detect file patterns that match no files
143 test that we detect file patterns that match no files
137
144
138 $ python getarchive.py "$TIP" gz foobar
145 $ python getarchive.py "$TIP" gz foobar
139 HTTP Error 404: file(s) not found: foobar
146 HTTP Error 404: file(s) not found: foobar
140
147
141 test that we reject unsafe patterns
148 test that we reject unsafe patterns
142
149
143 $ python getarchive.py "$TIP" gz relre:baz
150 $ python getarchive.py "$TIP" gz relre:baz
144 HTTP Error 404: file(s) not found: relre:baz
151 HTTP Error 404: file(s) not found: relre:baz
145
152
146 $ killdaemons.py
153 $ killdaemons.py
147
154
148 $ hg archive -t tar test.tar
155 $ hg archive -t tar test.tar
149 $ tar tf test.tar
156 $ tar tf test.tar
150 test/.hg_archival.txt
157 test/.hg_archival.txt
151 test/.hgsub
158 test/.hgsub
152 test/.hgsubstate
159 test/.hgsubstate
153 test/bar
160 test/bar
154 test/baz/bletch
161 test/baz/bletch
155 test/foo
162 test/foo
156
163
157 $ hg archive --debug -t tbz2 -X baz test.tar.bz2 --config progress.debug=true
164 $ hg archive --debug -t tbz2 -X baz test.tar.bz2 --config progress.debug=true
158 archiving: 0/4 files (0.00%)
165 archiving: 0/4 files (0.00%)
159 archiving: .hgsub 1/4 files (25.00%)
166 archiving: .hgsub 1/4 files (25.00%)
160 archiving: .hgsubstate 2/4 files (50.00%)
167 archiving: .hgsubstate 2/4 files (50.00%)
161 archiving: bar 3/4 files (75.00%)
168 archiving: bar 3/4 files (75.00%)
162 archiving: foo 4/4 files (100.00%)
169 archiving: foo 4/4 files (100.00%)
163 $ bunzip2 -dc test.tar.bz2 | tar tf - 2>/dev/null
170 $ bunzip2 -dc test.tar.bz2 | tar tf - 2>/dev/null
164 test/.hg_archival.txt
171 test/.hg_archival.txt
165 test/.hgsub
172 test/.hgsub
166 test/.hgsubstate
173 test/.hgsubstate
167 test/bar
174 test/bar
168 test/foo
175 test/foo
169
176
170 $ hg archive -t tgz -p %b-%h test-%h.tar.gz
177 $ hg archive -t tgz -p %b-%h test-%h.tar.gz
171 $ gzip -dc test-$QTIP.tar.gz | tar tf - 2>/dev/null
178 $ gzip -dc test-$QTIP.tar.gz | tar tf - 2>/dev/null
172 test-1701ef1f1510/.hg_archival.txt
179 test-1701ef1f1510/.hg_archival.txt
173 test-1701ef1f1510/.hgsub
180 test-1701ef1f1510/.hgsub
174 test-1701ef1f1510/.hgsubstate
181 test-1701ef1f1510/.hgsubstate
175 test-1701ef1f1510/bar
182 test-1701ef1f1510/bar
176 test-1701ef1f1510/baz/bletch
183 test-1701ef1f1510/baz/bletch
177 test-1701ef1f1510/foo
184 test-1701ef1f1510/foo
178
185
179 $ hg archive autodetected_test.tar
186 $ hg archive autodetected_test.tar
180 $ tar tf autodetected_test.tar
187 $ tar tf autodetected_test.tar
181 autodetected_test/.hg_archival.txt
188 autodetected_test/.hg_archival.txt
182 autodetected_test/.hgsub
189 autodetected_test/.hgsub
183 autodetected_test/.hgsubstate
190 autodetected_test/.hgsubstate
184 autodetected_test/bar
191 autodetected_test/bar
185 autodetected_test/baz/bletch
192 autodetected_test/baz/bletch
186 autodetected_test/foo
193 autodetected_test/foo
187
194
188 The '-t' should override autodetection
195 The '-t' should override autodetection
189
196
190 $ hg archive -t tar autodetect_override_test.zip
197 $ hg archive -t tar autodetect_override_test.zip
191 $ tar tf autodetect_override_test.zip
198 $ tar tf autodetect_override_test.zip
192 autodetect_override_test.zip/.hg_archival.txt
199 autodetect_override_test.zip/.hg_archival.txt
193 autodetect_override_test.zip/.hgsub
200 autodetect_override_test.zip/.hgsub
194 autodetect_override_test.zip/.hgsubstate
201 autodetect_override_test.zip/.hgsubstate
195 autodetect_override_test.zip/bar
202 autodetect_override_test.zip/bar
196 autodetect_override_test.zip/baz/bletch
203 autodetect_override_test.zip/baz/bletch
197 autodetect_override_test.zip/foo
204 autodetect_override_test.zip/foo
198
205
199 $ for ext in tar tar.gz tgz tar.bz2 tbz2 zip; do
206 $ for ext in tar tar.gz tgz tar.bz2 tbz2 zip; do
200 > hg archive auto_test.$ext
207 > hg archive auto_test.$ext
201 > if [ -d auto_test.$ext ]; then
208 > if [ -d auto_test.$ext ]; then
202 > echo "extension $ext was not autodetected."
209 > echo "extension $ext was not autodetected."
203 > fi
210 > fi
204 > done
211 > done
205
212
206 $ cat > md5comp.py <<EOF
213 $ cat > md5comp.py <<EOF
207 > from __future__ import print_function
214 > from __future__ import print_function
208 > try:
215 > try:
209 > from hashlib import md5
216 > from hashlib import md5
210 > except ImportError:
217 > except ImportError:
211 > from md5 import md5
218 > from md5 import md5
212 > import sys
219 > import sys
213 > f1, f2 = sys.argv[1:3]
220 > f1, f2 = sys.argv[1:3]
214 > h1 = md5(open(f1, 'rb').read()).hexdigest()
221 > h1 = md5(open(f1, 'rb').read()).hexdigest()
215 > h2 = md5(open(f2, 'rb').read()).hexdigest()
222 > h2 = md5(open(f2, 'rb').read()).hexdigest()
216 > print(h1 == h2 or "md5 differ: " + repr((h1, h2)))
223 > print(h1 == h2 or "md5 differ: " + repr((h1, h2)))
217 > EOF
224 > EOF
218
225
219 archive name is stored in the archive, so create similar archives and
226 archive name is stored in the archive, so create similar archives and
220 rename them afterwards.
227 rename them afterwards.
221
228
222 $ hg archive -t tgz tip.tar.gz
229 $ hg archive -t tgz tip.tar.gz
223 $ mv tip.tar.gz tip1.tar.gz
230 $ mv tip.tar.gz tip1.tar.gz
224 $ sleep 1
231 $ sleep 1
225 $ hg archive -t tgz tip.tar.gz
232 $ hg archive -t tgz tip.tar.gz
226 $ mv tip.tar.gz tip2.tar.gz
233 $ mv tip.tar.gz tip2.tar.gz
227 $ python md5comp.py tip1.tar.gz tip2.tar.gz
234 $ python md5comp.py tip1.tar.gz tip2.tar.gz
228 True
235 True
229
236
230 $ hg archive -t zip -p /illegal test.zip
237 $ hg archive -t zip -p /illegal test.zip
231 abort: archive prefix contains illegal components
238 abort: archive prefix contains illegal components
232 [255]
239 [255]
233 $ hg archive -t zip -p very/../bad test.zip
240 $ hg archive -t zip -p very/../bad test.zip
234
241
235 $ hg archive --config ui.archivemeta=false -t zip -r 2 test.zip
242 $ hg archive --config ui.archivemeta=false -t zip -r 2 test.zip
236 $ unzip -t test.zip
243 $ unzip -t test.zip
237 Archive: test.zip
244 Archive: test.zip
238 testing: test/bar*OK (glob)
245 testing: test/bar*OK (glob)
239 testing: test/baz/bletch*OK (glob)
246 testing: test/baz/bletch*OK (glob)
240 testing: test/foo*OK (glob)
247 testing: test/foo*OK (glob)
241 No errors detected in compressed data of test.zip.
248 No errors detected in compressed data of test.zip.
242
249
243 $ hg archive -t tar - | tar tf - 2>/dev/null
250 $ hg archive -t tar - | tar tf - 2>/dev/null
244 test-1701ef1f1510/.hg_archival.txt
251 test-1701ef1f1510/.hg_archival.txt
245 test-1701ef1f1510/.hgsub
252 test-1701ef1f1510/.hgsub
246 test-1701ef1f1510/.hgsubstate
253 test-1701ef1f1510/.hgsubstate
247 test-1701ef1f1510/bar
254 test-1701ef1f1510/bar
248 test-1701ef1f1510/baz/bletch
255 test-1701ef1f1510/baz/bletch
249 test-1701ef1f1510/foo
256 test-1701ef1f1510/foo
250
257
251 $ hg archive -r 0 -t tar rev-%r.tar
258 $ hg archive -r 0 -t tar rev-%r.tar
252 $ [ -f rev-0.tar ]
259 $ [ -f rev-0.tar ]
253
260
254 test .hg_archival.txt
261 test .hg_archival.txt
255
262
256 $ hg archive ../test-tags
263 $ hg archive ../test-tags
257 $ cat ../test-tags/.hg_archival.txt
264 $ cat ../test-tags/.hg_archival.txt
258 repo: daa7f7c60e0a224faa4ff77ca41b2760562af264
265 repo: daa7f7c60e0a224faa4ff77ca41b2760562af264
259 node: 1701ef1f151069b8747038e93b5186bb43a47504
266 node: 1701ef1f151069b8747038e93b5186bb43a47504
260 branch: default
267 branch: default
261 latesttag: null
268 latesttag: null
262 latesttagdistance: 4
269 latesttagdistance: 4
263 changessincelatesttag: 4
270 changessincelatesttag: 4
264 $ hg tag -r 2 mytag
271 $ hg tag -r 2 mytag
265 $ hg tag -r 2 anothertag
272 $ hg tag -r 2 anothertag
266 $ hg archive -r 2 ../test-lasttag
273 $ hg archive -r 2 ../test-lasttag
267 $ cat ../test-lasttag/.hg_archival.txt
274 $ cat ../test-lasttag/.hg_archival.txt
268 repo: daa7f7c60e0a224faa4ff77ca41b2760562af264
275 repo: daa7f7c60e0a224faa4ff77ca41b2760562af264
269 node: 2c0277f05ed49d1c8328fb9ba92fba7a5ebcb33e
276 node: 2c0277f05ed49d1c8328fb9ba92fba7a5ebcb33e
270 branch: default
277 branch: default
271 tag: anothertag
278 tag: anothertag
272 tag: mytag
279 tag: mytag
273
280
274 $ hg archive -t bogus test.bogus
281 $ hg archive -t bogus test.bogus
275 abort: unknown archive type 'bogus'
282 abort: unknown archive type 'bogus'
276 [255]
283 [255]
277
284
278 enable progress extension:
285 enable progress extension:
279
286
280 $ cp $HGRCPATH $HGRCPATH.no-progress
287 $ cp $HGRCPATH $HGRCPATH.no-progress
281 $ cat >> $HGRCPATH <<EOF
288 $ cat >> $HGRCPATH <<EOF
282 > [progress]
289 > [progress]
283 > assume-tty = 1
290 > assume-tty = 1
284 > format = topic bar number
291 > format = topic bar number
285 > delay = 0
292 > delay = 0
286 > refresh = 0
293 > refresh = 0
287 > width = 60
294 > width = 60
288 > EOF
295 > EOF
289
296
290 $ hg archive ../with-progress
297 $ hg archive ../with-progress
291 \r (no-eol) (esc)
298 \r (no-eol) (esc)
292 archiving [ ] 0/6\r (no-eol) (esc)
299 archiving [ ] 0/6\r (no-eol) (esc)
293 archiving [======> ] 1/6\r (no-eol) (esc)
300 archiving [======> ] 1/6\r (no-eol) (esc)
294 archiving [=============> ] 2/6\r (no-eol) (esc)
301 archiving [=============> ] 2/6\r (no-eol) (esc)
295 archiving [====================> ] 3/6\r (no-eol) (esc)
302 archiving [====================> ] 3/6\r (no-eol) (esc)
296 archiving [===========================> ] 4/6\r (no-eol) (esc)
303 archiving [===========================> ] 4/6\r (no-eol) (esc)
297 archiving [==================================> ] 5/6\r (no-eol) (esc)
304 archiving [==================================> ] 5/6\r (no-eol) (esc)
298 archiving [==========================================>] 6/6\r (no-eol) (esc)
305 archiving [==========================================>] 6/6\r (no-eol) (esc)
299 \r (no-eol) (esc)
306 \r (no-eol) (esc)
300
307
301 cleanup after progress extension test:
308 cleanup after progress extension test:
302
309
303 $ cp $HGRCPATH.no-progress $HGRCPATH
310 $ cp $HGRCPATH.no-progress $HGRCPATH
304
311
305 server errors
312 server errors
306
313
307 $ cat errors.log
314 $ cat errors.log
308
315
309 empty repo
316 empty repo
310
317
311 $ hg init ../empty
318 $ hg init ../empty
312 $ cd ../empty
319 $ cd ../empty
313 $ hg archive ../test-empty
320 $ hg archive ../test-empty
314 abort: no working directory: please specify a revision
321 abort: no working directory: please specify a revision
315 [255]
322 [255]
316
323
317 old file -- date clamped to 1980
324 old file -- date clamped to 1980
318
325
319 $ touch -t 197501010000 old
326 $ touch -t 197501010000 old
320 $ hg add old
327 $ hg add old
321 $ hg commit -m old
328 $ hg commit -m old
322 $ hg archive ../old.zip
329 $ hg archive ../old.zip
323 $ unzip -l ../old.zip
330 $ unzip -l ../old.zip
324 Archive: ../old.zip
331 Archive: ../old.zip
325 \s*Length.* (re)
332 \s*Length.* (re)
326 *-----* (glob)
333 *-----* (glob)
327 *172*80*00:00*old/.hg_archival.txt (glob)
334 *172*80*00:00*old/.hg_archival.txt (glob)
328 *0*80*00:00*old/old (glob)
335 *0*80*00:00*old/old (glob)
329 *-----* (glob)
336 *-----* (glob)
330 \s*172\s+2 files (re)
337 \s*172\s+2 files (re)
331
338
332 show an error when a provided pattern matches no files
339 show an error when a provided pattern matches no files
333
340
334 $ hg archive -I file_that_does_not_exist.foo ../empty.zip
341 $ hg archive -I file_that_does_not_exist.foo ../empty.zip
335 abort: no files match the archive pattern
342 abort: no files match the archive pattern
336 [255]
343 [255]
337
344
338 $ hg archive -X * ../empty.zip
345 $ hg archive -X * ../empty.zip
339 abort: no files match the archive pattern
346 abort: no files match the archive pattern
340 [255]
347 [255]
341
348
342 $ cd ..
349 $ cd ..
343
350
344 issue3600: check whether "hg archive" can create archive files which
351 issue3600: check whether "hg archive" can create archive files which
345 are extracted with expected timestamp, even though TZ is not
352 are extracted with expected timestamp, even though TZ is not
346 configured as GMT.
353 configured as GMT.
347
354
348 $ mkdir issue3600
355 $ mkdir issue3600
349 $ cd issue3600
356 $ cd issue3600
350
357
351 $ hg init repo
358 $ hg init repo
352 $ echo a > repo/a
359 $ echo a > repo/a
353 $ hg -R repo add repo/a
360 $ hg -R repo add repo/a
354 $ hg -R repo commit -m '#0' -d '456789012 21600'
361 $ hg -R repo commit -m '#0' -d '456789012 21600'
355 $ cat > show_mtime.py <<EOF
362 $ cat > show_mtime.py <<EOF
356 > from __future__ import print_function
363 > from __future__ import print_function
357 > import sys, os
364 > import sys, os
358 > print(int(os.stat(sys.argv[1]).st_mtime))
365 > print(int(os.stat(sys.argv[1]).st_mtime))
359 > EOF
366 > EOF
360
367
361 $ hg -R repo archive --prefix tar-extracted archive.tar
368 $ hg -R repo archive --prefix tar-extracted archive.tar
362 $ (TZ=UTC-3; export TZ; tar xf archive.tar)
369 $ (TZ=UTC-3; export TZ; tar xf archive.tar)
363 $ python show_mtime.py tar-extracted/a
370 $ python show_mtime.py tar-extracted/a
364 456789012
371 456789012
365
372
366 $ hg -R repo archive --prefix zip-extracted archive.zip
373 $ hg -R repo archive --prefix zip-extracted archive.zip
367 $ (TZ=UTC-3; export TZ; unzip -q archive.zip)
374 $ (TZ=UTC-3; export TZ; unzip -q archive.zip)
368 $ python show_mtime.py zip-extracted/a
375 $ python show_mtime.py zip-extracted/a
369 456789012
376 456789012
370
377
371 $ cd ..
378 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now