Show More
@@ -1,371 +1,371 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 | invalid arch type should give 404 |
|
64 | invalid arch type should give 404 | |
65 |
|
65 | |||
66 | $ get-with-headers.py localhost:$HGPORT "archive/tip.invalid" | head -n 1 |
|
66 | $ get-with-headers.py localhost:$HGPORT "archive/tip.invalid" | head -n 1 | |
67 | 404 Unsupported archive type: None |
|
67 | 404 Unsupported archive type: None | |
68 |
|
68 | |||
69 | $ TIP=`hg id -v | cut -f1 -d' '` |
|
69 | $ TIP=`hg id -v | cut -f1 -d' '` | |
70 | $ QTIP=`hg id -q` |
|
70 | $ QTIP=`hg id -q` | |
71 | $ cat > getarchive.py <<EOF |
|
71 | $ cat > getarchive.py <<EOF | |
72 | > from __future__ import absolute_import |
|
72 | > from __future__ import absolute_import | |
73 | > import os |
|
73 | > import os | |
74 | > import sys |
|
74 | > import sys | |
75 | > from mercurial import ( |
|
75 | > from mercurial import ( | |
76 | > util, |
|
76 | > util, | |
77 | > ) |
|
77 | > ) | |
78 | > try: |
|
78 | > try: | |
79 | > # Set stdout to binary mode for win32 platforms |
|
79 | > # Set stdout to binary mode for win32 platforms | |
80 | > import msvcrt |
|
80 | > import msvcrt | |
81 | > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) |
|
81 | > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) | |
82 | > except ImportError: |
|
82 | > except ImportError: | |
83 | > pass |
|
83 | > pass | |
84 | > if len(sys.argv) <= 3: |
|
84 | > if len(sys.argv) <= 3: | |
85 | > node, archive = sys.argv[1:] |
|
85 | > node, archive = sys.argv[1:] | |
86 | > requeststr = 'cmd=archive;node=%s;type=%s' % (node, archive) |
|
86 | > requeststr = 'cmd=archive;node=%s;type=%s' % (node, archive) | |
87 | > else: |
|
87 | > else: | |
88 | > node, archive, file = sys.argv[1:] |
|
88 | > node, archive, file = sys.argv[1:] | |
89 | > requeststr = 'cmd=archive;node=%s;type=%s;file=%s' % (node, archive, file) |
|
89 | > requeststr = 'cmd=archive;node=%s;type=%s;file=%s' % (node, archive, file) | |
90 | > try: |
|
90 | > try: | |
91 | > stdout = sys.stdout.buffer |
|
91 | > stdout = sys.stdout.buffer | |
92 | > except AttributeError: |
|
92 | > except AttributeError: | |
93 | > stdout = sys.stdout |
|
93 | > stdout = sys.stdout | |
94 | > try: |
|
94 | > try: | |
95 | > f = util.urlreq.urlopen('http://127.0.0.1:%s/?%s' |
|
95 | > f = util.urlreq.urlopen('http://127.0.0.1:%s/?%s' | |
96 | > % (os.environ['HGPORT'], requeststr)) |
|
96 | > % (os.environ['HGPORT'], requeststr)) | |
97 | > stdout.write(f.read()) |
|
97 | > stdout.write(f.read()) | |
98 | > except util.urlerr.httperror as e: |
|
98 | > except util.urlerr.httperror as e: | |
99 | > sys.stderr.write(str(e) + '\n') |
|
99 | > sys.stderr.write(str(e) + '\n') | |
100 | > EOF |
|
100 | > EOF | |
101 | $ python getarchive.py "$TIP" gz | gunzip | tar tf - 2>/dev/null |
|
101 | $ python getarchive.py "$TIP" gz | gunzip | tar tf - 2>/dev/null | |
102 | test-archive-1701ef1f1510/.hg_archival.txt |
|
102 | test-archive-1701ef1f1510/.hg_archival.txt | |
103 | test-archive-1701ef1f1510/.hgsub |
|
103 | test-archive-1701ef1f1510/.hgsub | |
104 | test-archive-1701ef1f1510/.hgsubstate |
|
104 | test-archive-1701ef1f1510/.hgsubstate | |
105 | test-archive-1701ef1f1510/bar |
|
105 | test-archive-1701ef1f1510/bar | |
106 | test-archive-1701ef1f1510/baz/bletch |
|
106 | test-archive-1701ef1f1510/baz/bletch | |
107 | test-archive-1701ef1f1510/foo |
|
107 | test-archive-1701ef1f1510/foo | |
108 | test-archive-1701ef1f1510/subrepo/sub |
|
108 | test-archive-1701ef1f1510/subrepo/sub | |
109 | $ python getarchive.py "$TIP" bz2 | bunzip2 | tar tf - 2>/dev/null |
|
109 | $ python getarchive.py "$TIP" bz2 | bunzip2 | tar tf - 2>/dev/null | |
110 | test-archive-1701ef1f1510/.hg_archival.txt |
|
110 | test-archive-1701ef1f1510/.hg_archival.txt | |
111 | test-archive-1701ef1f1510/.hgsub |
|
111 | test-archive-1701ef1f1510/.hgsub | |
112 | test-archive-1701ef1f1510/.hgsubstate |
|
112 | test-archive-1701ef1f1510/.hgsubstate | |
113 | test-archive-1701ef1f1510/bar |
|
113 | test-archive-1701ef1f1510/bar | |
114 | test-archive-1701ef1f1510/baz/bletch |
|
114 | test-archive-1701ef1f1510/baz/bletch | |
115 | test-archive-1701ef1f1510/foo |
|
115 | test-archive-1701ef1f1510/foo | |
116 | test-archive-1701ef1f1510/subrepo/sub |
|
116 | test-archive-1701ef1f1510/subrepo/sub | |
117 | $ python getarchive.py "$TIP" zip > archive.zip |
|
117 | $ python getarchive.py "$TIP" zip > archive.zip | |
118 | $ unzip -t archive.zip |
|
118 | $ unzip -t archive.zip | |
119 | Archive: archive.zip |
|
119 | Archive: archive.zip | |
120 |
testing: test-archive-1701ef1f1510/.hg_archival.txt |
|
120 | testing: test-archive-1701ef1f1510/.hg_archival.txt*OK (glob) | |
121 |
testing: test-archive-1701ef1f1510/.hgsub |
|
121 | testing: test-archive-1701ef1f1510/.hgsub*OK (glob) | |
122 |
testing: test-archive-1701ef1f1510/.hgsubstate |
|
122 | testing: test-archive-1701ef1f1510/.hgsubstate*OK (glob) | |
123 |
testing: test-archive-1701ef1f1510/bar |
|
123 | testing: test-archive-1701ef1f1510/bar*OK (glob) | |
124 |
testing: test-archive-1701ef1f1510/baz/bletch |
|
124 | testing: test-archive-1701ef1f1510/baz/bletch*OK (glob) | |
125 |
testing: test-archive-1701ef1f1510/foo |
|
125 | testing: test-archive-1701ef1f1510/foo*OK (glob) | |
126 |
testing: test-archive-1701ef1f1510/subrepo/sub |
|
126 | testing: test-archive-1701ef1f1510/subrepo/sub*OK (glob) | |
127 | No errors detected in compressed data of archive.zip. |
|
127 | No errors detected in compressed data of archive.zip. | |
128 |
|
128 | |||
129 | test that we can download single directories and files |
|
129 | test that we can download single directories and files | |
130 |
|
130 | |||
131 | $ python getarchive.py "$TIP" gz baz | gunzip | tar tf - 2>/dev/null |
|
131 | $ python getarchive.py "$TIP" gz baz | gunzip | tar tf - 2>/dev/null | |
132 | test-archive-1701ef1f1510/baz/bletch |
|
132 | test-archive-1701ef1f1510/baz/bletch | |
133 | $ python getarchive.py "$TIP" gz foo | gunzip | tar tf - 2>/dev/null |
|
133 | $ python getarchive.py "$TIP" gz foo | gunzip | tar tf - 2>/dev/null | |
134 | test-archive-1701ef1f1510/foo |
|
134 | test-archive-1701ef1f1510/foo | |
135 |
|
135 | |||
136 | test that we detect file patterns that match no files |
|
136 | test that we detect file patterns that match no files | |
137 |
|
137 | |||
138 | $ python getarchive.py "$TIP" gz foobar |
|
138 | $ python getarchive.py "$TIP" gz foobar | |
139 | HTTP Error 404: file(s) not found: foobar |
|
139 | HTTP Error 404: file(s) not found: foobar | |
140 |
|
140 | |||
141 | test that we reject unsafe patterns |
|
141 | test that we reject unsafe patterns | |
142 |
|
142 | |||
143 | $ python getarchive.py "$TIP" gz relre:baz |
|
143 | $ python getarchive.py "$TIP" gz relre:baz | |
144 | HTTP Error 404: file(s) not found: relre:baz |
|
144 | HTTP Error 404: file(s) not found: relre:baz | |
145 |
|
145 | |||
146 | $ killdaemons.py |
|
146 | $ killdaemons.py | |
147 |
|
147 | |||
148 | $ hg archive -t tar test.tar |
|
148 | $ hg archive -t tar test.tar | |
149 | $ tar tf test.tar |
|
149 | $ tar tf test.tar | |
150 | test/.hg_archival.txt |
|
150 | test/.hg_archival.txt | |
151 | test/.hgsub |
|
151 | test/.hgsub | |
152 | test/.hgsubstate |
|
152 | test/.hgsubstate | |
153 | test/bar |
|
153 | test/bar | |
154 | test/baz/bletch |
|
154 | test/baz/bletch | |
155 | test/foo |
|
155 | test/foo | |
156 |
|
156 | |||
157 | $ hg archive --debug -t tbz2 -X baz test.tar.bz2 --config progress.debug=true |
|
157 | $ hg archive --debug -t tbz2 -X baz test.tar.bz2 --config progress.debug=true | |
158 | archiving: 0/4 files (0.00%) |
|
158 | archiving: 0/4 files (0.00%) | |
159 | archiving: .hgsub 1/4 files (25.00%) |
|
159 | archiving: .hgsub 1/4 files (25.00%) | |
160 | archiving: .hgsubstate 2/4 files (50.00%) |
|
160 | archiving: .hgsubstate 2/4 files (50.00%) | |
161 | archiving: bar 3/4 files (75.00%) |
|
161 | archiving: bar 3/4 files (75.00%) | |
162 | archiving: foo 4/4 files (100.00%) |
|
162 | archiving: foo 4/4 files (100.00%) | |
163 | $ bunzip2 -dc test.tar.bz2 | tar tf - 2>/dev/null |
|
163 | $ bunzip2 -dc test.tar.bz2 | tar tf - 2>/dev/null | |
164 | test/.hg_archival.txt |
|
164 | test/.hg_archival.txt | |
165 | test/.hgsub |
|
165 | test/.hgsub | |
166 | test/.hgsubstate |
|
166 | test/.hgsubstate | |
167 | test/bar |
|
167 | test/bar | |
168 | test/foo |
|
168 | test/foo | |
169 |
|
169 | |||
170 | $ hg archive -t tgz -p %b-%h test-%h.tar.gz |
|
170 | $ hg archive -t tgz -p %b-%h test-%h.tar.gz | |
171 | $ gzip -dc test-$QTIP.tar.gz | tar tf - 2>/dev/null |
|
171 | $ gzip -dc test-$QTIP.tar.gz | tar tf - 2>/dev/null | |
172 | test-1701ef1f1510/.hg_archival.txt |
|
172 | test-1701ef1f1510/.hg_archival.txt | |
173 | test-1701ef1f1510/.hgsub |
|
173 | test-1701ef1f1510/.hgsub | |
174 | test-1701ef1f1510/.hgsubstate |
|
174 | test-1701ef1f1510/.hgsubstate | |
175 | test-1701ef1f1510/bar |
|
175 | test-1701ef1f1510/bar | |
176 | test-1701ef1f1510/baz/bletch |
|
176 | test-1701ef1f1510/baz/bletch | |
177 | test-1701ef1f1510/foo |
|
177 | test-1701ef1f1510/foo | |
178 |
|
178 | |||
179 | $ hg archive autodetected_test.tar |
|
179 | $ hg archive autodetected_test.tar | |
180 | $ tar tf autodetected_test.tar |
|
180 | $ tar tf autodetected_test.tar | |
181 | autodetected_test/.hg_archival.txt |
|
181 | autodetected_test/.hg_archival.txt | |
182 | autodetected_test/.hgsub |
|
182 | autodetected_test/.hgsub | |
183 | autodetected_test/.hgsubstate |
|
183 | autodetected_test/.hgsubstate | |
184 | autodetected_test/bar |
|
184 | autodetected_test/bar | |
185 | autodetected_test/baz/bletch |
|
185 | autodetected_test/baz/bletch | |
186 | autodetected_test/foo |
|
186 | autodetected_test/foo | |
187 |
|
187 | |||
188 | The '-t' should override autodetection |
|
188 | The '-t' should override autodetection | |
189 |
|
189 | |||
190 | $ hg archive -t tar autodetect_override_test.zip |
|
190 | $ hg archive -t tar autodetect_override_test.zip | |
191 | $ tar tf autodetect_override_test.zip |
|
191 | $ tar tf autodetect_override_test.zip | |
192 | autodetect_override_test.zip/.hg_archival.txt |
|
192 | autodetect_override_test.zip/.hg_archival.txt | |
193 | autodetect_override_test.zip/.hgsub |
|
193 | autodetect_override_test.zip/.hgsub | |
194 | autodetect_override_test.zip/.hgsubstate |
|
194 | autodetect_override_test.zip/.hgsubstate | |
195 | autodetect_override_test.zip/bar |
|
195 | autodetect_override_test.zip/bar | |
196 | autodetect_override_test.zip/baz/bletch |
|
196 | autodetect_override_test.zip/baz/bletch | |
197 | autodetect_override_test.zip/foo |
|
197 | autodetect_override_test.zip/foo | |
198 |
|
198 | |||
199 | $ for ext in tar tar.gz tgz tar.bz2 tbz2 zip; do |
|
199 | $ for ext in tar tar.gz tgz tar.bz2 tbz2 zip; do | |
200 | > hg archive auto_test.$ext |
|
200 | > hg archive auto_test.$ext | |
201 | > if [ -d auto_test.$ext ]; then |
|
201 | > if [ -d auto_test.$ext ]; then | |
202 | > echo "extension $ext was not autodetected." |
|
202 | > echo "extension $ext was not autodetected." | |
203 | > fi |
|
203 | > fi | |
204 | > done |
|
204 | > done | |
205 |
|
205 | |||
206 | $ cat > md5comp.py <<EOF |
|
206 | $ cat > md5comp.py <<EOF | |
207 | > from __future__ import print_function |
|
207 | > from __future__ import print_function | |
208 | > try: |
|
208 | > try: | |
209 | > from hashlib import md5 |
|
209 | > from hashlib import md5 | |
210 | > except ImportError: |
|
210 | > except ImportError: | |
211 | > from md5 import md5 |
|
211 | > from md5 import md5 | |
212 | > import sys |
|
212 | > import sys | |
213 | > f1, f2 = sys.argv[1:3] |
|
213 | > f1, f2 = sys.argv[1:3] | |
214 | > h1 = md5(open(f1, 'rb').read()).hexdigest() |
|
214 | > h1 = md5(open(f1, 'rb').read()).hexdigest() | |
215 | > h2 = md5(open(f2, 'rb').read()).hexdigest() |
|
215 | > h2 = md5(open(f2, 'rb').read()).hexdigest() | |
216 | > print(h1 == h2 or "md5 differ: " + repr((h1, h2))) |
|
216 | > print(h1 == h2 or "md5 differ: " + repr((h1, h2))) | |
217 | > EOF |
|
217 | > EOF | |
218 |
|
218 | |||
219 | archive name is stored in the archive, so create similar archives and |
|
219 | archive name is stored in the archive, so create similar archives and | |
220 | rename them afterwards. |
|
220 | rename them afterwards. | |
221 |
|
221 | |||
222 | $ hg archive -t tgz tip.tar.gz |
|
222 | $ hg archive -t tgz tip.tar.gz | |
223 | $ mv tip.tar.gz tip1.tar.gz |
|
223 | $ mv tip.tar.gz tip1.tar.gz | |
224 | $ sleep 1 |
|
224 | $ sleep 1 | |
225 | $ hg archive -t tgz tip.tar.gz |
|
225 | $ hg archive -t tgz tip.tar.gz | |
226 | $ mv tip.tar.gz tip2.tar.gz |
|
226 | $ mv tip.tar.gz tip2.tar.gz | |
227 | $ python md5comp.py tip1.tar.gz tip2.tar.gz |
|
227 | $ python md5comp.py tip1.tar.gz tip2.tar.gz | |
228 | True |
|
228 | True | |
229 |
|
229 | |||
230 | $ hg archive -t zip -p /illegal test.zip |
|
230 | $ hg archive -t zip -p /illegal test.zip | |
231 | abort: archive prefix contains illegal components |
|
231 | abort: archive prefix contains illegal components | |
232 | [255] |
|
232 | [255] | |
233 | $ hg archive -t zip -p very/../bad test.zip |
|
233 | $ hg archive -t zip -p very/../bad test.zip | |
234 |
|
234 | |||
235 | $ hg archive --config ui.archivemeta=false -t zip -r 2 test.zip |
|
235 | $ hg archive --config ui.archivemeta=false -t zip -r 2 test.zip | |
236 | $ unzip -t test.zip |
|
236 | $ unzip -t test.zip | |
237 | Archive: test.zip |
|
237 | Archive: test.zip | |
238 |
testing: test/bar |
|
238 | testing: test/bar*OK (glob) | |
239 |
testing: test/baz/bletch |
|
239 | testing: test/baz/bletch*OK (glob) | |
240 |
testing: test/foo |
|
240 | testing: test/foo*OK (glob) | |
241 | No errors detected in compressed data of test.zip. |
|
241 | No errors detected in compressed data of test.zip. | |
242 |
|
242 | |||
243 | $ hg archive -t tar - | tar tf - 2>/dev/null |
|
243 | $ hg archive -t tar - | tar tf - 2>/dev/null | |
244 | test-1701ef1f1510/.hg_archival.txt |
|
244 | test-1701ef1f1510/.hg_archival.txt | |
245 | test-1701ef1f1510/.hgsub |
|
245 | test-1701ef1f1510/.hgsub | |
246 | test-1701ef1f1510/.hgsubstate |
|
246 | test-1701ef1f1510/.hgsubstate | |
247 | test-1701ef1f1510/bar |
|
247 | test-1701ef1f1510/bar | |
248 | test-1701ef1f1510/baz/bletch |
|
248 | test-1701ef1f1510/baz/bletch | |
249 | test-1701ef1f1510/foo |
|
249 | test-1701ef1f1510/foo | |
250 |
|
250 | |||
251 | $ hg archive -r 0 -t tar rev-%r.tar |
|
251 | $ hg archive -r 0 -t tar rev-%r.tar | |
252 | $ [ -f rev-0.tar ] |
|
252 | $ [ -f rev-0.tar ] | |
253 |
|
253 | |||
254 | test .hg_archival.txt |
|
254 | test .hg_archival.txt | |
255 |
|
255 | |||
256 | $ hg archive ../test-tags |
|
256 | $ hg archive ../test-tags | |
257 | $ cat ../test-tags/.hg_archival.txt |
|
257 | $ cat ../test-tags/.hg_archival.txt | |
258 | repo: daa7f7c60e0a224faa4ff77ca41b2760562af264 |
|
258 | repo: daa7f7c60e0a224faa4ff77ca41b2760562af264 | |
259 | node: 1701ef1f151069b8747038e93b5186bb43a47504 |
|
259 | node: 1701ef1f151069b8747038e93b5186bb43a47504 | |
260 | branch: default |
|
260 | branch: default | |
261 | latesttag: null |
|
261 | latesttag: null | |
262 | latesttagdistance: 4 |
|
262 | latesttagdistance: 4 | |
263 | changessincelatesttag: 4 |
|
263 | changessincelatesttag: 4 | |
264 | $ hg tag -r 2 mytag |
|
264 | $ hg tag -r 2 mytag | |
265 | $ hg tag -r 2 anothertag |
|
265 | $ hg tag -r 2 anothertag | |
266 | $ hg archive -r 2 ../test-lasttag |
|
266 | $ hg archive -r 2 ../test-lasttag | |
267 | $ cat ../test-lasttag/.hg_archival.txt |
|
267 | $ cat ../test-lasttag/.hg_archival.txt | |
268 | repo: daa7f7c60e0a224faa4ff77ca41b2760562af264 |
|
268 | repo: daa7f7c60e0a224faa4ff77ca41b2760562af264 | |
269 | node: 2c0277f05ed49d1c8328fb9ba92fba7a5ebcb33e |
|
269 | node: 2c0277f05ed49d1c8328fb9ba92fba7a5ebcb33e | |
270 | branch: default |
|
270 | branch: default | |
271 | tag: anothertag |
|
271 | tag: anothertag | |
272 | tag: mytag |
|
272 | tag: mytag | |
273 |
|
273 | |||
274 | $ hg archive -t bogus test.bogus |
|
274 | $ hg archive -t bogus test.bogus | |
275 | abort: unknown archive type 'bogus' |
|
275 | abort: unknown archive type 'bogus' | |
276 | [255] |
|
276 | [255] | |
277 |
|
277 | |||
278 | enable progress extension: |
|
278 | enable progress extension: | |
279 |
|
279 | |||
280 | $ cp $HGRCPATH $HGRCPATH.no-progress |
|
280 | $ cp $HGRCPATH $HGRCPATH.no-progress | |
281 | $ cat >> $HGRCPATH <<EOF |
|
281 | $ cat >> $HGRCPATH <<EOF | |
282 | > [progress] |
|
282 | > [progress] | |
283 | > assume-tty = 1 |
|
283 | > assume-tty = 1 | |
284 | > format = topic bar number |
|
284 | > format = topic bar number | |
285 | > delay = 0 |
|
285 | > delay = 0 | |
286 | > refresh = 0 |
|
286 | > refresh = 0 | |
287 | > width = 60 |
|
287 | > width = 60 | |
288 | > EOF |
|
288 | > EOF | |
289 |
|
289 | |||
290 | $ hg archive ../with-progress |
|
290 | $ hg archive ../with-progress | |
291 | \r (no-eol) (esc) |
|
291 | \r (no-eol) (esc) | |
292 | archiving [ ] 0/6\r (no-eol) (esc) |
|
292 | archiving [ ] 0/6\r (no-eol) (esc) | |
293 | archiving [======> ] 1/6\r (no-eol) (esc) |
|
293 | archiving [======> ] 1/6\r (no-eol) (esc) | |
294 | archiving [=============> ] 2/6\r (no-eol) (esc) |
|
294 | archiving [=============> ] 2/6\r (no-eol) (esc) | |
295 | archiving [====================> ] 3/6\r (no-eol) (esc) |
|
295 | archiving [====================> ] 3/6\r (no-eol) (esc) | |
296 | archiving [===========================> ] 4/6\r (no-eol) (esc) |
|
296 | archiving [===========================> ] 4/6\r (no-eol) (esc) | |
297 | archiving [==================================> ] 5/6\r (no-eol) (esc) |
|
297 | archiving [==================================> ] 5/6\r (no-eol) (esc) | |
298 | archiving [==========================================>] 6/6\r (no-eol) (esc) |
|
298 | archiving [==========================================>] 6/6\r (no-eol) (esc) | |
299 | \r (no-eol) (esc) |
|
299 | \r (no-eol) (esc) | |
300 |
|
300 | |||
301 | cleanup after progress extension test: |
|
301 | cleanup after progress extension test: | |
302 |
|
302 | |||
303 | $ cp $HGRCPATH.no-progress $HGRCPATH |
|
303 | $ cp $HGRCPATH.no-progress $HGRCPATH | |
304 |
|
304 | |||
305 | server errors |
|
305 | server errors | |
306 |
|
306 | |||
307 | $ cat errors.log |
|
307 | $ cat errors.log | |
308 |
|
308 | |||
309 | empty repo |
|
309 | empty repo | |
310 |
|
310 | |||
311 | $ hg init ../empty |
|
311 | $ hg init ../empty | |
312 | $ cd ../empty |
|
312 | $ cd ../empty | |
313 | $ hg archive ../test-empty |
|
313 | $ hg archive ../test-empty | |
314 | abort: no working directory: please specify a revision |
|
314 | abort: no working directory: please specify a revision | |
315 | [255] |
|
315 | [255] | |
316 |
|
316 | |||
317 | old file -- date clamped to 1980 |
|
317 | old file -- date clamped to 1980 | |
318 |
|
318 | |||
319 | $ touch -t 197501010000 old |
|
319 | $ touch -t 197501010000 old | |
320 | $ hg add old |
|
320 | $ hg add old | |
321 | $ hg commit -m old |
|
321 | $ hg commit -m old | |
322 | $ hg archive ../old.zip |
|
322 | $ hg archive ../old.zip | |
323 | $ unzip -l ../old.zip |
|
323 | $ unzip -l ../old.zip | |
324 | Archive: ../old.zip |
|
324 | Archive: ../old.zip | |
325 | \s*Length.* (re) |
|
325 | \s*Length.* (re) | |
326 | *-----* (glob) |
|
326 | *-----* (glob) | |
327 | *172*80*00:00*old/.hg_archival.txt (glob) |
|
327 | *172*80*00:00*old/.hg_archival.txt (glob) | |
328 | *0*80*00:00*old/old (glob) |
|
328 | *0*80*00:00*old/old (glob) | |
329 | *-----* (glob) |
|
329 | *-----* (glob) | |
330 | \s*172\s+2 files (re) |
|
330 | \s*172\s+2 files (re) | |
331 |
|
331 | |||
332 | show an error when a provided pattern matches no files |
|
332 | show an error when a provided pattern matches no files | |
333 |
|
333 | |||
334 | $ hg archive -I file_that_does_not_exist.foo ../empty.zip |
|
334 | $ hg archive -I file_that_does_not_exist.foo ../empty.zip | |
335 | abort: no files match the archive pattern |
|
335 | abort: no files match the archive pattern | |
336 | [255] |
|
336 | [255] | |
337 |
|
337 | |||
338 | $ hg archive -X * ../empty.zip |
|
338 | $ hg archive -X * ../empty.zip | |
339 | abort: no files match the archive pattern |
|
339 | abort: no files match the archive pattern | |
340 | [255] |
|
340 | [255] | |
341 |
|
341 | |||
342 | $ cd .. |
|
342 | $ cd .. | |
343 |
|
343 | |||
344 | issue3600: check whether "hg archive" can create archive files which |
|
344 | issue3600: check whether "hg archive" can create archive files which | |
345 | are extracted with expected timestamp, even though TZ is not |
|
345 | are extracted with expected timestamp, even though TZ is not | |
346 | configured as GMT. |
|
346 | configured as GMT. | |
347 |
|
347 | |||
348 | $ mkdir issue3600 |
|
348 | $ mkdir issue3600 | |
349 | $ cd issue3600 |
|
349 | $ cd issue3600 | |
350 |
|
350 | |||
351 | $ hg init repo |
|
351 | $ hg init repo | |
352 | $ echo a > repo/a |
|
352 | $ echo a > repo/a | |
353 | $ hg -R repo add repo/a |
|
353 | $ hg -R repo add repo/a | |
354 | $ hg -R repo commit -m '#0' -d '456789012 21600' |
|
354 | $ hg -R repo commit -m '#0' -d '456789012 21600' | |
355 | $ cat > show_mtime.py <<EOF |
|
355 | $ cat > show_mtime.py <<EOF | |
356 | > from __future__ import print_function |
|
356 | > from __future__ import print_function | |
357 | > import sys, os |
|
357 | > import sys, os | |
358 | > print(int(os.stat(sys.argv[1]).st_mtime)) |
|
358 | > print(int(os.stat(sys.argv[1]).st_mtime)) | |
359 | > EOF |
|
359 | > EOF | |
360 |
|
360 | |||
361 | $ hg -R repo archive --prefix tar-extracted archive.tar |
|
361 | $ hg -R repo archive --prefix tar-extracted archive.tar | |
362 | $ (TZ=UTC-3; export TZ; tar xf archive.tar) |
|
362 | $ (TZ=UTC-3; export TZ; tar xf archive.tar) | |
363 | $ python show_mtime.py tar-extracted/a |
|
363 | $ python show_mtime.py tar-extracted/a | |
364 | 456789012 |
|
364 | 456789012 | |
365 |
|
365 | |||
366 | $ hg -R repo archive --prefix zip-extracted archive.zip |
|
366 | $ hg -R repo archive --prefix zip-extracted archive.zip | |
367 | $ (TZ=UTC-3; export TZ; unzip -q archive.zip) |
|
367 | $ (TZ=UTC-3; export TZ; unzip -q archive.zip) | |
368 | $ python show_mtime.py zip-extracted/a |
|
368 | $ python show_mtime.py zip-extracted/a | |
369 | 456789012 |
|
369 | 456789012 | |
370 |
|
370 | |||
371 | $ cd .. |
|
371 | $ cd .. |
@@ -1,447 +1,447 b'' | |||||
1 | This file contains testcases that tend to be related to the wire protocol part |
|
1 | This file contains testcases that tend to be related to the wire protocol part | |
2 | of largefiles. |
|
2 | of largefiles. | |
3 |
|
3 | |||
4 | $ USERCACHE="$TESTTMP/cache"; export USERCACHE |
|
4 | $ USERCACHE="$TESTTMP/cache"; export USERCACHE | |
5 | $ mkdir "${USERCACHE}" |
|
5 | $ mkdir "${USERCACHE}" | |
6 | $ cat >> $HGRCPATH <<EOF |
|
6 | $ cat >> $HGRCPATH <<EOF | |
7 | > [extensions] |
|
7 | > [extensions] | |
8 | > largefiles= |
|
8 | > largefiles= | |
9 | > purge= |
|
9 | > purge= | |
10 | > rebase= |
|
10 | > rebase= | |
11 | > transplant= |
|
11 | > transplant= | |
12 | > [phases] |
|
12 | > [phases] | |
13 | > publish=False |
|
13 | > publish=False | |
14 | > [largefiles] |
|
14 | > [largefiles] | |
15 | > minsize=2 |
|
15 | > minsize=2 | |
16 | > patterns=glob:**.dat |
|
16 | > patterns=glob:**.dat | |
17 | > usercache=${USERCACHE} |
|
17 | > usercache=${USERCACHE} | |
18 | > [web] |
|
18 | > [web] | |
19 | > allow_archive = zip |
|
19 | > allow_archive = zip | |
20 | > [hooks] |
|
20 | > [hooks] | |
21 | > precommit=sh -c "echo \\"Invoking status precommit hook\\"; hg status" |
|
21 | > precommit=sh -c "echo \\"Invoking status precommit hook\\"; hg status" | |
22 | > EOF |
|
22 | > EOF | |
23 |
|
23 | |||
24 |
|
24 | |||
25 | #if serve |
|
25 | #if serve | |
26 | vanilla clients not locked out from largefiles servers on vanilla repos |
|
26 | vanilla clients not locked out from largefiles servers on vanilla repos | |
27 | $ mkdir r1 |
|
27 | $ mkdir r1 | |
28 | $ cd r1 |
|
28 | $ cd r1 | |
29 | $ hg init |
|
29 | $ hg init | |
30 | $ echo c1 > f1 |
|
30 | $ echo c1 > f1 | |
31 | $ hg add f1 |
|
31 | $ hg add f1 | |
32 | $ hg commit -m "m1" |
|
32 | $ hg commit -m "m1" | |
33 | Invoking status precommit hook |
|
33 | Invoking status precommit hook | |
34 | A f1 |
|
34 | A f1 | |
35 | $ cd .. |
|
35 | $ cd .. | |
36 | $ hg serve -R r1 -d -p $HGPORT --pid-file hg.pid |
|
36 | $ hg serve -R r1 -d -p $HGPORT --pid-file hg.pid | |
37 | $ cat hg.pid >> $DAEMON_PIDS |
|
37 | $ cat hg.pid >> $DAEMON_PIDS | |
38 | $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT r2 |
|
38 | $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT r2 | |
39 | requesting all changes |
|
39 | requesting all changes | |
40 | adding changesets |
|
40 | adding changesets | |
41 | adding manifests |
|
41 | adding manifests | |
42 | adding file changes |
|
42 | adding file changes | |
43 | added 1 changesets with 1 changes to 1 files |
|
43 | added 1 changesets with 1 changes to 1 files | |
44 | updating to branch default |
|
44 | updating to branch default | |
45 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
45 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
46 |
|
46 | |||
47 | largefiles clients still work with vanilla servers |
|
47 | largefiles clients still work with vanilla servers | |
48 | $ hg serve --config extensions.largefiles=! -R r1 -d -p $HGPORT1 --pid-file hg.pid |
|
48 | $ hg serve --config extensions.largefiles=! -R r1 -d -p $HGPORT1 --pid-file hg.pid | |
49 | $ cat hg.pid >> $DAEMON_PIDS |
|
49 | $ cat hg.pid >> $DAEMON_PIDS | |
50 | $ hg clone http://localhost:$HGPORT1 r3 |
|
50 | $ hg clone http://localhost:$HGPORT1 r3 | |
51 | requesting all changes |
|
51 | requesting all changes | |
52 | adding changesets |
|
52 | adding changesets | |
53 | adding manifests |
|
53 | adding manifests | |
54 | adding file changes |
|
54 | adding file changes | |
55 | added 1 changesets with 1 changes to 1 files |
|
55 | added 1 changesets with 1 changes to 1 files | |
56 | updating to branch default |
|
56 | updating to branch default | |
57 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
57 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
58 | #endif |
|
58 | #endif | |
59 |
|
59 | |||
60 | vanilla clients locked out from largefiles http repos |
|
60 | vanilla clients locked out from largefiles http repos | |
61 | $ mkdir r4 |
|
61 | $ mkdir r4 | |
62 | $ cd r4 |
|
62 | $ cd r4 | |
63 | $ hg init |
|
63 | $ hg init | |
64 | $ echo c1 > f1 |
|
64 | $ echo c1 > f1 | |
65 | $ hg add --large f1 |
|
65 | $ hg add --large f1 | |
66 | $ hg commit -m "m1" |
|
66 | $ hg commit -m "m1" | |
67 | Invoking status precommit hook |
|
67 | Invoking status precommit hook | |
68 | A f1 |
|
68 | A f1 | |
69 | $ cd .. |
|
69 | $ cd .. | |
70 |
|
70 | |||
71 | largefiles can be pushed locally (issue3583) |
|
71 | largefiles can be pushed locally (issue3583) | |
72 | $ hg init dest |
|
72 | $ hg init dest | |
73 | $ cd r4 |
|
73 | $ cd r4 | |
74 | $ hg outgoing ../dest |
|
74 | $ hg outgoing ../dest | |
75 | comparing with ../dest |
|
75 | comparing with ../dest | |
76 | searching for changes |
|
76 | searching for changes | |
77 | changeset: 0:639881c12b4c |
|
77 | changeset: 0:639881c12b4c | |
78 | tag: tip |
|
78 | tag: tip | |
79 | user: test |
|
79 | user: test | |
80 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
80 | date: Thu Jan 01 00:00:00 1970 +0000 | |
81 | summary: m1 |
|
81 | summary: m1 | |
82 |
|
82 | |||
83 | $ hg push ../dest |
|
83 | $ hg push ../dest | |
84 | pushing to ../dest |
|
84 | pushing to ../dest | |
85 | searching for changes |
|
85 | searching for changes | |
86 | adding changesets |
|
86 | adding changesets | |
87 | adding manifests |
|
87 | adding manifests | |
88 | adding file changes |
|
88 | adding file changes | |
89 | added 1 changesets with 1 changes to 1 files |
|
89 | added 1 changesets with 1 changes to 1 files | |
90 |
|
90 | |||
91 | exit code with nothing outgoing (issue3611) |
|
91 | exit code with nothing outgoing (issue3611) | |
92 | $ hg outgoing ../dest |
|
92 | $ hg outgoing ../dest | |
93 | comparing with ../dest |
|
93 | comparing with ../dest | |
94 | searching for changes |
|
94 | searching for changes | |
95 | no changes found |
|
95 | no changes found | |
96 | [1] |
|
96 | [1] | |
97 | $ cd .. |
|
97 | $ cd .. | |
98 |
|
98 | |||
99 | #if serve |
|
99 | #if serve | |
100 | $ hg serve -R r4 -d -p $HGPORT2 --pid-file hg.pid |
|
100 | $ hg serve -R r4 -d -p $HGPORT2 --pid-file hg.pid | |
101 | $ cat hg.pid >> $DAEMON_PIDS |
|
101 | $ cat hg.pid >> $DAEMON_PIDS | |
102 | $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT2 r5 |
|
102 | $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT2 r5 | |
103 | abort: remote error: |
|
103 | abort: remote error: | |
104 |
|
104 | |||
105 | This repository uses the largefiles extension. |
|
105 | This repository uses the largefiles extension. | |
106 |
|
106 | |||
107 | Please enable it in your Mercurial config file. |
|
107 | Please enable it in your Mercurial config file. | |
108 | [255] |
|
108 | [255] | |
109 |
|
109 | |||
110 | used all HGPORTs, kill all daemons |
|
110 | used all HGPORTs, kill all daemons | |
111 | $ killdaemons.py |
|
111 | $ killdaemons.py | |
112 | #endif |
|
112 | #endif | |
113 |
|
113 | |||
114 | vanilla clients locked out from largefiles ssh repos |
|
114 | vanilla clients locked out from largefiles ssh repos | |
115 | $ hg --config extensions.largefiles=! clone -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/r4 r5 |
|
115 | $ hg --config extensions.largefiles=! clone -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/r4 r5 | |
116 | remote: |
|
116 | remote: | |
117 | remote: This repository uses the largefiles extension. |
|
117 | remote: This repository uses the largefiles extension. | |
118 | remote: |
|
118 | remote: | |
119 | remote: Please enable it in your Mercurial config file. |
|
119 | remote: Please enable it in your Mercurial config file. | |
120 | remote: |
|
120 | remote: | |
121 | remote: - |
|
121 | remote: - | |
122 | abort: remote error |
|
122 | abort: remote error | |
123 | (check previous remote output) |
|
123 | (check previous remote output) | |
124 | [255] |
|
124 | [255] | |
125 |
|
125 | |||
126 | #if serve |
|
126 | #if serve | |
127 |
|
127 | |||
128 | largefiles clients refuse to push largefiles repos to vanilla servers |
|
128 | largefiles clients refuse to push largefiles repos to vanilla servers | |
129 | $ mkdir r6 |
|
129 | $ mkdir r6 | |
130 | $ cd r6 |
|
130 | $ cd r6 | |
131 | $ hg init |
|
131 | $ hg init | |
132 | $ echo c1 > f1 |
|
132 | $ echo c1 > f1 | |
133 | $ hg add f1 |
|
133 | $ hg add f1 | |
134 | $ hg commit -m "m1" |
|
134 | $ hg commit -m "m1" | |
135 | Invoking status precommit hook |
|
135 | Invoking status precommit hook | |
136 | A f1 |
|
136 | A f1 | |
137 | $ cat >> .hg/hgrc <<! |
|
137 | $ cat >> .hg/hgrc <<! | |
138 | > [web] |
|
138 | > [web] | |
139 | > push_ssl = false |
|
139 | > push_ssl = false | |
140 | > allow_push = * |
|
140 | > allow_push = * | |
141 | > ! |
|
141 | > ! | |
142 | $ cd .. |
|
142 | $ cd .. | |
143 | $ hg clone r6 r7 |
|
143 | $ hg clone r6 r7 | |
144 | updating to branch default |
|
144 | updating to branch default | |
145 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
145 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
146 | $ cd r7 |
|
146 | $ cd r7 | |
147 | $ echo c2 > f2 |
|
147 | $ echo c2 > f2 | |
148 | $ hg add --large f2 |
|
148 | $ hg add --large f2 | |
149 | $ hg commit -m "m2" |
|
149 | $ hg commit -m "m2" | |
150 | Invoking status precommit hook |
|
150 | Invoking status precommit hook | |
151 | A f2 |
|
151 | A f2 | |
152 | $ hg verify --large |
|
152 | $ hg verify --large | |
153 | checking changesets |
|
153 | checking changesets | |
154 | checking manifests |
|
154 | checking manifests | |
155 | crosschecking files in changesets and manifests |
|
155 | crosschecking files in changesets and manifests | |
156 | checking files |
|
156 | checking files | |
157 | 2 files, 2 changesets, 2 total revisions |
|
157 | 2 files, 2 changesets, 2 total revisions | |
158 | searching 1 changesets for largefiles |
|
158 | searching 1 changesets for largefiles | |
159 | verified existence of 1 revisions of 1 largefiles |
|
159 | verified existence of 1 revisions of 1 largefiles | |
160 | $ hg serve --config extensions.largefiles=! -R ../r6 -d -p $HGPORT --pid-file ../hg.pid |
|
160 | $ hg serve --config extensions.largefiles=! -R ../r6 -d -p $HGPORT --pid-file ../hg.pid | |
161 | $ cat ../hg.pid >> $DAEMON_PIDS |
|
161 | $ cat ../hg.pid >> $DAEMON_PIDS | |
162 | $ hg push http://localhost:$HGPORT |
|
162 | $ hg push http://localhost:$HGPORT | |
163 | pushing to http://localhost:$HGPORT/ |
|
163 | pushing to http://localhost:$HGPORT/ | |
164 | searching for changes |
|
164 | searching for changes | |
165 | abort: http://localhost:$HGPORT/ does not appear to be a largefile store |
|
165 | abort: http://localhost:$HGPORT/ does not appear to be a largefile store | |
166 | [255] |
|
166 | [255] | |
167 | $ cd .. |
|
167 | $ cd .. | |
168 |
|
168 | |||
169 | putlfile errors are shown (issue3123) |
|
169 | putlfile errors are shown (issue3123) | |
170 | Corrupt the cached largefile in r7 and move it out of the servers usercache |
|
170 | Corrupt the cached largefile in r7 and move it out of the servers usercache | |
171 | $ mv r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 . |
|
171 | $ mv r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 . | |
172 | $ echo 'client side corruption' > r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 |
|
172 | $ echo 'client side corruption' > r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 | |
173 | $ rm "$USERCACHE/4cdac4d8b084d0b599525cf732437fb337d422a8" |
|
173 | $ rm "$USERCACHE/4cdac4d8b084d0b599525cf732437fb337d422a8" | |
174 | $ hg init empty |
|
174 | $ hg init empty | |
175 | $ hg serve -R empty -d -p $HGPORT1 --pid-file hg.pid \ |
|
175 | $ hg serve -R empty -d -p $HGPORT1 --pid-file hg.pid \ | |
176 | > --config 'web.allow_push=*' --config web.push_ssl=False |
|
176 | > --config 'web.allow_push=*' --config web.push_ssl=False | |
177 | $ cat hg.pid >> $DAEMON_PIDS |
|
177 | $ cat hg.pid >> $DAEMON_PIDS | |
178 | $ hg push -R r7 http://localhost:$HGPORT1 |
|
178 | $ hg push -R r7 http://localhost:$HGPORT1 | |
179 | pushing to http://localhost:$HGPORT1/ |
|
179 | pushing to http://localhost:$HGPORT1/ | |
180 | searching for changes |
|
180 | searching for changes | |
181 | remote: largefiles: failed to put 4cdac4d8b084d0b599525cf732437fb337d422a8 into store: largefile contents do not match hash |
|
181 | remote: largefiles: failed to put 4cdac4d8b084d0b599525cf732437fb337d422a8 into store: largefile contents do not match hash | |
182 | abort: remotestore: could not put $TESTTMP/r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 to remote store http://localhost:$HGPORT1/ (glob) |
|
182 | abort: remotestore: could not put $TESTTMP/r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 to remote store http://localhost:$HGPORT1/ (glob) | |
183 | [255] |
|
183 | [255] | |
184 | $ mv 4cdac4d8b084d0b599525cf732437fb337d422a8 r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 |
|
184 | $ mv 4cdac4d8b084d0b599525cf732437fb337d422a8 r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 | |
185 | Push of file that exists on server but is corrupted - magic healing would be nice ... but too magic |
|
185 | Push of file that exists on server but is corrupted - magic healing would be nice ... but too magic | |
186 | $ echo "server side corruption" > empty/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 |
|
186 | $ echo "server side corruption" > empty/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 | |
187 | $ hg push -R r7 http://localhost:$HGPORT1 |
|
187 | $ hg push -R r7 http://localhost:$HGPORT1 | |
188 | pushing to http://localhost:$HGPORT1/ |
|
188 | pushing to http://localhost:$HGPORT1/ | |
189 | searching for changes |
|
189 | searching for changes | |
190 | remote: adding changesets |
|
190 | remote: adding changesets | |
191 | remote: adding manifests |
|
191 | remote: adding manifests | |
192 | remote: adding file changes |
|
192 | remote: adding file changes | |
193 | remote: added 2 changesets with 2 changes to 2 files |
|
193 | remote: added 2 changesets with 2 changes to 2 files | |
194 | $ cat empty/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 |
|
194 | $ cat empty/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 | |
195 | server side corruption |
|
195 | server side corruption | |
196 | $ rm -rf empty |
|
196 | $ rm -rf empty | |
197 |
|
197 | |||
198 | Push a largefiles repository to a served empty repository |
|
198 | Push a largefiles repository to a served empty repository | |
199 | $ hg init r8 |
|
199 | $ hg init r8 | |
200 | $ echo c3 > r8/f1 |
|
200 | $ echo c3 > r8/f1 | |
201 | $ hg add --large r8/f1 -R r8 |
|
201 | $ hg add --large r8/f1 -R r8 | |
202 | $ hg commit -m "m1" -R r8 |
|
202 | $ hg commit -m "m1" -R r8 | |
203 | Invoking status precommit hook |
|
203 | Invoking status precommit hook | |
204 | A f1 |
|
204 | A f1 | |
205 | $ hg init empty |
|
205 | $ hg init empty | |
206 | $ hg serve -R empty -d -p $HGPORT2 --pid-file hg.pid \ |
|
206 | $ hg serve -R empty -d -p $HGPORT2 --pid-file hg.pid \ | |
207 | > --config 'web.allow_push=*' --config web.push_ssl=False |
|
207 | > --config 'web.allow_push=*' --config web.push_ssl=False | |
208 | $ cat hg.pid >> $DAEMON_PIDS |
|
208 | $ cat hg.pid >> $DAEMON_PIDS | |
209 | $ rm "${USERCACHE}"/* |
|
209 | $ rm "${USERCACHE}"/* | |
210 | $ hg push -R r8 http://localhost:$HGPORT2/#default |
|
210 | $ hg push -R r8 http://localhost:$HGPORT2/#default | |
211 | pushing to http://localhost:$HGPORT2/ |
|
211 | pushing to http://localhost:$HGPORT2/ | |
212 | searching for changes |
|
212 | searching for changes | |
213 | remote: adding changesets |
|
213 | remote: adding changesets | |
214 | remote: adding manifests |
|
214 | remote: adding manifests | |
215 | remote: adding file changes |
|
215 | remote: adding file changes | |
216 | remote: added 1 changesets with 1 changes to 1 files |
|
216 | remote: added 1 changesets with 1 changes to 1 files | |
217 | $ [ -f "${USERCACHE}"/02a439e5c31c526465ab1a0ca1f431f76b827b90 ] |
|
217 | $ [ -f "${USERCACHE}"/02a439e5c31c526465ab1a0ca1f431f76b827b90 ] | |
218 | $ [ -f empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 ] |
|
218 | $ [ -f empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 ] | |
219 |
|
219 | |||
220 | Clone over http, no largefiles pulled on clone. |
|
220 | Clone over http, no largefiles pulled on clone. | |
221 |
|
221 | |||
222 | $ hg clone http://localhost:$HGPORT2/#default http-clone -U |
|
222 | $ hg clone http://localhost:$HGPORT2/#default http-clone -U | |
223 | adding changesets |
|
223 | adding changesets | |
224 | adding manifests |
|
224 | adding manifests | |
225 | adding file changes |
|
225 | adding file changes | |
226 | added 1 changesets with 1 changes to 1 files |
|
226 | added 1 changesets with 1 changes to 1 files | |
227 |
|
227 | |||
228 | Archive contains largefiles |
|
228 | Archive contains largefiles | |
229 | >>> import urllib2, os |
|
229 | >>> import urllib2, os | |
230 | >>> u = 'http://localhost:%s/archive/default.zip' % os.environ['HGPORT2'] |
|
230 | >>> u = 'http://localhost:%s/archive/default.zip' % os.environ['HGPORT2'] | |
231 | >>> with open('archive.zip', 'w') as f: |
|
231 | >>> with open('archive.zip', 'w') as f: | |
232 | ... f.write(urllib2.urlopen(u).read()) |
|
232 | ... f.write(urllib2.urlopen(u).read()) | |
233 | $ unzip -t archive.zip |
|
233 | $ unzip -t archive.zip | |
234 | Archive: archive.zip |
|
234 | Archive: archive.zip | |
235 |
testing: empty-default/.hg_archival.txt |
|
235 | testing: empty-default/.hg_archival.txt*OK (glob) | |
236 |
testing: empty-default/f1 |
|
236 | testing: empty-default/f1*OK (glob) | |
237 | No errors detected in compressed data of archive.zip. |
|
237 | No errors detected in compressed data of archive.zip. | |
238 |
|
238 | |||
239 | test 'verify' with remotestore: |
|
239 | test 'verify' with remotestore: | |
240 |
|
240 | |||
241 | $ rm "${USERCACHE}"/02a439e5c31c526465ab1a0ca1f431f76b827b90 |
|
241 | $ rm "${USERCACHE}"/02a439e5c31c526465ab1a0ca1f431f76b827b90 | |
242 | $ mv empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 . |
|
242 | $ mv empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 . | |
243 | $ hg -R http-clone verify --large --lfa |
|
243 | $ hg -R http-clone verify --large --lfa | |
244 | checking changesets |
|
244 | checking changesets | |
245 | checking manifests |
|
245 | checking manifests | |
246 | crosschecking files in changesets and manifests |
|
246 | crosschecking files in changesets and manifests | |
247 | checking files |
|
247 | checking files | |
248 | 1 files, 1 changesets, 1 total revisions |
|
248 | 1 files, 1 changesets, 1 total revisions | |
249 | searching 1 changesets for largefiles |
|
249 | searching 1 changesets for largefiles | |
250 | changeset 0:cf03e5bb9936: f1 missing |
|
250 | changeset 0:cf03e5bb9936: f1 missing | |
251 | verified existence of 1 revisions of 1 largefiles |
|
251 | verified existence of 1 revisions of 1 largefiles | |
252 | [1] |
|
252 | [1] | |
253 | $ mv 02a439e5c31c526465ab1a0ca1f431f76b827b90 empty/.hg/largefiles/ |
|
253 | $ mv 02a439e5c31c526465ab1a0ca1f431f76b827b90 empty/.hg/largefiles/ | |
254 | $ hg -R http-clone -q verify --large --lfa |
|
254 | $ hg -R http-clone -q verify --large --lfa | |
255 |
|
255 | |||
256 | largefiles pulled on update - a largefile missing on the server: |
|
256 | largefiles pulled on update - a largefile missing on the server: | |
257 | $ mv empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 . |
|
257 | $ mv empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 . | |
258 | $ hg -R http-clone up --config largefiles.usercache=http-clone-usercache |
|
258 | $ hg -R http-clone up --config largefiles.usercache=http-clone-usercache | |
259 | getting changed largefiles |
|
259 | getting changed largefiles | |
260 | f1: largefile 02a439e5c31c526465ab1a0ca1f431f76b827b90 not available from http://localhost:$HGPORT2/ |
|
260 | f1: largefile 02a439e5c31c526465ab1a0ca1f431f76b827b90 not available from http://localhost:$HGPORT2/ | |
261 | 0 largefiles updated, 0 removed |
|
261 | 0 largefiles updated, 0 removed | |
262 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
262 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
263 | $ hg -R http-clone st |
|
263 | $ hg -R http-clone st | |
264 | ! f1 |
|
264 | ! f1 | |
265 | $ hg -R http-clone up -Cqr null |
|
265 | $ hg -R http-clone up -Cqr null | |
266 |
|
266 | |||
267 | largefiles pulled on update - a largefile corrupted on the server: |
|
267 | largefiles pulled on update - a largefile corrupted on the server: | |
268 | $ echo corruption > empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 |
|
268 | $ echo corruption > empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 | |
269 | $ hg -R http-clone up --config largefiles.usercache=http-clone-usercache |
|
269 | $ hg -R http-clone up --config largefiles.usercache=http-clone-usercache | |
270 | getting changed largefiles |
|
270 | getting changed largefiles | |
271 | f1: data corruption (expected 02a439e5c31c526465ab1a0ca1f431f76b827b90, got 6a7bb2556144babe3899b25e5428123735bb1e27) |
|
271 | f1: data corruption (expected 02a439e5c31c526465ab1a0ca1f431f76b827b90, got 6a7bb2556144babe3899b25e5428123735bb1e27) | |
272 | 0 largefiles updated, 0 removed |
|
272 | 0 largefiles updated, 0 removed | |
273 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
273 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
274 | $ hg -R http-clone st |
|
274 | $ hg -R http-clone st | |
275 | ! f1 |
|
275 | ! f1 | |
276 | $ [ ! -f http-clone/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 ] |
|
276 | $ [ ! -f http-clone/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 ] | |
277 | $ [ ! -f http-clone/f1 ] |
|
277 | $ [ ! -f http-clone/f1 ] | |
278 | $ [ ! -f http-clone-usercache ] |
|
278 | $ [ ! -f http-clone-usercache ] | |
279 | $ hg -R http-clone verify --large --lfc |
|
279 | $ hg -R http-clone verify --large --lfc | |
280 | checking changesets |
|
280 | checking changesets | |
281 | checking manifests |
|
281 | checking manifests | |
282 | crosschecking files in changesets and manifests |
|
282 | crosschecking files in changesets and manifests | |
283 | checking files |
|
283 | checking files | |
284 | 1 files, 1 changesets, 1 total revisions |
|
284 | 1 files, 1 changesets, 1 total revisions | |
285 | searching 1 changesets for largefiles |
|
285 | searching 1 changesets for largefiles | |
286 | verified contents of 1 revisions of 1 largefiles |
|
286 | verified contents of 1 revisions of 1 largefiles | |
287 | $ hg -R http-clone up -Cqr null |
|
287 | $ hg -R http-clone up -Cqr null | |
288 |
|
288 | |||
289 | largefiles pulled on update - no server side problems: |
|
289 | largefiles pulled on update - no server side problems: | |
290 | $ mv 02a439e5c31c526465ab1a0ca1f431f76b827b90 empty/.hg/largefiles/ |
|
290 | $ mv 02a439e5c31c526465ab1a0ca1f431f76b827b90 empty/.hg/largefiles/ | |
291 | $ hg -R http-clone --debug up --config largefiles.usercache=http-clone-usercache --config progress.debug=true |
|
291 | $ hg -R http-clone --debug up --config largefiles.usercache=http-clone-usercache --config progress.debug=true | |
292 | resolving manifests |
|
292 | resolving manifests | |
293 | branchmerge: False, force: False, partial: False |
|
293 | branchmerge: False, force: False, partial: False | |
294 | ancestor: 000000000000, local: 000000000000+, remote: cf03e5bb9936 |
|
294 | ancestor: 000000000000, local: 000000000000+, remote: cf03e5bb9936 | |
295 | .hglf/f1: remote created -> g |
|
295 | .hglf/f1: remote created -> g | |
296 | getting .hglf/f1 |
|
296 | getting .hglf/f1 | |
297 | updating: .hglf/f1 1/1 files (100.00%) |
|
297 | updating: .hglf/f1 1/1 files (100.00%) | |
298 | getting changed largefiles |
|
298 | getting changed largefiles | |
299 | using http://localhost:$HGPORT2/ |
|
299 | using http://localhost:$HGPORT2/ | |
300 | sending capabilities command |
|
300 | sending capabilities command | |
301 | sending batch command |
|
301 | sending batch command | |
302 | getting largefiles: 0/1 files (0.00%) |
|
302 | getting largefiles: 0/1 files (0.00%) | |
303 | getting f1:02a439e5c31c526465ab1a0ca1f431f76b827b90 |
|
303 | getting f1:02a439e5c31c526465ab1a0ca1f431f76b827b90 | |
304 | sending getlfile command |
|
304 | sending getlfile command | |
305 | found 02a439e5c31c526465ab1a0ca1f431f76b827b90 in store |
|
305 | found 02a439e5c31c526465ab1a0ca1f431f76b827b90 in store | |
306 | 1 largefiles updated, 0 removed |
|
306 | 1 largefiles updated, 0 removed | |
307 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
307 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
308 |
|
308 | |||
309 | $ ls http-clone-usercache/* |
|
309 | $ ls http-clone-usercache/* | |
310 | http-clone-usercache/02a439e5c31c526465ab1a0ca1f431f76b827b90 |
|
310 | http-clone-usercache/02a439e5c31c526465ab1a0ca1f431f76b827b90 | |
311 |
|
311 | |||
312 | $ rm -rf empty http-clone* |
|
312 | $ rm -rf empty http-clone* | |
313 |
|
313 | |||
314 | used all HGPORTs, kill all daemons |
|
314 | used all HGPORTs, kill all daemons | |
315 | $ killdaemons.py |
|
315 | $ killdaemons.py | |
316 |
|
316 | |||
317 | largefiles should batch verify remote calls |
|
317 | largefiles should batch verify remote calls | |
318 |
|
318 | |||
319 | $ hg init batchverifymain |
|
319 | $ hg init batchverifymain | |
320 | $ cd batchverifymain |
|
320 | $ cd batchverifymain | |
321 | $ echo "aaa" >> a |
|
321 | $ echo "aaa" >> a | |
322 | $ hg add --large a |
|
322 | $ hg add --large a | |
323 | $ hg commit -m "a" |
|
323 | $ hg commit -m "a" | |
324 | Invoking status precommit hook |
|
324 | Invoking status precommit hook | |
325 | A a |
|
325 | A a | |
326 | $ echo "bbb" >> b |
|
326 | $ echo "bbb" >> b | |
327 | $ hg add --large b |
|
327 | $ hg add --large b | |
328 | $ hg commit -m "b" |
|
328 | $ hg commit -m "b" | |
329 | Invoking status precommit hook |
|
329 | Invoking status precommit hook | |
330 | A b |
|
330 | A b | |
331 | $ cd .. |
|
331 | $ cd .. | |
332 | $ hg serve -R batchverifymain -d -p $HGPORT --pid-file hg.pid \ |
|
332 | $ hg serve -R batchverifymain -d -p $HGPORT --pid-file hg.pid \ | |
333 | > -A access.log |
|
333 | > -A access.log | |
334 | $ cat hg.pid >> $DAEMON_PIDS |
|
334 | $ cat hg.pid >> $DAEMON_PIDS | |
335 | $ hg clone --noupdate http://localhost:$HGPORT batchverifyclone |
|
335 | $ hg clone --noupdate http://localhost:$HGPORT batchverifyclone | |
336 | requesting all changes |
|
336 | requesting all changes | |
337 | adding changesets |
|
337 | adding changesets | |
338 | adding manifests |
|
338 | adding manifests | |
339 | adding file changes |
|
339 | adding file changes | |
340 | added 2 changesets with 2 changes to 2 files |
|
340 | added 2 changesets with 2 changes to 2 files | |
341 | $ hg -R batchverifyclone verify --large --lfa |
|
341 | $ hg -R batchverifyclone verify --large --lfa | |
342 | checking changesets |
|
342 | checking changesets | |
343 | checking manifests |
|
343 | checking manifests | |
344 | crosschecking files in changesets and manifests |
|
344 | crosschecking files in changesets and manifests | |
345 | checking files |
|
345 | checking files | |
346 | 2 files, 2 changesets, 2 total revisions |
|
346 | 2 files, 2 changesets, 2 total revisions | |
347 | searching 2 changesets for largefiles |
|
347 | searching 2 changesets for largefiles | |
348 | verified existence of 2 revisions of 2 largefiles |
|
348 | verified existence of 2 revisions of 2 largefiles | |
349 | $ tail -1 access.log |
|
349 | $ tail -1 access.log | |
350 | 127.0.0.1 - - [*] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=statlfile+sha%3D972a1a11f19934401291cc99117ec614933374ce%3Bstatlfile+sha%3Dc801c9cfe94400963fcb683246217d5db77f9a9a (glob) |
|
350 | 127.0.0.1 - - [*] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=statlfile+sha%3D972a1a11f19934401291cc99117ec614933374ce%3Bstatlfile+sha%3Dc801c9cfe94400963fcb683246217d5db77f9a9a (glob) | |
351 | $ hg -R batchverifyclone update |
|
351 | $ hg -R batchverifyclone update | |
352 | getting changed largefiles |
|
352 | getting changed largefiles | |
353 | 2 largefiles updated, 0 removed |
|
353 | 2 largefiles updated, 0 removed | |
354 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
354 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
355 |
|
355 | |||
356 | Clear log file before next test |
|
356 | Clear log file before next test | |
357 |
|
357 | |||
358 | $ printf "" > access.log |
|
358 | $ printf "" > access.log | |
359 |
|
359 | |||
360 | Verify should check file on remote server only when file is not |
|
360 | Verify should check file on remote server only when file is not | |
361 | available locally. |
|
361 | available locally. | |
362 |
|
362 | |||
363 | $ echo "ccc" >> batchverifymain/c |
|
363 | $ echo "ccc" >> batchverifymain/c | |
364 | $ hg -R batchverifymain status |
|
364 | $ hg -R batchverifymain status | |
365 | ? c |
|
365 | ? c | |
366 | $ hg -R batchverifymain add --large batchverifymain/c |
|
366 | $ hg -R batchverifymain add --large batchverifymain/c | |
367 | $ hg -R batchverifymain commit -m "c" |
|
367 | $ hg -R batchverifymain commit -m "c" | |
368 | Invoking status precommit hook |
|
368 | Invoking status precommit hook | |
369 | A c |
|
369 | A c | |
370 | $ hg -R batchverifyclone pull |
|
370 | $ hg -R batchverifyclone pull | |
371 | pulling from http://localhost:$HGPORT/ |
|
371 | pulling from http://localhost:$HGPORT/ | |
372 | searching for changes |
|
372 | searching for changes | |
373 | adding changesets |
|
373 | adding changesets | |
374 | adding manifests |
|
374 | adding manifests | |
375 | adding file changes |
|
375 | adding file changes | |
376 | added 1 changesets with 1 changes to 1 files |
|
376 | added 1 changesets with 1 changes to 1 files | |
377 | (run 'hg update' to get a working copy) |
|
377 | (run 'hg update' to get a working copy) | |
378 | $ hg -R batchverifyclone verify --lfa |
|
378 | $ hg -R batchverifyclone verify --lfa | |
379 | checking changesets |
|
379 | checking changesets | |
380 | checking manifests |
|
380 | checking manifests | |
381 | crosschecking files in changesets and manifests |
|
381 | crosschecking files in changesets and manifests | |
382 | checking files |
|
382 | checking files | |
383 | 3 files, 3 changesets, 3 total revisions |
|
383 | 3 files, 3 changesets, 3 total revisions | |
384 | searching 3 changesets for largefiles |
|
384 | searching 3 changesets for largefiles | |
385 | verified existence of 3 revisions of 3 largefiles |
|
385 | verified existence of 3 revisions of 3 largefiles | |
386 | $ tail -1 access.log |
|
386 | $ tail -1 access.log | |
387 | 127.0.0.1 - - [*] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=statlfile+sha%3Dc8559c3c9cfb42131794b7d8009230403b9b454c (glob) |
|
387 | 127.0.0.1 - - [*] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=statlfile+sha%3Dc8559c3c9cfb42131794b7d8009230403b9b454c (glob) | |
388 |
|
388 | |||
389 | $ killdaemons.py |
|
389 | $ killdaemons.py | |
390 |
|
390 | |||
391 | largefiles should not ask for password again after succesfull authorization |
|
391 | largefiles should not ask for password again after succesfull authorization | |
392 |
|
392 | |||
393 | $ hg init credentialmain |
|
393 | $ hg init credentialmain | |
394 | $ cd credentialmain |
|
394 | $ cd credentialmain | |
395 | $ echo "aaa" >> a |
|
395 | $ echo "aaa" >> a | |
396 | $ hg add --large a |
|
396 | $ hg add --large a | |
397 | $ hg commit -m "a" |
|
397 | $ hg commit -m "a" | |
398 | Invoking status precommit hook |
|
398 | Invoking status precommit hook | |
399 | A a |
|
399 | A a | |
400 |
|
400 | |||
401 | Before running server clear the user cache to force clone to download |
|
401 | Before running server clear the user cache to force clone to download | |
402 | a large file from the server rather than to get it from the cache |
|
402 | a large file from the server rather than to get it from the cache | |
403 |
|
403 | |||
404 | $ rm "${USERCACHE}"/* |
|
404 | $ rm "${USERCACHE}"/* | |
405 |
|
405 | |||
406 | $ cd .. |
|
406 | $ cd .. | |
407 | $ cat << EOT > userpass.py |
|
407 | $ cat << EOT > userpass.py | |
408 | > import base64 |
|
408 | > import base64 | |
409 | > from mercurial.hgweb import common |
|
409 | > from mercurial.hgweb import common | |
410 | > def perform_authentication(hgweb, req, op): |
|
410 | > def perform_authentication(hgweb, req, op): | |
411 | > auth = req.env.get('HTTP_AUTHORIZATION') |
|
411 | > auth = req.env.get('HTTP_AUTHORIZATION') | |
412 | > if not auth: |
|
412 | > if not auth: | |
413 | > raise common.ErrorResponse(common.HTTP_UNAUTHORIZED, 'who', |
|
413 | > raise common.ErrorResponse(common.HTTP_UNAUTHORIZED, 'who', | |
414 | > [('WWW-Authenticate', 'Basic Realm="mercurial"')]) |
|
414 | > [('WWW-Authenticate', 'Basic Realm="mercurial"')]) | |
415 | > if base64.b64decode(auth.split()[1]).split(':', 1) != ['user', 'pass']: |
|
415 | > if base64.b64decode(auth.split()[1]).split(':', 1) != ['user', 'pass']: | |
416 | > raise common.ErrorResponse(common.HTTP_FORBIDDEN, 'no') |
|
416 | > raise common.ErrorResponse(common.HTTP_FORBIDDEN, 'no') | |
417 | > def extsetup(): |
|
417 | > def extsetup(): | |
418 | > common.permhooks.insert(0, perform_authentication) |
|
418 | > common.permhooks.insert(0, perform_authentication) | |
419 | > EOT |
|
419 | > EOT | |
420 | $ hg serve --config extensions.x=userpass.py -R credentialmain \ |
|
420 | $ hg serve --config extensions.x=userpass.py -R credentialmain \ | |
421 | > -d -p $HGPORT --pid-file hg.pid -A access.log |
|
421 | > -d -p $HGPORT --pid-file hg.pid -A access.log | |
422 | $ cat hg.pid >> $DAEMON_PIDS |
|
422 | $ cat hg.pid >> $DAEMON_PIDS | |
423 | $ cat << EOF > get_pass.py |
|
423 | $ cat << EOF > get_pass.py | |
424 | > import getpass |
|
424 | > import getpass | |
425 | > def newgetpass(arg): |
|
425 | > def newgetpass(arg): | |
426 | > return "pass" |
|
426 | > return "pass" | |
427 | > getpass.getpass = newgetpass |
|
427 | > getpass.getpass = newgetpass | |
428 | > EOF |
|
428 | > EOF | |
429 | $ hg clone --config ui.interactive=true --config extensions.getpass=get_pass.py \ |
|
429 | $ hg clone --config ui.interactive=true --config extensions.getpass=get_pass.py \ | |
430 | > http://user@localhost:$HGPORT credentialclone |
|
430 | > http://user@localhost:$HGPORT credentialclone | |
431 | requesting all changes |
|
431 | requesting all changes | |
432 | http authorization required for http://localhost:$HGPORT/ |
|
432 | http authorization required for http://localhost:$HGPORT/ | |
433 | realm: mercurial |
|
433 | realm: mercurial | |
434 | user: user |
|
434 | user: user | |
435 | password: adding changesets |
|
435 | password: adding changesets | |
436 | adding manifests |
|
436 | adding manifests | |
437 | adding file changes |
|
437 | adding file changes | |
438 | added 1 changesets with 1 changes to 1 files |
|
438 | added 1 changesets with 1 changes to 1 files | |
439 | updating to branch default |
|
439 | updating to branch default | |
440 | getting changed largefiles |
|
440 | getting changed largefiles | |
441 | 1 largefiles updated, 0 removed |
|
441 | 1 largefiles updated, 0 removed | |
442 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
442 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
443 |
|
443 | |||
444 | $ rm hg.pid access.log |
|
444 | $ rm hg.pid access.log | |
445 | $ killdaemons.py |
|
445 | $ killdaemons.py | |
446 |
|
446 | |||
447 | #endif |
|
447 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now