##// END OF EJS Templates
tests: More cleanly separate expected hexdump output...
Simon Sapin -
r48053:6a60f03d default
parent child Browse files
Show More
@@ -1,670 +1,687 b''
1 1 #require serve no-reposimplestore no-chg
2 2
3 3 #testcases stream-legacy stream-bundle2
4 4
5 5 #if stream-legacy
6 6 $ cat << EOF >> $HGRCPATH
7 7 > [server]
8 8 > bundle2.stream = no
9 9 > EOF
10 10 #endif
11 11
12 12 Initialize repository
13 13 the status call is to check for issue5130
14 14
15 15 $ hg init server
16 16 $ cd server
17 17 $ touch foo
18 18 $ hg -q commit -A -m initial
19 19 >>> for i in range(1024):
20 20 ... with open(str(i), 'wb') as fh:
21 21 ... fh.write(b"%d" % i) and None
22 22 $ hg -q commit -A -m 'add a lot of files'
23 23 $ hg st
24 24 $ hg --config server.uncompressed=false serve -p $HGPORT -d --pid-file=hg.pid
25 25 $ cat hg.pid > $DAEMON_PIDS
26 26 $ cd ..
27 27
28 28 Cannot stream clone when server.uncompressed is set
29 29
30 30 $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=stream_out'
31 31 200 Script output follows
32 32
33 33 1
34 34
35 35 #if stream-legacy
36 36 $ hg debugcapabilities http://localhost:$HGPORT
37 37 Main capabilities:
38 38 batch
39 39 branchmap
40 40 $USUAL_BUNDLE2_CAPS_SERVER$
41 41 changegroupsubset
42 42 compression=$BUNDLE2_COMPRESSIONS$
43 43 getbundle
44 44 httpheader=1024
45 45 httpmediatype=0.1rx,0.1tx,0.2tx
46 46 known
47 47 lookup
48 48 pushkey
49 49 unbundle=HG10GZ,HG10BZ,HG10UN
50 50 unbundlehash
51 51 Bundle2 capabilities:
52 52 HG20
53 53 bookmarks
54 54 changegroup
55 55 01
56 56 02
57 57 checkheads
58 58 related
59 59 digests
60 60 md5
61 61 sha1
62 62 sha512
63 63 error
64 64 abort
65 65 unsupportedcontent
66 66 pushraced
67 67 pushkey
68 68 hgtagsfnodes
69 69 listkeys
70 70 phases
71 71 heads
72 72 pushkey
73 73 remote-changegroup
74 74 http
75 75 https
76 76
77 77 $ hg clone --stream -U http://localhost:$HGPORT server-disabled
78 78 warning: stream clone requested but server has them disabled
79 79 requesting all changes
80 80 adding changesets
81 81 adding manifests
82 82 adding file changes
83 83 added 2 changesets with 1025 changes to 1025 files
84 84 new changesets 96ee1d7354c4:c17445101a72
85 85
86 86 $ 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"
87 87 200 Script output follows
88 88 content-type: application/mercurial-0.2
89 89
90 90
91 91 $ f --size body --hexdump --bytes 100
92 92 body: size=232
93 93 0000: 04 6e 6f 6e 65 48 47 32 30 00 00 00 00 00 00 00 |.noneHG20.......|
94 94 0010: cf 0b 45 52 52 4f 52 3a 41 42 4f 52 54 00 00 00 |..ERROR:ABORT...|
95 95 0020: 00 01 01 07 3c 04 72 6d 65 73 73 61 67 65 73 74 |....<.rmessagest|
96 96 0030: 72 65 61 6d 20 64 61 74 61 20 72 65 71 75 65 73 |ream data reques|
97 97 0040: 74 65 64 20 62 75 74 20 73 65 72 76 65 72 20 64 |ted but server d|
98 98 0050: 6f 65 73 20 6e 6f 74 20 61 6c 6c 6f 77 20 74 68 |oes not allow th|
99 99 0060: 69 73 20 66 |is f|
100 100
101 101 #endif
102 102 #if stream-bundle2
103 103 $ hg debugcapabilities http://localhost:$HGPORT
104 104 Main capabilities:
105 105 batch
106 106 branchmap
107 107 $USUAL_BUNDLE2_CAPS_SERVER$
108 108 changegroupsubset
109 109 compression=$BUNDLE2_COMPRESSIONS$
110 110 getbundle
111 111 httpheader=1024
112 112 httpmediatype=0.1rx,0.1tx,0.2tx
113 113 known
114 114 lookup
115 115 pushkey
116 116 unbundle=HG10GZ,HG10BZ,HG10UN
117 117 unbundlehash
118 118 Bundle2 capabilities:
119 119 HG20
120 120 bookmarks
121 121 changegroup
122 122 01
123 123 02
124 124 checkheads
125 125 related
126 126 digests
127 127 md5
128 128 sha1
129 129 sha512
130 130 error
131 131 abort
132 132 unsupportedcontent
133 133 pushraced
134 134 pushkey
135 135 hgtagsfnodes
136 136 listkeys
137 137 phases
138 138 heads
139 139 pushkey
140 140 remote-changegroup
141 141 http
142 142 https
143 143
144 144 $ hg clone --stream -U http://localhost:$HGPORT server-disabled
145 145 warning: stream clone requested but server has them disabled
146 146 requesting all changes
147 147 adding changesets
148 148 adding manifests
149 149 adding file changes
150 150 added 2 changesets with 1025 changes to 1025 files
151 151 new changesets 96ee1d7354c4:c17445101a72
152 152
153 153 $ 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"
154 154 200 Script output follows
155 155 content-type: application/mercurial-0.2
156 156
157 157
158 158 $ f --size body --hexdump --bytes 100
159 159 body: size=232
160 160 0000: 04 6e 6f 6e 65 48 47 32 30 00 00 00 00 00 00 00 |.noneHG20.......|
161 161 0010: cf 0b 45 52 52 4f 52 3a 41 42 4f 52 54 00 00 00 |..ERROR:ABORT...|
162 162 0020: 00 01 01 07 3c 04 72 6d 65 73 73 61 67 65 73 74 |....<.rmessagest|
163 163 0030: 72 65 61 6d 20 64 61 74 61 20 72 65 71 75 65 73 |ream data reques|
164 164 0040: 74 65 64 20 62 75 74 20 73 65 72 76 65 72 20 64 |ted but server d|
165 165 0050: 6f 65 73 20 6e 6f 74 20 61 6c 6c 6f 77 20 74 68 |oes not allow th|
166 166 0060: 69 73 20 66 |is f|
167 167
168 168 #endif
169 169
170 170 $ killdaemons.py
171 171 $ cd server
172 172 $ hg serve -p $HGPORT -d --pid-file=hg.pid --error errors.txt
173 173 $ cat hg.pid > $DAEMON_PIDS
174 174 $ cd ..
175 175
176 176 Basic clone
177 177
178 178 #if stream-legacy
179 179 $ hg clone --stream -U http://localhost:$HGPORT clone1
180 180 streaming all changes
181 181 1027 files to transfer, 96.3 KB of data (no-zstd !)
182 182 transferred 96.3 KB in * seconds (*/sec) (glob) (no-zstd !)
183 183 1027 files to transfer, 93.5 KB of data (zstd !)
184 184 transferred 93.5 KB in * seconds (* */sec) (glob) (zstd !)
185 185 searching for changes
186 186 no changes found
187 187 $ cat server/errors.txt
188 188 #endif
189 189 #if stream-bundle2
190 190 $ hg clone --stream -U http://localhost:$HGPORT clone1
191 191 streaming all changes
192 192 1030 files to transfer, 96.5 KB of data (no-zstd !)
193 193 transferred 96.5 KB in * seconds (*/sec) (glob) (no-zstd !)
194 194 1030 files to transfer, 93.6 KB of data (zstd !)
195 195 transferred 93.6 KB in * seconds (* */sec) (glob) (zstd !)
196 196
197 197 $ ls -1 clone1/.hg/cache
198 198 branch2-base
199 199 branch2-immutable
200 200 branch2-served
201 201 branch2-served.hidden
202 202 branch2-visible
203 203 branch2-visible-hidden
204 204 rbc-names-v1
205 205 rbc-revs-v1
206 206 tags2
207 207 tags2-served
208 208 $ cat server/errors.txt
209 209 #endif
210 210
211 211 getbundle requests with stream=1 are uncompressed
212 212
213 213 $ 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"
214 214 200 Script output follows
215 215 content-type: application/mercurial-0.2
216 216
217 217
218 #if no-zstd no-rust
218 219 $ f --size --hex --bytes 256 body
219 body: size=112262 (no-zstd !)
220 body: size=109410 (zstd no-rust !)
221 body: size=109431 (rust !)
220 body: size=112262
222 221 0000: 04 6e 6f 6e 65 48 47 32 30 00 00 00 00 00 00 00 |.noneHG20.......|
223 0010: 7f 07 53 54 52 45 41 4d 32 00 00 00 00 03 00 09 |..STREAM2.......| (no-zstd !)
224 0020: 05 09 04 0c 44 62 79 74 65 63 6f 75 6e 74 39 38 |....Dbytecount98| (no-zstd !)
225 0030: 37 37 35 66 69 6c 65 63 6f 75 6e 74 31 30 33 30 |775filecount1030| (no-zstd !)
226 0010: 99 07 53 54 52 45 41 4d 32 00 00 00 00 03 00 09 |..STREAM2.......| (zstd no-rust !)
227 0010: ae 07 53 54 52 45 41 4d 32 00 00 00 00 03 00 09 |..STREAM2.......| (rust !)
228 0020: 05 09 04 0c 5e 62 79 74 65 63 6f 75 6e 74 39 35 |....^bytecount95| (zstd no-rust !)
229 0020: 05 09 04 0c 73 62 79 74 65 63 6f 75 6e 74 39 35 |....sbytecount95| (rust !)
230 0030: 38 39 37 66 69 6c 65 63 6f 75 6e 74 31 30 33 30 |897filecount1030| (zstd !)
222 0010: 7f 07 53 54 52 45 41 4d 32 00 00 00 00 03 00 09 |..STREAM2.......|
223 0020: 05 09 04 0c 44 62 79 74 65 63 6f 75 6e 74 39 38 |....Dbytecount98|
224 0030: 37 37 35 66 69 6c 65 63 6f 75 6e 74 31 30 33 30 |775filecount1030|
225 0040: 72 65 71 75 69 72 65 6d 65 6e 74 73 64 6f 74 65 |requirementsdote|
226 0050: 6e 63 6f 64 65 25 32 43 66 6e 63 61 63 68 65 25 |ncode%2Cfncache%|
227 0060: 32 43 67 65 6e 65 72 61 6c 64 65 6c 74 61 25 32 |2Cgeneraldelta%2|
228 0070: 43 72 65 76 6c 6f 67 76 31 25 32 43 73 70 61 72 |Crevlogv1%2Cspar|
229 0080: 73 65 72 65 76 6c 6f 67 25 32 43 73 74 6f 72 65 |serevlog%2Cstore|
230 0090: 00 00 80 00 73 08 42 64 61 74 61 2f 30 2e 69 00 |....s.Bdata/0.i.|
231 00a0: 03 00 01 00 00 00 00 00 00 00 02 00 00 00 01 00 |................|
232 00b0: 00 00 00 00 00 00 01 ff ff ff ff ff ff ff ff 80 |................|
233 00c0: 29 63 a0 49 d3 23 87 bf ce fe 56 67 92 67 2c 69 |)c.I.#....Vg.g,i|
234 00d0: d1 ec 39 00 00 00 00 00 00 00 00 00 00 00 00 75 |..9............u|
235 00e0: 30 73 08 42 64 61 74 61 2f 31 2e 69 00 03 00 01 |0s.Bdata/1.i....|
236 00f0: 00 00 00 00 00 00 00 02 00 00 00 01 00 00 00 00 |................|
237 #endif
238 #if zstd no-rust
239 $ f --size --hex --bytes 256 body
240 body: size=109410
241 0000: 04 6e 6f 6e 65 48 47 32 30 00 00 00 00 00 00 00 |.noneHG20.......|
242 0010: 99 07 53 54 52 45 41 4d 32 00 00 00 00 03 00 09 |..STREAM2.......|
243 0020: 05 09 04 0c 5e 62 79 74 65 63 6f 75 6e 74 39 35 |....^bytecount95|
244 0030: 38 39 37 66 69 6c 65 63 6f 75 6e 74 31 30 33 30 |897filecount1030|
231 245 0040: 72 65 71 75 69 72 65 6d 65 6e 74 73 64 6f 74 65 |requirementsdote|
232 246 0050: 6e 63 6f 64 65 25 32 43 66 6e 63 61 63 68 65 25 |ncode%2Cfncache%|
233 247 0060: 32 43 67 65 6e 65 72 61 6c 64 65 6c 74 61 25 32 |2Cgeneraldelta%2|
234 0070: 43 72 65 76 6c 6f 67 76 31 25 32 43 73 70 61 72 |Crevlogv1%2Cspar| (no-zstd !)
235 0080: 73 65 72 65 76 6c 6f 67 25 32 43 73 74 6f 72 65 |serevlog%2Cstore| (no-zstd !)
236 0090: 00 00 80 00 73 08 42 64 61 74 61 2f 30 2e 69 00 |....s.Bdata/0.i.| (no-zstd !)
237 00a0: 03 00 01 00 00 00 00 00 00 00 02 00 00 00 01 00 |................| (no-zstd !)
238 00b0: 00 00 00 00 00 00 01 ff ff ff ff ff ff ff ff 80 |................| (no-zstd !)
239 00c0: 29 63 a0 49 d3 23 87 bf ce fe 56 67 92 67 2c 69 |)c.I.#....Vg.g,i| (no-zstd !)
240 00d0: d1 ec 39 00 00 00 00 00 00 00 00 00 00 00 00 75 |..9............u| (no-zstd !)
241 00e0: 30 73 08 42 64 61 74 61 2f 31 2e 69 00 03 00 01 |0s.Bdata/1.i....| (no-zstd !)
242 00f0: 00 00 00 00 00 00 00 02 00 00 00 01 00 00 00 00 |................| (no-zstd !)
243 0070: 43 72 65 76 6c 6f 67 2d 63 6f 6d 70 72 65 73 73 |Crevlog-compress| (zstd no-rust !)
244 0070: 43 70 65 72 73 69 73 74 65 6e 74 2d 6e 6f 64 65 |Cpersistent-node| (rust !)
245 0080: 69 6f 6e 2d 7a 73 74 64 25 32 43 72 65 76 6c 6f |ion-zstd%2Crevlo| (zstd no-rust !)
246 0080: 6d 61 70 25 32 43 72 65 76 6c 6f 67 2d 63 6f 6d |map%2Crevlog-com| (rust !)
247 0090: 67 76 31 25 32 43 73 70 61 72 73 65 72 65 76 6c |gv1%2Csparserevl| (zstd no-rust !)
248 0090: 70 72 65 73 73 69 6f 6e 2d 7a 73 74 64 25 32 43 |pression-zstd%2C| (rust !)
249 00a0: 6f 67 25 32 43 73 74 6f 72 65 00 00 80 00 73 08 |og%2Cstore....s.| (zstd no-rust !)
250 00a0: 72 65 76 6c 6f 67 76 31 25 32 43 73 70 61 72 73 |revlogv1%2Cspars| (rust !)
251 00b0: 42 64 61 74 61 2f 30 2e 69 00 03 00 01 00 00 00 |Bdata/0.i.......| (zstd no-rust !)
252 00b0: 65 72 65 76 6c 6f 67 25 32 43 73 74 6f 72 65 00 |erevlog%2Cstore.| (rust !)
253 00c0: 00 00 00 00 02 00 00 00 01 00 00 00 00 00 00 00 |................| (zstd no-rust !)
254 00c0: 00 80 00 73 08 42 64 61 74 61 2f 30 2e 69 00 03 |...s.Bdata/0.i..| (rust !)
255 00d0: 01 ff ff ff ff ff ff ff ff 80 29 63 a0 49 d3 23 |..........)c.I.#| (zstd no-rust !)
256 00d0: 00 01 00 00 00 00 00 00 00 02 00 00 00 01 00 00 |................| (rust !)
257 00e0: 87 bf ce fe 56 67 92 67 2c 69 d1 ec 39 00 00 00 |....Vg.g,i..9...| (zstd no-rust !)
258 00e0: 00 00 00 00 00 01 ff ff ff ff ff ff ff ff 80 29 |...............)| (rust !)
259 00f0: 00 00 00 00 00 00 00 00 00 75 30 73 08 42 64 61 |.........u0s.Bda| (zstd no-rust !)
260 00f0: 63 a0 49 d3 23 87 bf ce fe 56 67 92 67 2c 69 d1 |c.I.#....Vg.g,i.| (rust !)
248 0070: 43 72 65 76 6c 6f 67 2d 63 6f 6d 70 72 65 73 73 |Crevlog-compress|
249 0080: 69 6f 6e 2d 7a 73 74 64 25 32 43 72 65 76 6c 6f |ion-zstd%2Crevlo|
250 0090: 67 76 31 25 32 43 73 70 61 72 73 65 72 65 76 6c |gv1%2Csparserevl|
251 00a0: 6f 67 25 32 43 73 74 6f 72 65 00 00 80 00 73 08 |og%2Cstore....s.|
252 00b0: 42 64 61 74 61 2f 30 2e 69 00 03 00 01 00 00 00 |Bdata/0.i.......|
253 00c0: 00 00 00 00 02 00 00 00 01 00 00 00 00 00 00 00 |................|
254 00d0: 01 ff ff ff ff ff ff ff ff 80 29 63 a0 49 d3 23 |..........)c.I.#|
255 00e0: 87 bf ce fe 56 67 92 67 2c 69 d1 ec 39 00 00 00 |....Vg.g,i..9...|
256 00f0: 00 00 00 00 00 00 00 00 00 75 30 73 08 42 64 61 |.........u0s.Bda|
257 #endif
258 #if zstd rust
259 $ f --size --hex --bytes 256 body
260 body: size=109431
261 0000: 04 6e 6f 6e 65 48 47 32 30 00 00 00 00 00 00 00 |.noneHG20.......|
262 0010: ae 07 53 54 52 45 41 4d 32 00 00 00 00 03 00 09 |..STREAM2.......|
263 0020: 05 09 04 0c 73 62 79 74 65 63 6f 75 6e 74 39 35 |....sbytecount95|
264 0030: 38 39 37 66 69 6c 65 63 6f 75 6e 74 31 30 33 30 |897filecount1030|
265 0040: 72 65 71 75 69 72 65 6d 65 6e 74 73 64 6f 74 65 |requirementsdote|
266 0050: 6e 63 6f 64 65 25 32 43 66 6e 63 61 63 68 65 25 |ncode%2Cfncache%|
267 0060: 32 43 67 65 6e 65 72 61 6c 64 65 6c 74 61 25 32 |2Cgeneraldelta%2|
268 0070: 43 70 65 72 73 69 73 74 65 6e 74 2d 6e 6f 64 65 |Cpersistent-node|
269 0080: 6d 61 70 25 32 43 72 65 76 6c 6f 67 2d 63 6f 6d |map%2Crevlog-com|
270 0090: 70 72 65 73 73 69 6f 6e 2d 7a 73 74 64 25 32 43 |pression-zstd%2C|
271 00a0: 72 65 76 6c 6f 67 76 31 25 32 43 73 70 61 72 73 |revlogv1%2Cspars|
272 00b0: 65 72 65 76 6c 6f 67 25 32 43 73 74 6f 72 65 00 |erevlog%2Cstore.|
273 00c0: 00 80 00 73 08 42 64 61 74 61 2f 30 2e 69 00 03 |...s.Bdata/0.i..|
274 00d0: 00 01 00 00 00 00 00 00 00 02 00 00 00 01 00 00 |................|
275 00e0: 00 00 00 00 00 01 ff ff ff ff ff ff ff ff 80 29 |...............)|
276 00f0: 63 a0 49 d3 23 87 bf ce fe 56 67 92 67 2c 69 d1 |c.I.#....Vg.g,i.|
277 #endif
261 278
262 279 --uncompressed is an alias to --stream
263 280
264 281 #if stream-legacy
265 282 $ hg clone --uncompressed -U http://localhost:$HGPORT clone1-uncompressed
266 283 streaming all changes
267 284 1027 files to transfer, 96.3 KB of data (no-zstd !)
268 285 transferred 96.3 KB in * seconds (*/sec) (glob) (no-zstd !)
269 286 1027 files to transfer, 93.5 KB of data (zstd !)
270 287 transferred 93.5 KB in * seconds (* */sec) (glob) (zstd !)
271 288 searching for changes
272 289 no changes found
273 290 #endif
274 291 #if stream-bundle2
275 292 $ hg clone --uncompressed -U http://localhost:$HGPORT clone1-uncompressed
276 293 streaming all changes
277 294 1030 files to transfer, 96.5 KB of data (no-zstd !)
278 295 transferred 96.5 KB in * seconds (* */sec) (glob) (no-zstd !)
279 296 1030 files to transfer, 93.6 KB of data (zstd !)
280 297 transferred 93.6 KB in * seconds (* */sec) (glob) (zstd !)
281 298 #endif
282 299
283 300 Clone with background file closing enabled
284 301
285 302 #if stream-legacy
286 303 $ hg --debug --config worker.backgroundclose=true --config worker.backgroundcloseminfilecount=1 clone --stream -U http://localhost:$HGPORT clone-background | grep -v adding
287 304 using http://localhost:$HGPORT/
288 305 sending capabilities command
289 306 sending branchmap command
290 307 streaming all changes
291 308 sending stream_out command
292 309 1027 files to transfer, 96.3 KB of data (no-zstd !)
293 310 1027 files to transfer, 93.5 KB of data (zstd !)
294 311 starting 4 threads for background file closing
295 312 updating the branch cache
296 313 transferred 96.3 KB in * seconds (*/sec) (glob) (no-zstd !)
297 314 transferred 93.5 KB in * seconds (* */sec) (glob) (zstd !)
298 315 query 1; heads
299 316 sending batch command
300 317 searching for changes
301 318 all remote heads known locally
302 319 no changes found
303 320 sending getbundle command
304 321 bundle2-input-bundle: with-transaction
305 322 bundle2-input-part: "listkeys" (params: 1 mandatory) supported
306 323 bundle2-input-part: "phase-heads" supported
307 324 bundle2-input-part: total payload size 24
308 325 bundle2-input-bundle: 2 parts total
309 326 checking for updated bookmarks
310 327 updating the branch cache
311 328 (sent 5 HTTP requests and * bytes; received * bytes in responses) (glob)
312 329 #endif
313 330 #if stream-bundle2
314 331 $ hg --debug --config worker.backgroundclose=true --config worker.backgroundcloseminfilecount=1 clone --stream -U http://localhost:$HGPORT clone-background | grep -v adding
315 332 using http://localhost:$HGPORT/
316 333 sending capabilities command
317 334 query 1; heads
318 335 sending batch command
319 336 streaming all changes
320 337 sending getbundle command
321 338 bundle2-input-bundle: with-transaction
322 339 bundle2-input-part: "stream2" (params: 3 mandatory) supported
323 340 applying stream bundle
324 341 1030 files to transfer, 96.5 KB of data (no-zstd !)
325 342 1030 files to transfer, 93.6 KB of data (zstd !)
326 343 starting 4 threads for background file closing
327 344 starting 4 threads for background file closing
328 345 updating the branch cache
329 346 transferred 96.5 KB in * seconds (* */sec) (glob) (no-zstd !)
330 347 bundle2-input-part: total payload size 112094 (no-zstd !)
331 348 transferred 93.6 KB in * seconds (* */sec) (glob) (zstd !)
332 349 bundle2-input-part: total payload size 109216 (zstd !)
333 350 bundle2-input-part: "listkeys" (params: 1 mandatory) supported
334 351 bundle2-input-bundle: 2 parts total
335 352 checking for updated bookmarks
336 353 updating the branch cache
337 354 (sent 3 HTTP requests and * bytes; received * bytes in responses) (glob)
338 355 #endif
339 356
340 357 Cannot stream clone when there are secret changesets
341 358
342 359 $ hg -R server phase --force --secret -r tip
343 360 $ hg clone --stream -U http://localhost:$HGPORT secret-denied
344 361 warning: stream clone requested but server has them disabled
345 362 requesting all changes
346 363 adding changesets
347 364 adding manifests
348 365 adding file changes
349 366 added 1 changesets with 1 changes to 1 files
350 367 new changesets 96ee1d7354c4
351 368
352 369 $ killdaemons.py
353 370
354 371 Streaming of secrets can be overridden by server config
355 372
356 373 $ cd server
357 374 $ hg serve --config server.uncompressedallowsecret=true -p $HGPORT -d --pid-file=hg.pid
358 375 $ cat hg.pid > $DAEMON_PIDS
359 376 $ cd ..
360 377
361 378 #if stream-legacy
362 379 $ hg clone --stream -U http://localhost:$HGPORT secret-allowed
363 380 streaming all changes
364 381 1027 files to transfer, 96.3 KB of data (no-zstd !)
365 382 transferred 96.3 KB in * seconds (*/sec) (glob) (no-zstd !)
366 383 1027 files to transfer, 93.5 KB of data (zstd !)
367 384 transferred 93.5 KB in * seconds (* */sec) (glob) (zstd !)
368 385 searching for changes
369 386 no changes found
370 387 #endif
371 388 #if stream-bundle2
372 389 $ hg clone --stream -U http://localhost:$HGPORT secret-allowed
373 390 streaming all changes
374 391 1030 files to transfer, 96.5 KB of data (no-zstd !)
375 392 transferred 96.5 KB in * seconds (* */sec) (glob) (no-zstd !)
376 393 1030 files to transfer, 93.6 KB of data (zstd !)
377 394 transferred 93.6 KB in * seconds (* */sec) (glob) (zstd !)
378 395 #endif
379 396
380 397 $ killdaemons.py
381 398
382 399 Verify interaction between preferuncompressed and secret presence
383 400
384 401 $ cd server
385 402 $ hg serve --config server.preferuncompressed=true -p $HGPORT -d --pid-file=hg.pid
386 403 $ cat hg.pid > $DAEMON_PIDS
387 404 $ cd ..
388 405
389 406 $ hg clone -U http://localhost:$HGPORT preferuncompressed-secret
390 407 requesting all changes
391 408 adding changesets
392 409 adding manifests
393 410 adding file changes
394 411 added 1 changesets with 1 changes to 1 files
395 412 new changesets 96ee1d7354c4
396 413
397 414 $ killdaemons.py
398 415
399 416 Clone not allowed when full bundles disabled and can't serve secrets
400 417
401 418 $ cd server
402 419 $ hg serve --config server.disablefullbundle=true -p $HGPORT -d --pid-file=hg.pid
403 420 $ cat hg.pid > $DAEMON_PIDS
404 421 $ cd ..
405 422
406 423 $ hg clone --stream http://localhost:$HGPORT secret-full-disabled
407 424 warning: stream clone requested but server has them disabled
408 425 requesting all changes
409 426 remote: abort: server has pull-based clones disabled
410 427 abort: pull failed on remote
411 428 (remove --pull if specified or upgrade Mercurial)
412 429 [100]
413 430
414 431 Local stream clone with secrets involved
415 432 (This is just a test over behavior: if you have access to the repo's files,
416 433 there is no security so it isn't important to prevent a clone here.)
417 434
418 435 $ hg clone -U --stream server local-secret
419 436 warning: stream clone requested but server has them disabled
420 437 requesting all changes
421 438 adding changesets
422 439 adding manifests
423 440 adding file changes
424 441 added 1 changesets with 1 changes to 1 files
425 442 new changesets 96ee1d7354c4
426 443
427 444 Stream clone while repo is changing:
428 445
429 446 $ mkdir changing
430 447 $ cd changing
431 448
432 449 extension for delaying the server process so we reliably can modify the repo
433 450 while cloning
434 451
435 452 $ cat > stream_steps.py <<EOF
436 453 > import os
437 454 > import sys
438 455 > from mercurial import (
439 456 > encoding,
440 457 > extensions,
441 458 > streamclone,
442 459 > testing,
443 460 > )
444 461 > WALKED_FILE_1 = encoding.environ[b'HG_TEST_STREAM_WALKED_FILE_1']
445 462 > WALKED_FILE_2 = encoding.environ[b'HG_TEST_STREAM_WALKED_FILE_2']
446 463 >
447 464 > def _test_sync_point_walk_1(orig, repo):
448 465 > testing.write_file(WALKED_FILE_1)
449 466 >
450 467 > def _test_sync_point_walk_2(orig, repo):
451 468 > assert repo._currentlock(repo._lockref) is None
452 469 > testing.wait_file(WALKED_FILE_2)
453 470 >
454 471 > extensions.wrapfunction(
455 472 > streamclone,
456 473 > '_test_sync_point_walk_1',
457 474 > _test_sync_point_walk_1
458 475 > )
459 476 > extensions.wrapfunction(
460 477 > streamclone,
461 478 > '_test_sync_point_walk_2',
462 479 > _test_sync_point_walk_2
463 480 > )
464 481 > EOF
465 482
466 483 prepare repo with small and big file to cover both code paths in emitrevlogdata
467 484
468 485 $ hg init repo
469 486 $ touch repo/f1
470 487 $ $TESTDIR/seq.py 50000 > repo/f2
471 488 $ hg -R repo ci -Aqm "0"
472 489 $ HG_TEST_STREAM_WALKED_FILE_1="$TESTTMP/sync_file_walked_1"
473 490 $ export HG_TEST_STREAM_WALKED_FILE_1
474 491 $ HG_TEST_STREAM_WALKED_FILE_2="$TESTTMP/sync_file_walked_2"
475 492 $ export HG_TEST_STREAM_WALKED_FILE_2
476 493 $ HG_TEST_STREAM_WALKED_FILE_3="$TESTTMP/sync_file_walked_3"
477 494 $ export HG_TEST_STREAM_WALKED_FILE_3
478 495 # $ cat << EOF >> $HGRCPATH
479 496 # > [hooks]
480 497 # > pre-clone=rm -f "$TESTTMP/sync_file_walked_*"
481 498 # > EOF
482 499 $ hg serve -R repo -p $HGPORT1 -d --error errors.log --pid-file=hg.pid --config extensions.stream_steps="$RUNTESTDIR/testlib/ext-stream-clone-steps.py"
483 500 $ cat hg.pid >> $DAEMON_PIDS
484 501
485 502 clone while modifying the repo between stating file with write lock and
486 503 actually serving file content
487 504
488 505 $ (hg clone -q --stream -U http://localhost:$HGPORT1 clone; touch "$HG_TEST_STREAM_WALKED_FILE_3") &
489 506 $ $RUNTESTDIR/testlib/wait-on-file 10 $HG_TEST_STREAM_WALKED_FILE_1
490 507 $ echo >> repo/f1
491 508 $ echo >> repo/f2
492 509 $ hg -R repo ci -m "1" --config ui.timeout.warn=-1
493 510 $ touch $HG_TEST_STREAM_WALKED_FILE_2
494 511 $ $RUNTESTDIR/testlib/wait-on-file 10 $HG_TEST_STREAM_WALKED_FILE_3
495 512 $ hg -R clone id
496 513 000000000000
497 514 $ cat errors.log
498 515 $ cd ..
499 516
500 517 Stream repository with bookmarks
501 518 --------------------------------
502 519
503 520 (revert introduction of secret changeset)
504 521
505 522 $ hg -R server phase --draft 'secret()'
506 523
507 524 add a bookmark
508 525
509 526 $ hg -R server bookmark -r tip some-bookmark
510 527
511 528 clone it
512 529
513 530 #if stream-legacy
514 531 $ hg clone --stream http://localhost:$HGPORT with-bookmarks
515 532 streaming all changes
516 533 1027 files to transfer, 96.3 KB of data (no-zstd !)
517 534 transferred 96.3 KB in * seconds (*) (glob) (no-zstd !)
518 535 1027 files to transfer, 93.5 KB of data (zstd !)
519 536 transferred 93.5 KB in * seconds (* */sec) (glob) (zstd !)
520 537 searching for changes
521 538 no changes found
522 539 updating to branch default
523 540 1025 files updated, 0 files merged, 0 files removed, 0 files unresolved
524 541 #endif
525 542 #if stream-bundle2
526 543 $ hg clone --stream http://localhost:$HGPORT with-bookmarks
527 544 streaming all changes
528 545 1033 files to transfer, 96.6 KB of data (no-zstd !)
529 546 transferred 96.6 KB in * seconds (* */sec) (glob) (no-zstd !)
530 547 1033 files to transfer, 93.8 KB of data (zstd !)
531 548 transferred 93.8 KB in * seconds (* */sec) (glob) (zstd !)
532 549 updating to branch default
533 550 1025 files updated, 0 files merged, 0 files removed, 0 files unresolved
534 551 #endif
535 552 $ hg -R with-bookmarks bookmarks
536 553 some-bookmark 1:c17445101a72
537 554
538 555 Stream repository with phases
539 556 -----------------------------
540 557
541 558 Clone as publishing
542 559
543 560 $ hg -R server phase -r 'all()'
544 561 0: draft
545 562 1: draft
546 563
547 564 #if stream-legacy
548 565 $ hg clone --stream http://localhost:$HGPORT phase-publish
549 566 streaming all changes
550 567 1027 files to transfer, 96.3 KB of data (no-zstd !)
551 568 transferred 96.3 KB in * seconds (*) (glob) (no-zstd !)
552 569 1027 files to transfer, 93.5 KB of data (zstd !)
553 570 transferred 93.5 KB in * seconds (* */sec) (glob) (zstd !)
554 571 searching for changes
555 572 no changes found
556 573 updating to branch default
557 574 1025 files updated, 0 files merged, 0 files removed, 0 files unresolved
558 575 #endif
559 576 #if stream-bundle2
560 577 $ hg clone --stream http://localhost:$HGPORT phase-publish
561 578 streaming all changes
562 579 1033 files to transfer, 96.6 KB of data (no-zstd !)
563 580 transferred 96.6 KB in * seconds (* */sec) (glob) (no-zstd !)
564 581 1033 files to transfer, 93.8 KB of data (zstd !)
565 582 transferred 93.8 KB in * seconds (* */sec) (glob) (zstd !)
566 583 updating to branch default
567 584 1025 files updated, 0 files merged, 0 files removed, 0 files unresolved
568 585 #endif
569 586 $ hg -R phase-publish phase -r 'all()'
570 587 0: public
571 588 1: public
572 589
573 590 Clone as non publishing
574 591
575 592 $ cat << EOF >> server/.hg/hgrc
576 593 > [phases]
577 594 > publish = False
578 595 > EOF
579 596 $ killdaemons.py
580 597 $ hg -R server serve -p $HGPORT -d --pid-file=hg.pid
581 598 $ cat hg.pid > $DAEMON_PIDS
582 599
583 600 #if stream-legacy
584 601
585 602 With v1 of the stream protocol, changeset are always cloned as public. It make
586 603 stream v1 unsuitable for non-publishing repository.
587 604
588 605 $ hg clone --stream http://localhost:$HGPORT phase-no-publish
589 606 streaming all changes
590 607 1027 files to transfer, 96.3 KB of data (no-zstd !)
591 608 transferred 96.3 KB in * seconds (* */sec) (glob) (no-zstd !)
592 609 1027 files to transfer, 93.5 KB of data (zstd !)
593 610 transferred 93.5 KB in * seconds (* */sec) (glob) (zstd !)
594 611 searching for changes
595 612 no changes found
596 613 updating to branch default
597 614 1025 files updated, 0 files merged, 0 files removed, 0 files unresolved
598 615 $ hg -R phase-no-publish phase -r 'all()'
599 616 0: public
600 617 1: public
601 618 #endif
602 619 #if stream-bundle2
603 620 $ hg clone --stream http://localhost:$HGPORT phase-no-publish
604 621 streaming all changes
605 622 1034 files to transfer, 96.7 KB of data (no-zstd !)
606 623 transferred 96.7 KB in * seconds (* */sec) (glob) (no-zstd !)
607 624 1034 files to transfer, 93.9 KB of data (zstd !)
608 625 transferred 93.9 KB in * seconds (* */sec) (glob) (zstd !)
609 626 updating to branch default
610 627 1025 files updated, 0 files merged, 0 files removed, 0 files unresolved
611 628 $ hg -R phase-no-publish phase -r 'all()'
612 629 0: draft
613 630 1: draft
614 631 #endif
615 632
616 633 $ killdaemons.py
617 634
618 635 #if stream-legacy
619 636
620 637 With v1 of the stream protocol, changeset are always cloned as public. There's
621 638 no obsolescence markers exchange in stream v1.
622 639
623 640 #endif
624 641 #if stream-bundle2
625 642
626 643 Stream repository with obsolescence
627 644 -----------------------------------
628 645
629 646 Clone non-publishing with obsolescence
630 647
631 648 $ cat >> $HGRCPATH << EOF
632 649 > [experimental]
633 650 > evolution=all
634 651 > EOF
635 652
636 653 $ cd server
637 654 $ echo foo > foo
638 655 $ hg -q commit -m 'about to be pruned'
639 656 $ hg debugobsolete `hg log -r . -T '{node}'` -d '0 0' -u test --record-parents
640 657 1 new obsolescence markers
641 658 obsoleted 1 changesets
642 659 $ hg up null -q
643 660 $ hg log -T '{rev}: {phase}\n'
644 661 1: draft
645 662 0: draft
646 663 $ hg serve -p $HGPORT -d --pid-file=hg.pid
647 664 $ cat hg.pid > $DAEMON_PIDS
648 665 $ cd ..
649 666
650 667 $ hg clone -U --stream http://localhost:$HGPORT with-obsolescence
651 668 streaming all changes
652 669 1035 files to transfer, 97.1 KB of data (no-zstd !)
653 670 transferred 97.1 KB in * seconds (* */sec) (glob) (no-zstd !)
654 671 1035 files to transfer, 94.3 KB of data (zstd !)
655 672 transferred 94.3 KB in * seconds (* */sec) (glob) (zstd !)
656 673 $ hg -R with-obsolescence log -T '{rev}: {phase}\n'
657 674 1: draft
658 675 0: draft
659 676 $ hg debugobsolete -R with-obsolescence
660 677 50382b884f66690b7045cac93a540cba4d4c906f 0 {c17445101a72edac06facd130d14808dfbd5c7c2} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
661 678
662 679 $ hg clone -U --stream --config experimental.evolution=0 http://localhost:$HGPORT with-obsolescence-no-evolution
663 680 streaming all changes
664 681 remote: abort: server has obsolescence markers, but client cannot receive them via stream clone
665 682 abort: pull failed on remote
666 683 [100]
667 684
668 685 $ killdaemons.py
669 686
670 687 #endif
General Comments 0
You need to be logged in to leave comments. Login now