##// END OF EJS Templates
tests: add some (?) output lines to catch "helpful" output from Solaris diff...
Augie Fackler -
r34900:1e2dc50d default
parent child Browse files
Show More
@@ -1,472 +1,474 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) (glob)
35 $TESTTMP/test/subrepo/.hg (no-eol) (glob)
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) (glob)
48 $TESTTMP/test/subrepo/.hg (no-eol) (glob)
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) (glob)
82 $TESTTMP/test/subrepo/.hg (no-eol) (glob)
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 (?)
86 Common subdirectories: archive/subrepo and test/subrepo (?)
85 Only in test/subrepo: .hg
87 Only in test/subrepo: .hg
86 [1]
88 [1]
87 $ rm -rf archive
89 $ rm -rf archive
88
90
89 $ cd test
91 $ cd test
90 $ echo "[web]" >> .hg/hgrc
92 $ echo "[web]" >> .hg/hgrc
91 $ echo "name = test-archive" >> .hg/hgrc
93 $ echo "name = test-archive" >> .hg/hgrc
92 $ echo "archivesubrepos = True" >> .hg/hgrc
94 $ echo "archivesubrepos = True" >> .hg/hgrc
93 $ cp .hg/hgrc .hg/hgrc-base
95 $ cp .hg/hgrc .hg/hgrc-base
94 > test_archtype() {
96 > test_archtype() {
95 > echo "allow_archive = $1" >> .hg/hgrc
97 > echo "allow_archive = $1" >> .hg/hgrc
96 > test_archtype_run "$@"
98 > test_archtype_run "$@"
97 > }
99 > }
98 > test_archtype_deprecated() {
100 > test_archtype_deprecated() {
99 > echo "allow$1 = True" >> .hg/hgrc
101 > echo "allow$1 = True" >> .hg/hgrc
100 > test_archtype_run "$@"
102 > test_archtype_run "$@"
101 > }
103 > }
102 > test_archtype_run() {
104 > test_archtype_run() {
103 > 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 \
104 > --config extensions.blackbox= --config blackbox.track=develwarn
106 > --config extensions.blackbox= --config blackbox.track=develwarn
105 > cat hg.pid >> $DAEMON_PIDS
107 > cat hg.pid >> $DAEMON_PIDS
106 > echo % $1 allowed should give 200
108 > echo % $1 allowed should give 200
107 > get-with-headers.py localhost:$HGPORT "archive/tip.$2" | head -n 1
109 > get-with-headers.py localhost:$HGPORT "archive/tip.$2" | head -n 1
108 > echo % $3 and $4 disallowed should both give 403
110 > echo % $3 and $4 disallowed should both give 403
109 > get-with-headers.py localhost:$HGPORT "archive/tip.$3" | head -n 1
111 > get-with-headers.py localhost:$HGPORT "archive/tip.$3" | head -n 1
110 > get-with-headers.py localhost:$HGPORT "archive/tip.$4" | head -n 1
112 > get-with-headers.py localhost:$HGPORT "archive/tip.$4" | head -n 1
111 > killdaemons.py
113 > killdaemons.py
112 > cat errors.log
114 > cat errors.log
113 > hg blackbox --config extensions.blackbox= --config blackbox.track=
115 > hg blackbox --config extensions.blackbox= --config blackbox.track=
114 > cp .hg/hgrc-base .hg/hgrc
116 > cp .hg/hgrc-base .hg/hgrc
115 > }
117 > }
116
118
117 check http return codes
119 check http return codes
118
120
119 $ test_archtype gz tar.gz tar.bz2 zip
121 $ test_archtype gz tar.gz tar.bz2 zip
120 % gz allowed should give 200
122 % gz allowed should give 200
121 200 Script output follows
123 200 Script output follows
122 % tar.bz2 and zip disallowed should both give 403
124 % tar.bz2 and zip disallowed should both give 403
123 403 Archive type not allowed: bz2
125 403 Archive type not allowed: bz2
124 403 Archive type not allowed: zip
126 403 Archive type not allowed: zip
125 $ test_archtype bz2 tar.bz2 zip tar.gz
127 $ test_archtype bz2 tar.bz2 zip tar.gz
126 % bz2 allowed should give 200
128 % bz2 allowed should give 200
127 200 Script output follows
129 200 Script output follows
128 % zip and tar.gz disallowed should both give 403
130 % zip and tar.gz disallowed should both give 403
129 403 Archive type not allowed: zip
131 403 Archive type not allowed: zip
130 403 Archive type not allowed: gz
132 403 Archive type not allowed: gz
131 $ test_archtype zip zip tar.gz tar.bz2
133 $ test_archtype zip zip tar.gz tar.bz2
132 % zip allowed should give 200
134 % zip allowed should give 200
133 200 Script output follows
135 200 Script output follows
134 % tar.gz and tar.bz2 disallowed should both give 403
136 % tar.gz and tar.bz2 disallowed should both give 403
135 403 Archive type not allowed: gz
137 403 Archive type not allowed: gz
136 403 Archive type not allowed: bz2
138 403 Archive type not allowed: bz2
137
139
138 check http return codes (with deprecated option)
140 check http return codes (with deprecated option)
139
141
140 $ test_archtype_deprecated gz tar.gz tar.bz2 zip
142 $ test_archtype_deprecated gz tar.gz tar.bz2 zip
141 % gz allowed should give 200
143 % gz allowed should give 200
142 200 Script output follows
144 200 Script output follows
143 % tar.bz2 and zip disallowed should both give 403
145 % tar.bz2 and zip disallowed should both give 403
144 403 Archive type not allowed: bz2
146 403 Archive type not allowed: bz2
145 403 Archive type not allowed: zip
147 403 Archive type not allowed: zip
146 $ test_archtype_deprecated bz2 tar.bz2 zip tar.gz
148 $ test_archtype_deprecated bz2 tar.bz2 zip tar.gz
147 % bz2 allowed should give 200
149 % bz2 allowed should give 200
148 200 Script output follows
150 200 Script output follows
149 % zip and tar.gz disallowed should both give 403
151 % zip and tar.gz disallowed should both give 403
150 403 Archive type not allowed: zip
152 403 Archive type not allowed: zip
151 403 Archive type not allowed: gz
153 403 Archive type not allowed: gz
152 $ test_archtype_deprecated zip zip tar.gz tar.bz2
154 $ test_archtype_deprecated zip zip tar.gz tar.bz2
153 % zip allowed should give 200
155 % zip allowed should give 200
154 200 Script output follows
156 200 Script output follows
155 % tar.gz and tar.bz2 disallowed should both give 403
157 % tar.gz and tar.bz2 disallowed should both give 403
156 403 Archive type not allowed: gz
158 403 Archive type not allowed: gz
157 403 Archive type not allowed: bz2
159 403 Archive type not allowed: bz2
158
160
159 $ echo "allow_archive = gz bz2 zip" >> .hg/hgrc
161 $ echo "allow_archive = gz bz2 zip" >> .hg/hgrc
160 $ hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
162 $ hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
161 $ cat hg.pid >> $DAEMON_PIDS
163 $ cat hg.pid >> $DAEMON_PIDS
162
164
163 check archive links' order
165 check archive links' order
164
166
165 $ get-with-headers.py localhost:$HGPORT "?revcount=1" | grep '/archive/tip.'
167 $ get-with-headers.py localhost:$HGPORT "?revcount=1" | grep '/archive/tip.'
166 <a href="/archive/tip.zip">zip</a>
168 <a href="/archive/tip.zip">zip</a>
167 <a href="/archive/tip.tar.gz">gz</a>
169 <a href="/archive/tip.tar.gz">gz</a>
168 <a href="/archive/tip.tar.bz2">bz2</a>
170 <a href="/archive/tip.tar.bz2">bz2</a>
169
171
170 invalid arch type should give 404
172 invalid arch type should give 404
171
173
172 $ get-with-headers.py localhost:$HGPORT "archive/tip.invalid" | head -n 1
174 $ get-with-headers.py localhost:$HGPORT "archive/tip.invalid" | head -n 1
173 404 Unsupported archive type: None
175 404 Unsupported archive type: None
174
176
175 $ TIP=`hg id -v | cut -f1 -d' '`
177 $ TIP=`hg id -v | cut -f1 -d' '`
176 $ QTIP=`hg id -q`
178 $ QTIP=`hg id -q`
177 $ cat > getarchive.py <<EOF
179 $ cat > getarchive.py <<EOF
178 > from __future__ import absolute_import
180 > from __future__ import absolute_import
179 > import os
181 > import os
180 > import sys
182 > import sys
181 > from mercurial import (
183 > from mercurial import (
182 > util,
184 > util,
183 > )
185 > )
184 > try:
186 > try:
185 > # Set stdout to binary mode for win32 platforms
187 > # Set stdout to binary mode for win32 platforms
186 > import msvcrt
188 > import msvcrt
187 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
189 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
188 > except ImportError:
190 > except ImportError:
189 > pass
191 > pass
190 > if len(sys.argv) <= 3:
192 > if len(sys.argv) <= 3:
191 > node, archive = sys.argv[1:]
193 > node, archive = sys.argv[1:]
192 > requeststr = 'cmd=archive;node=%s;type=%s' % (node, archive)
194 > requeststr = 'cmd=archive;node=%s;type=%s' % (node, archive)
193 > else:
195 > else:
194 > node, archive, file = sys.argv[1:]
196 > node, archive, file = sys.argv[1:]
195 > requeststr = 'cmd=archive;node=%s;type=%s;file=%s' % (node, archive, file)
197 > requeststr = 'cmd=archive;node=%s;type=%s;file=%s' % (node, archive, file)
196 > try:
198 > try:
197 > stdout = sys.stdout.buffer
199 > stdout = sys.stdout.buffer
198 > except AttributeError:
200 > except AttributeError:
199 > stdout = sys.stdout
201 > stdout = sys.stdout
200 > try:
202 > try:
201 > f = util.urlreq.urlopen('http://$LOCALIP:%s/?%s'
203 > f = util.urlreq.urlopen('http://$LOCALIP:%s/?%s'
202 > % (os.environ['HGPORT'], requeststr))
204 > % (os.environ['HGPORT'], requeststr))
203 > stdout.write(f.read())
205 > stdout.write(f.read())
204 > except util.urlerr.httperror as e:
206 > except util.urlerr.httperror as e:
205 > sys.stderr.write(str(e) + '\n')
207 > sys.stderr.write(str(e) + '\n')
206 > EOF
208 > EOF
207 $ $PYTHON getarchive.py "$TIP" gz | gunzip | tar tf - 2>/dev/null
209 $ $PYTHON getarchive.py "$TIP" gz | gunzip | tar tf - 2>/dev/null
208 test-archive-1701ef1f1510/.hg_archival.txt
210 test-archive-1701ef1f1510/.hg_archival.txt
209 test-archive-1701ef1f1510/.hgsub
211 test-archive-1701ef1f1510/.hgsub
210 test-archive-1701ef1f1510/.hgsubstate
212 test-archive-1701ef1f1510/.hgsubstate
211 test-archive-1701ef1f1510/bar
213 test-archive-1701ef1f1510/bar
212 test-archive-1701ef1f1510/baz/bletch
214 test-archive-1701ef1f1510/baz/bletch
213 test-archive-1701ef1f1510/foo
215 test-archive-1701ef1f1510/foo
214 test-archive-1701ef1f1510/subrepo/sub
216 test-archive-1701ef1f1510/subrepo/sub
215 $ $PYTHON getarchive.py "$TIP" bz2 | bunzip2 | tar tf - 2>/dev/null
217 $ $PYTHON getarchive.py "$TIP" bz2 | bunzip2 | tar tf - 2>/dev/null
216 test-archive-1701ef1f1510/.hg_archival.txt
218 test-archive-1701ef1f1510/.hg_archival.txt
217 test-archive-1701ef1f1510/.hgsub
219 test-archive-1701ef1f1510/.hgsub
218 test-archive-1701ef1f1510/.hgsubstate
220 test-archive-1701ef1f1510/.hgsubstate
219 test-archive-1701ef1f1510/bar
221 test-archive-1701ef1f1510/bar
220 test-archive-1701ef1f1510/baz/bletch
222 test-archive-1701ef1f1510/baz/bletch
221 test-archive-1701ef1f1510/foo
223 test-archive-1701ef1f1510/foo
222 test-archive-1701ef1f1510/subrepo/sub
224 test-archive-1701ef1f1510/subrepo/sub
223 $ $PYTHON getarchive.py "$TIP" zip > archive.zip
225 $ $PYTHON getarchive.py "$TIP" zip > archive.zip
224 $ unzip -t archive.zip
226 $ unzip -t archive.zip
225 Archive: archive.zip
227 Archive: archive.zip
226 testing: test-archive-1701ef1f1510/.hg_archival.txt*OK (glob)
228 testing: test-archive-1701ef1f1510/.hg_archival.txt*OK (glob)
227 testing: test-archive-1701ef1f1510/.hgsub*OK (glob)
229 testing: test-archive-1701ef1f1510/.hgsub*OK (glob)
228 testing: test-archive-1701ef1f1510/.hgsubstate*OK (glob)
230 testing: test-archive-1701ef1f1510/.hgsubstate*OK (glob)
229 testing: test-archive-1701ef1f1510/bar*OK (glob)
231 testing: test-archive-1701ef1f1510/bar*OK (glob)
230 testing: test-archive-1701ef1f1510/baz/bletch*OK (glob)
232 testing: test-archive-1701ef1f1510/baz/bletch*OK (glob)
231 testing: test-archive-1701ef1f1510/foo*OK (glob)
233 testing: test-archive-1701ef1f1510/foo*OK (glob)
232 testing: test-archive-1701ef1f1510/subrepo/sub*OK (glob)
234 testing: test-archive-1701ef1f1510/subrepo/sub*OK (glob)
233 No errors detected in compressed data of archive.zip.
235 No errors detected in compressed data of archive.zip.
234
236
235 test that we can download single directories and files
237 test that we can download single directories and files
236
238
237 $ $PYTHON getarchive.py "$TIP" gz baz | gunzip | tar tf - 2>/dev/null
239 $ $PYTHON getarchive.py "$TIP" gz baz | gunzip | tar tf - 2>/dev/null
238 test-archive-1701ef1f1510/baz/bletch
240 test-archive-1701ef1f1510/baz/bletch
239 $ $PYTHON getarchive.py "$TIP" gz foo | gunzip | tar tf - 2>/dev/null
241 $ $PYTHON getarchive.py "$TIP" gz foo | gunzip | tar tf - 2>/dev/null
240 test-archive-1701ef1f1510/foo
242 test-archive-1701ef1f1510/foo
241
243
242 test that we detect file patterns that match no files
244 test that we detect file patterns that match no files
243
245
244 $ $PYTHON getarchive.py "$TIP" gz foobar
246 $ $PYTHON getarchive.py "$TIP" gz foobar
245 HTTP Error 404: file(s) not found: foobar
247 HTTP Error 404: file(s) not found: foobar
246
248
247 test that we reject unsafe patterns
249 test that we reject unsafe patterns
248
250
249 $ $PYTHON getarchive.py "$TIP" gz relre:baz
251 $ $PYTHON getarchive.py "$TIP" gz relre:baz
250 HTTP Error 404: file(s) not found: relre:baz
252 HTTP Error 404: file(s) not found: relre:baz
251
253
252 $ killdaemons.py
254 $ killdaemons.py
253
255
254 $ hg archive -t tar test.tar
256 $ hg archive -t tar test.tar
255 $ tar tf test.tar
257 $ tar tf test.tar
256 test/.hg_archival.txt
258 test/.hg_archival.txt
257 test/.hgsub
259 test/.hgsub
258 test/.hgsubstate
260 test/.hgsubstate
259 test/bar
261 test/bar
260 test/baz/bletch
262 test/baz/bletch
261 test/foo
263 test/foo
262
264
263 $ hg archive --debug -t tbz2 -X baz test.tar.bz2 --config progress.debug=true
265 $ hg archive --debug -t tbz2 -X baz test.tar.bz2 --config progress.debug=true
264 archiving: 0/4 files (0.00%)
266 archiving: 0/4 files (0.00%)
265 archiving: .hgsub 1/4 files (25.00%)
267 archiving: .hgsub 1/4 files (25.00%)
266 archiving: .hgsubstate 2/4 files (50.00%)
268 archiving: .hgsubstate 2/4 files (50.00%)
267 archiving: bar 3/4 files (75.00%)
269 archiving: bar 3/4 files (75.00%)
268 archiving: foo 4/4 files (100.00%)
270 archiving: foo 4/4 files (100.00%)
269 $ bunzip2 -dc test.tar.bz2 | tar tf - 2>/dev/null
271 $ bunzip2 -dc test.tar.bz2 | tar tf - 2>/dev/null
270 test/.hg_archival.txt
272 test/.hg_archival.txt
271 test/.hgsub
273 test/.hgsub
272 test/.hgsubstate
274 test/.hgsubstate
273 test/bar
275 test/bar
274 test/foo
276 test/foo
275
277
276 $ hg archive -t tgz -p %b-%h test-%h.tar.gz
278 $ hg archive -t tgz -p %b-%h test-%h.tar.gz
277 $ gzip -dc test-$QTIP.tar.gz | tar tf - 2>/dev/null
279 $ gzip -dc test-$QTIP.tar.gz | tar tf - 2>/dev/null
278 test-1701ef1f1510/.hg_archival.txt
280 test-1701ef1f1510/.hg_archival.txt
279 test-1701ef1f1510/.hgsub
281 test-1701ef1f1510/.hgsub
280 test-1701ef1f1510/.hgsubstate
282 test-1701ef1f1510/.hgsubstate
281 test-1701ef1f1510/bar
283 test-1701ef1f1510/bar
282 test-1701ef1f1510/baz/bletch
284 test-1701ef1f1510/baz/bletch
283 test-1701ef1f1510/foo
285 test-1701ef1f1510/foo
284
286
285 $ hg archive autodetected_test.tar
287 $ hg archive autodetected_test.tar
286 $ tar tf autodetected_test.tar
288 $ tar tf autodetected_test.tar
287 autodetected_test/.hg_archival.txt
289 autodetected_test/.hg_archival.txt
288 autodetected_test/.hgsub
290 autodetected_test/.hgsub
289 autodetected_test/.hgsubstate
291 autodetected_test/.hgsubstate
290 autodetected_test/bar
292 autodetected_test/bar
291 autodetected_test/baz/bletch
293 autodetected_test/baz/bletch
292 autodetected_test/foo
294 autodetected_test/foo
293
295
294 The '-t' should override autodetection
296 The '-t' should override autodetection
295
297
296 $ hg archive -t tar autodetect_override_test.zip
298 $ hg archive -t tar autodetect_override_test.zip
297 $ tar tf autodetect_override_test.zip
299 $ tar tf autodetect_override_test.zip
298 autodetect_override_test.zip/.hg_archival.txt
300 autodetect_override_test.zip/.hg_archival.txt
299 autodetect_override_test.zip/.hgsub
301 autodetect_override_test.zip/.hgsub
300 autodetect_override_test.zip/.hgsubstate
302 autodetect_override_test.zip/.hgsubstate
301 autodetect_override_test.zip/bar
303 autodetect_override_test.zip/bar
302 autodetect_override_test.zip/baz/bletch
304 autodetect_override_test.zip/baz/bletch
303 autodetect_override_test.zip/foo
305 autodetect_override_test.zip/foo
304
306
305 $ for ext in tar tar.gz tgz tar.bz2 tbz2 zip; do
307 $ for ext in tar tar.gz tgz tar.bz2 tbz2 zip; do
306 > hg archive auto_test.$ext
308 > hg archive auto_test.$ext
307 > if [ -d auto_test.$ext ]; then
309 > if [ -d auto_test.$ext ]; then
308 > echo "extension $ext was not autodetected."
310 > echo "extension $ext was not autodetected."
309 > fi
311 > fi
310 > done
312 > done
311
313
312 $ cat > md5comp.py <<EOF
314 $ cat > md5comp.py <<EOF
313 > from __future__ import absolute_import, print_function
315 > from __future__ import absolute_import, print_function
314 > import hashlib
316 > import hashlib
315 > import sys
317 > import sys
316 > f1, f2 = sys.argv[1:3]
318 > f1, f2 = sys.argv[1:3]
317 > h1 = hashlib.md5(open(f1, 'rb').read()).hexdigest()
319 > h1 = hashlib.md5(open(f1, 'rb').read()).hexdigest()
318 > h2 = hashlib.md5(open(f2, 'rb').read()).hexdigest()
320 > h2 = hashlib.md5(open(f2, 'rb').read()).hexdigest()
319 > print(h1 == h2 or "md5 differ: " + repr((h1, h2)))
321 > print(h1 == h2 or "md5 differ: " + repr((h1, h2)))
320 > EOF
322 > EOF
321
323
322 archive name is stored in the archive, so create similar archives and
324 archive name is stored in the archive, so create similar archives and
323 rename them afterwards.
325 rename them afterwards.
324
326
325 $ hg archive -t tgz tip.tar.gz
327 $ hg archive -t tgz tip.tar.gz
326 $ mv tip.tar.gz tip1.tar.gz
328 $ mv tip.tar.gz tip1.tar.gz
327 $ sleep 1
329 $ sleep 1
328 $ hg archive -t tgz tip.tar.gz
330 $ hg archive -t tgz tip.tar.gz
329 $ mv tip.tar.gz tip2.tar.gz
331 $ mv tip.tar.gz tip2.tar.gz
330 $ $PYTHON md5comp.py tip1.tar.gz tip2.tar.gz
332 $ $PYTHON md5comp.py tip1.tar.gz tip2.tar.gz
331 True
333 True
332
334
333 $ hg archive -t zip -p /illegal test.zip
335 $ hg archive -t zip -p /illegal test.zip
334 abort: archive prefix contains illegal components
336 abort: archive prefix contains illegal components
335 [255]
337 [255]
336 $ hg archive -t zip -p very/../bad test.zip
338 $ hg archive -t zip -p very/../bad test.zip
337
339
338 $ hg archive --config ui.archivemeta=false -t zip -r 2 test.zip
340 $ hg archive --config ui.archivemeta=false -t zip -r 2 test.zip
339 $ unzip -t test.zip
341 $ unzip -t test.zip
340 Archive: test.zip
342 Archive: test.zip
341 testing: test/bar*OK (glob)
343 testing: test/bar*OK (glob)
342 testing: test/baz/bletch*OK (glob)
344 testing: test/baz/bletch*OK (glob)
343 testing: test/foo*OK (glob)
345 testing: test/foo*OK (glob)
344 No errors detected in compressed data of test.zip.
346 No errors detected in compressed data of test.zip.
345
347
346 $ hg archive -t tar - | tar tf - 2>/dev/null
348 $ hg archive -t tar - | tar tf - 2>/dev/null
347 test-1701ef1f1510/.hg_archival.txt
349 test-1701ef1f1510/.hg_archival.txt
348 test-1701ef1f1510/.hgsub
350 test-1701ef1f1510/.hgsub
349 test-1701ef1f1510/.hgsubstate
351 test-1701ef1f1510/.hgsubstate
350 test-1701ef1f1510/bar
352 test-1701ef1f1510/bar
351 test-1701ef1f1510/baz/bletch
353 test-1701ef1f1510/baz/bletch
352 test-1701ef1f1510/foo
354 test-1701ef1f1510/foo
353
355
354 $ hg archive -r 0 -t tar rev-%r.tar
356 $ hg archive -r 0 -t tar rev-%r.tar
355 $ [ -f rev-0.tar ]
357 $ [ -f rev-0.tar ]
356
358
357 test .hg_archival.txt
359 test .hg_archival.txt
358
360
359 $ hg archive ../test-tags
361 $ hg archive ../test-tags
360 $ cat ../test-tags/.hg_archival.txt
362 $ cat ../test-tags/.hg_archival.txt
361 repo: daa7f7c60e0a224faa4ff77ca41b2760562af264
363 repo: daa7f7c60e0a224faa4ff77ca41b2760562af264
362 node: 1701ef1f151069b8747038e93b5186bb43a47504
364 node: 1701ef1f151069b8747038e93b5186bb43a47504
363 branch: default
365 branch: default
364 latesttag: null
366 latesttag: null
365 latesttagdistance: 4
367 latesttagdistance: 4
366 changessincelatesttag: 4
368 changessincelatesttag: 4
367 $ hg tag -r 2 mytag
369 $ hg tag -r 2 mytag
368 $ hg tag -r 2 anothertag
370 $ hg tag -r 2 anothertag
369 $ hg archive -r 2 ../test-lasttag
371 $ hg archive -r 2 ../test-lasttag
370 $ cat ../test-lasttag/.hg_archival.txt
372 $ cat ../test-lasttag/.hg_archival.txt
371 repo: daa7f7c60e0a224faa4ff77ca41b2760562af264
373 repo: daa7f7c60e0a224faa4ff77ca41b2760562af264
372 node: 2c0277f05ed49d1c8328fb9ba92fba7a5ebcb33e
374 node: 2c0277f05ed49d1c8328fb9ba92fba7a5ebcb33e
373 branch: default
375 branch: default
374 tag: anothertag
376 tag: anothertag
375 tag: mytag
377 tag: mytag
376
378
377 $ hg archive -t bogus test.bogus
379 $ hg archive -t bogus test.bogus
378 abort: unknown archive type 'bogus'
380 abort: unknown archive type 'bogus'
379 [255]
381 [255]
380
382
381 enable progress extension:
383 enable progress extension:
382
384
383 $ cp $HGRCPATH $HGRCPATH.no-progress
385 $ cp $HGRCPATH $HGRCPATH.no-progress
384 $ cat >> $HGRCPATH <<EOF
386 $ cat >> $HGRCPATH <<EOF
385 > [progress]
387 > [progress]
386 > assume-tty = 1
388 > assume-tty = 1
387 > format = topic bar number
389 > format = topic bar number
388 > delay = 0
390 > delay = 0
389 > refresh = 0
391 > refresh = 0
390 > width = 60
392 > width = 60
391 > EOF
393 > EOF
392
394
393 $ hg archive ../with-progress
395 $ hg archive ../with-progress
394 \r (no-eol) (esc)
396 \r (no-eol) (esc)
395 archiving [ ] 0/6\r (no-eol) (esc)
397 archiving [ ] 0/6\r (no-eol) (esc)
396 archiving [======> ] 1/6\r (no-eol) (esc)
398 archiving [======> ] 1/6\r (no-eol) (esc)
397 archiving [=============> ] 2/6\r (no-eol) (esc)
399 archiving [=============> ] 2/6\r (no-eol) (esc)
398 archiving [====================> ] 3/6\r (no-eol) (esc)
400 archiving [====================> ] 3/6\r (no-eol) (esc)
399 archiving [===========================> ] 4/6\r (no-eol) (esc)
401 archiving [===========================> ] 4/6\r (no-eol) (esc)
400 archiving [==================================> ] 5/6\r (no-eol) (esc)
402 archiving [==================================> ] 5/6\r (no-eol) (esc)
401 archiving [==========================================>] 6/6\r (no-eol) (esc)
403 archiving [==========================================>] 6/6\r (no-eol) (esc)
402 \r (no-eol) (esc)
404 \r (no-eol) (esc)
403
405
404 cleanup after progress extension test:
406 cleanup after progress extension test:
405
407
406 $ cp $HGRCPATH.no-progress $HGRCPATH
408 $ cp $HGRCPATH.no-progress $HGRCPATH
407
409
408 server errors
410 server errors
409
411
410 $ cat errors.log
412 $ cat errors.log
411
413
412 empty repo
414 empty repo
413
415
414 $ hg init ../empty
416 $ hg init ../empty
415 $ cd ../empty
417 $ cd ../empty
416 $ hg archive ../test-empty
418 $ hg archive ../test-empty
417 abort: no working directory: please specify a revision
419 abort: no working directory: please specify a revision
418 [255]
420 [255]
419
421
420 old file -- date clamped to 1980
422 old file -- date clamped to 1980
421
423
422 $ touch -t 197501010000 old
424 $ touch -t 197501010000 old
423 $ hg add old
425 $ hg add old
424 $ hg commit -m old
426 $ hg commit -m old
425 $ hg archive ../old.zip
427 $ hg archive ../old.zip
426 $ unzip -l ../old.zip | grep -v -- ----- | egrep -v files$
428 $ unzip -l ../old.zip | grep -v -- ----- | egrep -v files$
427 Archive: ../old.zip
429 Archive: ../old.zip
428 \s*Length.* (re)
430 \s*Length.* (re)
429 *172*80*00:00*old/.hg_archival.txt (glob)
431 *172*80*00:00*old/.hg_archival.txt (glob)
430 *0*80*00:00*old/old (glob)
432 *0*80*00:00*old/old (glob)
431
433
432 show an error when a provided pattern matches no files
434 show an error when a provided pattern matches no files
433
435
434 $ hg archive -I file_that_does_not_exist.foo ../empty.zip
436 $ hg archive -I file_that_does_not_exist.foo ../empty.zip
435 abort: no files match the archive pattern
437 abort: no files match the archive pattern
436 [255]
438 [255]
437
439
438 $ hg archive -X * ../empty.zip
440 $ hg archive -X * ../empty.zip
439 abort: no files match the archive pattern
441 abort: no files match the archive pattern
440 [255]
442 [255]
441
443
442 $ cd ..
444 $ cd ..
443
445
444 issue3600: check whether "hg archive" can create archive files which
446 issue3600: check whether "hg archive" can create archive files which
445 are extracted with expected timestamp, even though TZ is not
447 are extracted with expected timestamp, even though TZ is not
446 configured as GMT.
448 configured as GMT.
447
449
448 $ mkdir issue3600
450 $ mkdir issue3600
449 $ cd issue3600
451 $ cd issue3600
450
452
451 $ hg init repo
453 $ hg init repo
452 $ echo a > repo/a
454 $ echo a > repo/a
453 $ hg -R repo add repo/a
455 $ hg -R repo add repo/a
454 $ hg -R repo commit -m '#0' -d '456789012 21600'
456 $ hg -R repo commit -m '#0' -d '456789012 21600'
455 $ cat > show_mtime.py <<EOF
457 $ cat > show_mtime.py <<EOF
456 > from __future__ import absolute_import, print_function
458 > from __future__ import absolute_import, print_function
457 > import os
459 > import os
458 > import sys
460 > import sys
459 > print(int(os.stat(sys.argv[1]).st_mtime))
461 > print(int(os.stat(sys.argv[1]).st_mtime))
460 > EOF
462 > EOF
461
463
462 $ hg -R repo archive --prefix tar-extracted archive.tar
464 $ hg -R repo archive --prefix tar-extracted archive.tar
463 $ (TZ=UTC-3; export TZ; tar xf archive.tar)
465 $ (TZ=UTC-3; export TZ; tar xf archive.tar)
464 $ $PYTHON show_mtime.py tar-extracted/a
466 $ $PYTHON show_mtime.py tar-extracted/a
465 456789012
467 456789012
466
468
467 $ hg -R repo archive --prefix zip-extracted archive.zip
469 $ hg -R repo archive --prefix zip-extracted archive.zip
468 $ (TZ=UTC-3; export TZ; unzip -q archive.zip)
470 $ (TZ=UTC-3; export TZ; unzip -q archive.zip)
469 $ $PYTHON show_mtime.py zip-extracted/a
471 $ $PYTHON show_mtime.py zip-extracted/a
470 456789012
472 456789012
471
473
472 $ cd ..
474 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now