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