Show More
@@ -1,567 +1,573 b'' | |||
|
1 | TRANSITIONAL CONFIG | |
|
2 | $ cat << EOF >> $HGRCPATH | |
|
3 | > [format] | |
|
4 | > sparse-revlog = yes | |
|
5 | > EOF | |
|
6 | ||
|
1 | 7 | #require serve no-reposimplestore no-chg |
|
2 | 8 | |
|
3 | 9 | #testcases stream-legacy stream-bundle2 |
|
4 | 10 | |
|
5 | 11 | #if stream-legacy |
|
6 | 12 |
$ |
|
7 | 13 | > [server] |
|
8 | 14 | > bundle2.stream = no |
|
9 | 15 | > EOF |
|
10 | 16 | #endif |
|
11 | 17 | |
|
12 | 18 | Initialize repository |
|
13 | 19 | the status call is to check for issue5130 |
|
14 | 20 | |
|
15 | 21 | $ hg init server |
|
16 | 22 | $ cd server |
|
17 | 23 | $ touch foo |
|
18 | 24 | $ hg -q commit -A -m initial |
|
19 | 25 | >>> for i in range(1024): |
|
20 | 26 | ... with open(str(i), 'wb') as fh: |
|
21 | 27 | ... fh.write(b"%d" % i) and None |
|
22 | 28 | $ hg -q commit -A -m 'add a lot of files' |
|
23 | 29 | $ hg st |
|
24 | 30 | $ hg --config server.uncompressed=false serve -p $HGPORT -d --pid-file=hg.pid |
|
25 | 31 | $ cat hg.pid > $DAEMON_PIDS |
|
26 | 32 | $ cd .. |
|
27 | 33 | |
|
28 | 34 | Cannot stream clone when server.uncompressed is set |
|
29 | 35 | |
|
30 | 36 | $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=stream_out' |
|
31 | 37 | 200 Script output follows |
|
32 | 38 | |
|
33 | 39 | 1 |
|
34 | 40 | |
|
35 | 41 | #if stream-legacy |
|
36 | 42 | $ hg debugcapabilities http://localhost:$HGPORT |
|
37 | 43 | Main capabilities: |
|
38 | 44 | batch |
|
39 | 45 | branchmap |
|
40 | 46 | $USUAL_BUNDLE2_CAPS_SERVER$ |
|
41 | 47 | changegroupsubset |
|
42 | 48 | compression=$BUNDLE2_COMPRESSIONS$ |
|
43 | 49 | getbundle |
|
44 | 50 | httpheader=1024 |
|
45 | 51 | httpmediatype=0.1rx,0.1tx,0.2tx |
|
46 | 52 | known |
|
47 | 53 | lookup |
|
48 | 54 | pushkey |
|
49 | 55 | unbundle=HG10GZ,HG10BZ,HG10UN |
|
50 | 56 | unbundlehash |
|
51 | 57 | Bundle2 capabilities: |
|
52 | 58 | HG20 |
|
53 | 59 | bookmarks |
|
54 | 60 | changegroup |
|
55 | 61 | 01 |
|
56 | 62 | 02 |
|
57 | 63 | digests |
|
58 | 64 | md5 |
|
59 | 65 | sha1 |
|
60 | 66 | sha512 |
|
61 | 67 | error |
|
62 | 68 | abort |
|
63 | 69 | unsupportedcontent |
|
64 | 70 | pushraced |
|
65 | 71 | pushkey |
|
66 | 72 | hgtagsfnodes |
|
67 | 73 | listkeys |
|
68 | 74 | phases |
|
69 | 75 | heads |
|
70 | 76 | pushkey |
|
71 | 77 | remote-changegroup |
|
72 | 78 | http |
|
73 | 79 | https |
|
74 | 80 | rev-branch-cache |
|
75 | 81 | |
|
76 | 82 | $ hg clone --stream -U http://localhost:$HGPORT server-disabled |
|
77 | 83 | warning: stream clone requested but server has them disabled |
|
78 | 84 | requesting all changes |
|
79 | 85 | adding changesets |
|
80 | 86 | adding manifests |
|
81 | 87 | adding file changes |
|
82 | 88 | added 2 changesets with 1025 changes to 1025 files |
|
83 | 89 | new changesets 96ee1d7354c4:c17445101a72 |
|
84 | 90 | |
|
85 | 91 | $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=getbundle' content-type --bodyfile body --hgproto 0.2 --requestheader "x-hgarg-1=bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=0&common=0000000000000000000000000000000000000000&heads=c17445101a72edac06facd130d14808dfbd5c7c2&stream=1" |
|
86 | 92 | 200 Script output follows |
|
87 | 93 | content-type: application/mercurial-0.2 |
|
88 | 94 | |
|
89 | 95 | |
|
90 | 96 | $ f --size body --hexdump --bytes 100 |
|
91 | 97 | body: size=232 |
|
92 | 98 | 0000: 04 6e 6f 6e 65 48 47 32 30 00 00 00 00 00 00 00 |.noneHG20.......| |
|
93 | 99 | 0010: cf 0b 45 52 52 4f 52 3a 41 42 4f 52 54 00 00 00 |..ERROR:ABORT...| |
|
94 | 100 | 0020: 00 01 01 07 3c 04 72 6d 65 73 73 61 67 65 73 74 |....<.rmessagest| |
|
95 | 101 | 0030: 72 65 61 6d 20 64 61 74 61 20 72 65 71 75 65 73 |ream data reques| |
|
96 | 102 | 0040: 74 65 64 20 62 75 74 20 73 65 72 76 65 72 20 64 |ted but server d| |
|
97 | 103 | 0050: 6f 65 73 20 6e 6f 74 20 61 6c 6c 6f 77 20 74 68 |oes not allow th| |
|
98 | 104 | 0060: 69 73 20 66 |is f| |
|
99 | 105 | |
|
100 | 106 | #endif |
|
101 | 107 | #if stream-bundle2 |
|
102 | 108 | $ hg debugcapabilities http://localhost:$HGPORT |
|
103 | 109 | Main capabilities: |
|
104 | 110 | batch |
|
105 | 111 | branchmap |
|
106 | 112 | $USUAL_BUNDLE2_CAPS_SERVER$ |
|
107 | 113 | changegroupsubset |
|
108 | 114 | compression=$BUNDLE2_COMPRESSIONS$ |
|
109 | 115 | getbundle |
|
110 | 116 | httpheader=1024 |
|
111 | 117 | httpmediatype=0.1rx,0.1tx,0.2tx |
|
112 | 118 | known |
|
113 | 119 | lookup |
|
114 | 120 | pushkey |
|
115 | 121 | unbundle=HG10GZ,HG10BZ,HG10UN |
|
116 | 122 | unbundlehash |
|
117 | 123 | Bundle2 capabilities: |
|
118 | 124 | HG20 |
|
119 | 125 | bookmarks |
|
120 | 126 | changegroup |
|
121 | 127 | 01 |
|
122 | 128 | 02 |
|
123 | 129 | digests |
|
124 | 130 | md5 |
|
125 | 131 | sha1 |
|
126 | 132 | sha512 |
|
127 | 133 | error |
|
128 | 134 | abort |
|
129 | 135 | unsupportedcontent |
|
130 | 136 | pushraced |
|
131 | 137 | pushkey |
|
132 | 138 | hgtagsfnodes |
|
133 | 139 | listkeys |
|
134 | 140 | phases |
|
135 | 141 | heads |
|
136 | 142 | pushkey |
|
137 | 143 | remote-changegroup |
|
138 | 144 | http |
|
139 | 145 | https |
|
140 | 146 | rev-branch-cache |
|
141 | 147 | |
|
142 | 148 | $ hg clone --stream -U http://localhost:$HGPORT server-disabled |
|
143 | 149 | warning: stream clone requested but server has them disabled |
|
144 | 150 | requesting all changes |
|
145 | 151 | adding changesets |
|
146 | 152 | adding manifests |
|
147 | 153 | adding file changes |
|
148 | 154 | added 2 changesets with 1025 changes to 1025 files |
|
149 | 155 | new changesets 96ee1d7354c4:c17445101a72 |
|
150 | 156 | |
|
151 | 157 | $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=getbundle' content-type --bodyfile body --hgproto 0.2 --requestheader "x-hgarg-1=bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=0&common=0000000000000000000000000000000000000000&heads=c17445101a72edac06facd130d14808dfbd5c7c2&stream=1" |
|
152 | 158 | 200 Script output follows |
|
153 | 159 | content-type: application/mercurial-0.2 |
|
154 | 160 | |
|
155 | 161 | |
|
156 | 162 | $ f --size body --hexdump --bytes 100 |
|
157 | 163 | body: size=232 |
|
158 | 164 | 0000: 04 6e 6f 6e 65 48 47 32 30 00 00 00 00 00 00 00 |.noneHG20.......| |
|
159 | 165 | 0010: cf 0b 45 52 52 4f 52 3a 41 42 4f 52 54 00 00 00 |..ERROR:ABORT...| |
|
160 | 166 | 0020: 00 01 01 07 3c 04 72 6d 65 73 73 61 67 65 73 74 |....<.rmessagest| |
|
161 | 167 | 0030: 72 65 61 6d 20 64 61 74 61 20 72 65 71 75 65 73 |ream data reques| |
|
162 | 168 | 0040: 74 65 64 20 62 75 74 20 73 65 72 76 65 72 20 64 |ted but server d| |
|
163 | 169 | 0050: 6f 65 73 20 6e 6f 74 20 61 6c 6c 6f 77 20 74 68 |oes not allow th| |
|
164 | 170 | 0060: 69 73 20 66 |is f| |
|
165 | 171 | |
|
166 | 172 | #endif |
|
167 | 173 | |
|
168 | 174 | $ killdaemons.py |
|
169 | 175 | $ cd server |
|
170 | 176 | $ hg serve -p $HGPORT -d --pid-file=hg.pid |
|
171 | 177 | $ cat hg.pid > $DAEMON_PIDS |
|
172 | 178 | $ cd .. |
|
173 | 179 | |
|
174 | 180 | Basic clone |
|
175 | 181 | |
|
176 | 182 | #if stream-legacy |
|
177 | 183 | $ hg clone --stream -U http://localhost:$HGPORT clone1 |
|
178 | 184 | streaming all changes |
|
179 | 185 | 1027 files to transfer, 96.3 KB of data |
|
180 | 186 | transferred 96.3 KB in * seconds (*/sec) (glob) |
|
181 | 187 | searching for changes |
|
182 | 188 | no changes found |
|
183 | 189 | #endif |
|
184 | 190 | #if stream-bundle2 |
|
185 | 191 | $ hg clone --stream -U http://localhost:$HGPORT clone1 |
|
186 | 192 | streaming all changes |
|
187 | 193 | 1030 files to transfer, 96.4 KB of data |
|
188 | 194 | transferred 96.4 KB in * seconds (* */sec) (glob) |
|
189 | 195 | |
|
190 | 196 | $ ls -1 clone1/.hg/cache |
|
191 | 197 | branch2-served |
|
192 | 198 | rbc-names-v1 |
|
193 | 199 | rbc-revs-v1 |
|
194 | 200 | #endif |
|
195 | 201 | |
|
196 | 202 | getbundle requests with stream=1 are uncompressed |
|
197 | 203 | |
|
198 | 204 | $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=getbundle' content-type --bodyfile body --hgproto '0.1 0.2 comp=zlib,none' --requestheader "x-hgarg-1=bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=0&common=0000000000000000000000000000000000000000&heads=c17445101a72edac06facd130d14808dfbd5c7c2&stream=1" |
|
199 | 205 | 200 Script output follows |
|
200 | 206 | content-type: application/mercurial-0.2 |
|
201 | 207 | |
|
202 | 208 | |
|
203 | 209 | $ f --size --hex --bytes 256 body |
|
204 |
body: size=1122 |
|
|
210 | body: size=112245 | |
|
205 | 211 | 0000: 04 6e 6f 6e 65 48 47 32 30 00 00 00 00 00 00 00 |.noneHG20.......| |
|
206 |
0010: 7 |
|
|
207 |
0020: 05 09 04 0c |
|
|
212 | 0010: 7f 07 53 54 52 45 41 4d 32 00 00 00 00 03 00 09 |..STREAM2.......| | |
|
213 | 0020: 05 09 04 0c 44 62 79 74 65 63 6f 75 6e 74 39 38 |....Dbytecount98| | |
|
208 | 214 | 0030: 37 35 38 66 69 6c 65 63 6f 75 6e 74 31 30 33 30 |758filecount1030| |
|
209 | 215 | 0040: 72 65 71 75 69 72 65 6d 65 6e 74 73 64 6f 74 65 |requirementsdote| |
|
210 | 216 | 0050: 6e 63 6f 64 65 25 32 43 66 6e 63 61 63 68 65 25 |ncode%2Cfncache%| |
|
211 | 217 | 0060: 32 43 67 65 6e 65 72 61 6c 64 65 6c 74 61 25 32 |2Cgeneraldelta%2| |
|
212 |
0070: 43 72 65 76 6c 6f 67 76 31 25 32 43 73 7 |
|
|
213 | 0080: 65 00 00 80 00 73 08 42 64 61 74 61 2f 30 2e 69 |e....s.Bdata/0.i| | |
|
214 | 0090: 00 03 00 01 00 00 00 00 00 00 00 02 00 00 00 01 |................| | |
|
215 |
00a0: 00 00 00 00 00 00 00 01 |
|
|
216 | 00b0: 80 29 63 a0 49 d3 23 87 bf ce fe 56 67 92 67 2c |.)c.I.#....Vg.g,| | |
|
217 | 00c0: 69 d1 ec 39 00 00 00 00 00 00 00 00 00 00 00 00 |i..9............| | |
|
218 | 00d0: 75 30 73 08 42 64 61 74 61 2f 31 2e 69 00 03 00 |u0s.Bdata/1.i...| | |
|
219 | 00e0: 01 00 00 00 00 00 00 00 02 00 00 00 01 00 00 00 |................| | |
|
220 | 00f0: 00 00 00 00 01 ff ff ff ff ff ff ff ff f9 76 da |..............v.| | |
|
218 | 0070: 43 72 65 76 6c 6f 67 76 31 25 32 43 73 70 61 72 |Crevlogv1%2Cspar| | |
|
219 | 0080: 73 65 72 65 76 6c 6f 67 25 32 43 73 74 6f 72 65 |serevlog%2Cstore| | |
|
220 | 0090: 00 00 80 00 73 08 42 64 61 74 61 2f 30 2e 69 00 |....s.Bdata/0.i.| | |
|
221 | 00a0: 03 00 01 00 00 00 00 00 00 00 02 00 00 00 01 00 |................| | |
|
222 | 00b0: 00 00 00 00 00 00 01 ff ff ff ff ff ff ff ff 80 |................| | |
|
223 | 00c0: 29 63 a0 49 d3 23 87 bf ce fe 56 67 92 67 2c 69 |)c.I.#....Vg.g,i| | |
|
224 | 00d0: d1 ec 39 00 00 00 00 00 00 00 00 00 00 00 00 75 |..9............u| | |
|
225 | 00e0: 30 73 08 42 64 61 74 61 2f 31 2e 69 00 03 00 01 |0s.Bdata/1.i....| | |
|
226 | 00f0: 00 00 00 00 00 00 00 02 00 00 00 01 00 00 00 00 |................| | |
|
221 | 227 | |
|
222 | 228 | --uncompressed is an alias to --stream |
|
223 | 229 | |
|
224 | 230 | #if stream-legacy |
|
225 | 231 | $ hg clone --uncompressed -U http://localhost:$HGPORT clone1-uncompressed |
|
226 | 232 | streaming all changes |
|
227 | 233 | 1027 files to transfer, 96.3 KB of data |
|
228 | 234 | transferred 96.3 KB in * seconds (*/sec) (glob) |
|
229 | 235 | searching for changes |
|
230 | 236 | no changes found |
|
231 | 237 | #endif |
|
232 | 238 | #if stream-bundle2 |
|
233 | 239 | $ hg clone --uncompressed -U http://localhost:$HGPORT clone1-uncompressed |
|
234 | 240 | streaming all changes |
|
235 | 241 | 1030 files to transfer, 96.4 KB of data |
|
236 | 242 | transferred 96.4 KB in * seconds (* */sec) (glob) |
|
237 | 243 | #endif |
|
238 | 244 | |
|
239 | 245 | Clone with background file closing enabled |
|
240 | 246 | |
|
241 | 247 | #if stream-legacy |
|
242 | 248 | $ hg --debug --config worker.backgroundclose=true --config worker.backgroundcloseminfilecount=1 clone --stream -U http://localhost:$HGPORT clone-background | grep -v adding |
|
243 | 249 | using http://localhost:$HGPORT/ |
|
244 | 250 | sending capabilities command |
|
245 | 251 | sending branchmap command |
|
246 | 252 | streaming all changes |
|
247 | 253 | sending stream_out command |
|
248 | 254 | 1027 files to transfer, 96.3 KB of data |
|
249 | 255 | starting 4 threads for background file closing |
|
250 | 256 | updating the branch cache |
|
251 | 257 | transferred 96.3 KB in * seconds (*/sec) (glob) |
|
252 | 258 | query 1; heads |
|
253 | 259 | sending batch command |
|
254 | 260 | searching for changes |
|
255 | 261 | all remote heads known locally |
|
256 | 262 | no changes found |
|
257 | 263 | sending getbundle command |
|
258 | 264 | bundle2-input-bundle: with-transaction |
|
259 | 265 | bundle2-input-part: "listkeys" (params: 1 mandatory) supported |
|
260 | 266 | bundle2-input-part: "phase-heads" supported |
|
261 | 267 | bundle2-input-part: total payload size 24 |
|
262 | 268 | bundle2-input-bundle: 1 parts total |
|
263 | 269 | checking for updated bookmarks |
|
264 | 270 | (sent 5 HTTP requests and * bytes; received * bytes in responses) (glob) |
|
265 | 271 | #endif |
|
266 | 272 | #if stream-bundle2 |
|
267 | 273 | $ hg --debug --config worker.backgroundclose=true --config worker.backgroundcloseminfilecount=1 clone --stream -U http://localhost:$HGPORT clone-background | grep -v adding |
|
268 | 274 | using http://localhost:$HGPORT/ |
|
269 | 275 | sending capabilities command |
|
270 | 276 | query 1; heads |
|
271 | 277 | sending batch command |
|
272 | 278 | streaming all changes |
|
273 | 279 | sending getbundle command |
|
274 | 280 | bundle2-input-bundle: with-transaction |
|
275 | 281 | bundle2-input-part: "stream2" (params: 3 mandatory) supported |
|
276 | 282 | applying stream bundle |
|
277 | 283 | 1030 files to transfer, 96.4 KB of data |
|
278 | 284 | starting 4 threads for background file closing |
|
279 | 285 | starting 4 threads for background file closing |
|
280 | 286 | updating the branch cache |
|
281 | 287 | transferred 96.4 KB in * seconds (* */sec) (glob) |
|
282 | 288 | bundle2-input-part: total payload size 112077 |
|
283 | 289 | bundle2-input-part: "listkeys" (params: 1 mandatory) supported |
|
284 | 290 | bundle2-input-bundle: 1 parts total |
|
285 | 291 | checking for updated bookmarks |
|
286 | 292 | (sent 3 HTTP requests and * bytes; received * bytes in responses) (glob) |
|
287 | 293 | #endif |
|
288 | 294 | |
|
289 | 295 | Cannot stream clone when there are secret changesets |
|
290 | 296 | |
|
291 | 297 | $ hg -R server phase --force --secret -r tip |
|
292 | 298 | $ hg clone --stream -U http://localhost:$HGPORT secret-denied |
|
293 | 299 | warning: stream clone requested but server has them disabled |
|
294 | 300 | requesting all changes |
|
295 | 301 | adding changesets |
|
296 | 302 | adding manifests |
|
297 | 303 | adding file changes |
|
298 | 304 | added 1 changesets with 1 changes to 1 files |
|
299 | 305 | new changesets 96ee1d7354c4 |
|
300 | 306 | |
|
301 | 307 | $ killdaemons.py |
|
302 | 308 | |
|
303 | 309 | Streaming of secrets can be overridden by server config |
|
304 | 310 | |
|
305 | 311 | $ cd server |
|
306 | 312 | $ hg serve --config server.uncompressedallowsecret=true -p $HGPORT -d --pid-file=hg.pid |
|
307 | 313 | $ cat hg.pid > $DAEMON_PIDS |
|
308 | 314 | $ cd .. |
|
309 | 315 | |
|
310 | 316 | #if stream-legacy |
|
311 | 317 | $ hg clone --stream -U http://localhost:$HGPORT secret-allowed |
|
312 | 318 | streaming all changes |
|
313 | 319 | 1027 files to transfer, 96.3 KB of data |
|
314 | 320 | transferred 96.3 KB in * seconds (*/sec) (glob) |
|
315 | 321 | searching for changes |
|
316 | 322 | no changes found |
|
317 | 323 | #endif |
|
318 | 324 | #if stream-bundle2 |
|
319 | 325 | $ hg clone --stream -U http://localhost:$HGPORT secret-allowed |
|
320 | 326 | streaming all changes |
|
321 | 327 | 1030 files to transfer, 96.4 KB of data |
|
322 | 328 | transferred 96.4 KB in * seconds (* */sec) (glob) |
|
323 | 329 | #endif |
|
324 | 330 | |
|
325 | 331 | $ killdaemons.py |
|
326 | 332 | |
|
327 | 333 | Verify interaction between preferuncompressed and secret presence |
|
328 | 334 | |
|
329 | 335 | $ cd server |
|
330 | 336 | $ hg serve --config server.preferuncompressed=true -p $HGPORT -d --pid-file=hg.pid |
|
331 | 337 | $ cat hg.pid > $DAEMON_PIDS |
|
332 | 338 | $ cd .. |
|
333 | 339 | |
|
334 | 340 | $ hg clone -U http://localhost:$HGPORT preferuncompressed-secret |
|
335 | 341 | requesting all changes |
|
336 | 342 | adding changesets |
|
337 | 343 | adding manifests |
|
338 | 344 | adding file changes |
|
339 | 345 | added 1 changesets with 1 changes to 1 files |
|
340 | 346 | new changesets 96ee1d7354c4 |
|
341 | 347 | |
|
342 | 348 | $ killdaemons.py |
|
343 | 349 | |
|
344 | 350 | Clone not allowed when full bundles disabled and can't serve secrets |
|
345 | 351 | |
|
346 | 352 | $ cd server |
|
347 | 353 | $ hg serve --config server.disablefullbundle=true -p $HGPORT -d --pid-file=hg.pid |
|
348 | 354 | $ cat hg.pid > $DAEMON_PIDS |
|
349 | 355 | $ cd .. |
|
350 | 356 | |
|
351 | 357 | $ hg clone --stream http://localhost:$HGPORT secret-full-disabled |
|
352 | 358 | warning: stream clone requested but server has them disabled |
|
353 | 359 | requesting all changes |
|
354 | 360 | remote: abort: server has pull-based clones disabled |
|
355 | 361 | abort: pull failed on remote |
|
356 | 362 | (remove --pull if specified or upgrade Mercurial) |
|
357 | 363 | [255] |
|
358 | 364 | |
|
359 | 365 | Local stream clone with secrets involved |
|
360 | 366 | (This is just a test over behavior: if you have access to the repo's files, |
|
361 | 367 | there is no security so it isn't important to prevent a clone here.) |
|
362 | 368 | |
|
363 | 369 | $ hg clone -U --stream server local-secret |
|
364 | 370 | warning: stream clone requested but server has them disabled |
|
365 | 371 | requesting all changes |
|
366 | 372 | adding changesets |
|
367 | 373 | adding manifests |
|
368 | 374 | adding file changes |
|
369 | 375 | added 1 changesets with 1 changes to 1 files |
|
370 | 376 | new changesets 96ee1d7354c4 |
|
371 | 377 | |
|
372 | 378 | Stream clone while repo is changing: |
|
373 | 379 | |
|
374 | 380 | $ mkdir changing |
|
375 | 381 | $ cd changing |
|
376 | 382 | |
|
377 | 383 | extension for delaying the server process so we reliably can modify the repo |
|
378 | 384 | while cloning |
|
379 | 385 | |
|
380 | 386 | $ cat > delayer.py <<EOF |
|
381 | 387 | > import time |
|
382 | 388 | > from mercurial import extensions, vfs |
|
383 | 389 | > def __call__(orig, self, path, *args, **kwargs): |
|
384 | 390 | > if path == 'data/f1.i': |
|
385 | 391 | > time.sleep(2) |
|
386 | 392 | > return orig(self, path, *args, **kwargs) |
|
387 | 393 | > extensions.wrapfunction(vfs.vfs, '__call__', __call__) |
|
388 | 394 | > EOF |
|
389 | 395 | |
|
390 | 396 | prepare repo with small and big file to cover both code paths in emitrevlogdata |
|
391 | 397 | |
|
392 | 398 | $ hg init repo |
|
393 | 399 | $ touch repo/f1 |
|
394 | 400 | $ $TESTDIR/seq.py 50000 > repo/f2 |
|
395 | 401 | $ hg -R repo ci -Aqm "0" |
|
396 | 402 | $ hg serve -R repo -p $HGPORT1 -d --pid-file=hg.pid --config extensions.delayer=delayer.py |
|
397 | 403 | $ cat hg.pid >> $DAEMON_PIDS |
|
398 | 404 | |
|
399 | 405 | clone while modifying the repo between stating file with write lock and |
|
400 | 406 | actually serving file content |
|
401 | 407 | |
|
402 | 408 | $ hg clone -q --stream -U http://localhost:$HGPORT1 clone & |
|
403 | 409 | $ sleep 1 |
|
404 | 410 | $ echo >> repo/f1 |
|
405 | 411 | $ echo >> repo/f2 |
|
406 | 412 | $ hg -R repo ci -m "1" |
|
407 | 413 | $ wait |
|
408 | 414 | $ hg -R clone id |
|
409 | 415 | 000000000000 |
|
410 | 416 | $ cd .. |
|
411 | 417 | |
|
412 | 418 | Stream repository with bookmarks |
|
413 | 419 | -------------------------------- |
|
414 | 420 | |
|
415 | 421 | (revert introduction of secret changeset) |
|
416 | 422 | |
|
417 | 423 | $ hg -R server phase --draft 'secret()' |
|
418 | 424 | |
|
419 | 425 | add a bookmark |
|
420 | 426 | |
|
421 | 427 | $ hg -R server bookmark -r tip some-bookmark |
|
422 | 428 | |
|
423 | 429 | clone it |
|
424 | 430 | |
|
425 | 431 | #if stream-legacy |
|
426 | 432 | $ hg clone --stream http://localhost:$HGPORT with-bookmarks |
|
427 | 433 | streaming all changes |
|
428 | 434 | 1027 files to transfer, 96.3 KB of data |
|
429 | 435 | transferred 96.3 KB in * seconds (*) (glob) |
|
430 | 436 | searching for changes |
|
431 | 437 | no changes found |
|
432 | 438 | updating to branch default |
|
433 | 439 | 1025 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
434 | 440 | #endif |
|
435 | 441 | #if stream-bundle2 |
|
436 | 442 | $ hg clone --stream http://localhost:$HGPORT with-bookmarks |
|
437 | 443 | streaming all changes |
|
438 | 444 | 1033 files to transfer, 96.6 KB of data |
|
439 | 445 | transferred 96.6 KB in * seconds (* */sec) (glob) |
|
440 | 446 | updating to branch default |
|
441 | 447 | 1025 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
442 | 448 | #endif |
|
443 | 449 | $ hg -R with-bookmarks bookmarks |
|
444 | 450 | some-bookmark 1:c17445101a72 |
|
445 | 451 | |
|
446 | 452 | Stream repository with phases |
|
447 | 453 | ----------------------------- |
|
448 | 454 | |
|
449 | 455 | Clone as publishing |
|
450 | 456 | |
|
451 | 457 | $ hg -R server phase -r 'all()' |
|
452 | 458 | 0: draft |
|
453 | 459 | 1: draft |
|
454 | 460 | |
|
455 | 461 | #if stream-legacy |
|
456 | 462 | $ hg clone --stream http://localhost:$HGPORT phase-publish |
|
457 | 463 | streaming all changes |
|
458 | 464 | 1027 files to transfer, 96.3 KB of data |
|
459 | 465 | transferred 96.3 KB in * seconds (*) (glob) |
|
460 | 466 | searching for changes |
|
461 | 467 | no changes found |
|
462 | 468 | updating to branch default |
|
463 | 469 | 1025 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
464 | 470 | #endif |
|
465 | 471 | #if stream-bundle2 |
|
466 | 472 | $ hg clone --stream http://localhost:$HGPORT phase-publish |
|
467 | 473 | streaming all changes |
|
468 | 474 | 1033 files to transfer, 96.6 KB of data |
|
469 | 475 | transferred 96.6 KB in * seconds (* */sec) (glob) |
|
470 | 476 | updating to branch default |
|
471 | 477 | 1025 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
472 | 478 | #endif |
|
473 | 479 | $ hg -R phase-publish phase -r 'all()' |
|
474 | 480 | 0: public |
|
475 | 481 | 1: public |
|
476 | 482 | |
|
477 | 483 | Clone as non publishing |
|
478 | 484 | |
|
479 | 485 | $ cat << EOF >> server/.hg/hgrc |
|
480 | 486 | > [phases] |
|
481 | 487 | > publish = False |
|
482 | 488 | > EOF |
|
483 | 489 | $ killdaemons.py |
|
484 | 490 | $ hg -R server serve -p $HGPORT -d --pid-file=hg.pid |
|
485 | 491 | $ cat hg.pid > $DAEMON_PIDS |
|
486 | 492 | |
|
487 | 493 | #if stream-legacy |
|
488 | 494 | |
|
489 | 495 | With v1 of the stream protocol, changeset are always cloned as public. It make |
|
490 | 496 | stream v1 unsuitable for non-publishing repository. |
|
491 | 497 | |
|
492 | 498 | $ hg clone --stream http://localhost:$HGPORT phase-no-publish |
|
493 | 499 | streaming all changes |
|
494 | 500 | 1027 files to transfer, 96.3 KB of data |
|
495 | 501 | transferred 96.3 KB in * seconds (*) (glob) |
|
496 | 502 | searching for changes |
|
497 | 503 | no changes found |
|
498 | 504 | updating to branch default |
|
499 | 505 | 1025 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
500 | 506 | $ hg -R phase-no-publish phase -r 'all()' |
|
501 | 507 | 0: public |
|
502 | 508 | 1: public |
|
503 | 509 | #endif |
|
504 | 510 | #if stream-bundle2 |
|
505 | 511 | $ hg clone --stream http://localhost:$HGPORT phase-no-publish |
|
506 | 512 | streaming all changes |
|
507 | 513 | 1034 files to transfer, 96.7 KB of data |
|
508 | 514 | transferred 96.7 KB in * seconds (* */sec) (glob) |
|
509 | 515 | updating to branch default |
|
510 | 516 | 1025 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
511 | 517 | $ hg -R phase-no-publish phase -r 'all()' |
|
512 | 518 | 0: draft |
|
513 | 519 | 1: draft |
|
514 | 520 | #endif |
|
515 | 521 | |
|
516 | 522 | $ killdaemons.py |
|
517 | 523 | |
|
518 | 524 | #if stream-legacy |
|
519 | 525 | |
|
520 | 526 | With v1 of the stream protocol, changeset are always cloned as public. There's |
|
521 | 527 | no obsolescence markers exchange in stream v1. |
|
522 | 528 | |
|
523 | 529 | #endif |
|
524 | 530 | #if stream-bundle2 |
|
525 | 531 | |
|
526 | 532 | Stream repository with obsolescence |
|
527 | 533 | ----------------------------------- |
|
528 | 534 | |
|
529 | 535 | Clone non-publishing with obsolescence |
|
530 | 536 | |
|
531 | 537 | $ cat >> $HGRCPATH << EOF |
|
532 | 538 | > [experimental] |
|
533 | 539 | > evolution=all |
|
534 | 540 | > EOF |
|
535 | 541 | |
|
536 | 542 | $ cd server |
|
537 | 543 | $ echo foo > foo |
|
538 | 544 | $ hg -q commit -m 'about to be pruned' |
|
539 | 545 | $ hg debugobsolete `hg log -r . -T '{node}'` -d '0 0' -u test --record-parents |
|
540 | 546 | obsoleted 1 changesets |
|
541 | 547 | $ hg up null -q |
|
542 | 548 | $ hg log -T '{rev}: {phase}\n' |
|
543 | 549 | 1: draft |
|
544 | 550 | 0: draft |
|
545 | 551 | $ hg serve -p $HGPORT -d --pid-file=hg.pid |
|
546 | 552 | $ cat hg.pid > $DAEMON_PIDS |
|
547 | 553 | $ cd .. |
|
548 | 554 | |
|
549 | 555 | $ hg clone -U --stream http://localhost:$HGPORT with-obsolescence |
|
550 | 556 | streaming all changes |
|
551 | 557 | 1035 files to transfer, 97.1 KB of data |
|
552 | 558 | transferred 97.1 KB in * seconds (* */sec) (glob) |
|
553 | 559 | $ hg -R with-obsolescence log -T '{rev}: {phase}\n' |
|
554 | 560 | 1: draft |
|
555 | 561 | 0: draft |
|
556 | 562 | $ hg debugobsolete -R with-obsolescence |
|
557 | 563 | 50382b884f66690b7045cac93a540cba4d4c906f 0 {c17445101a72edac06facd130d14808dfbd5c7c2} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} |
|
558 | 564 | |
|
559 | 565 | $ hg clone -U --stream --config experimental.evolution=0 http://localhost:$HGPORT with-obsolescence-no-evolution |
|
560 | 566 | streaming all changes |
|
561 | 567 | remote: abort: server has obsolescence markers, but client cannot receive them via stream clone |
|
562 | 568 | abort: pull failed on remote |
|
563 | 569 | [255] |
|
564 | 570 | |
|
565 | 571 | $ killdaemons.py |
|
566 | 572 | |
|
567 | 573 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now