Show More
@@ -1,346 +1,350 b'' | |||
|
1 | 1 | ================================== |
|
2 | 2 | Basic testing for the push command |
|
3 | 3 | ================================== |
|
4 | 4 | |
|
5 | 5 | Testing of the '--rev' flag |
|
6 | 6 | =========================== |
|
7 | 7 | |
|
8 | 8 | $ hg init test-revflag |
|
9 | 9 | $ hg -R test-revflag unbundle "$TESTDIR/bundles/remote.hg" |
|
10 | 10 | adding changesets |
|
11 | 11 | adding manifests |
|
12 | 12 | adding file changes |
|
13 | 13 | added 9 changesets with 7 changes to 4 files (+1 heads) |
|
14 | 14 | new changesets bfaf4b5cbf01:916f1afdef90 |
|
15 | 15 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
16 | 16 | |
|
17 | 17 | $ for i in 0 1 2 3 4 5 6 7 8; do |
|
18 | 18 | > echo |
|
19 | 19 | > hg init test-revflag-"$i" |
|
20 | 20 | > hg -R test-revflag push -r "$i" test-revflag-"$i" |
|
21 | 21 | > hg -R test-revflag-"$i" verify |
|
22 | 22 | > done |
|
23 | 23 | |
|
24 | 24 | pushing to test-revflag-0 |
|
25 | 25 | searching for changes |
|
26 | 26 | adding changesets |
|
27 | 27 | adding manifests |
|
28 | 28 | adding file changes |
|
29 | 29 | added 1 changesets with 1 changes to 1 files |
|
30 | 30 | checking changesets |
|
31 | 31 | checking manifests |
|
32 | 32 | crosschecking files in changesets and manifests |
|
33 | 33 | checking files |
|
34 | 34 | 1 files, 1 changesets, 1 total revisions |
|
35 | 35 | |
|
36 | 36 | pushing to test-revflag-1 |
|
37 | 37 | searching for changes |
|
38 | 38 | adding changesets |
|
39 | 39 | adding manifests |
|
40 | 40 | adding file changes |
|
41 | 41 | added 2 changesets with 2 changes to 1 files |
|
42 | 42 | checking changesets |
|
43 | 43 | checking manifests |
|
44 | 44 | crosschecking files in changesets and manifests |
|
45 | 45 | checking files |
|
46 | 46 | 1 files, 2 changesets, 2 total revisions |
|
47 | 47 | |
|
48 | 48 | pushing to test-revflag-2 |
|
49 | 49 | searching for changes |
|
50 | 50 | adding changesets |
|
51 | 51 | adding manifests |
|
52 | 52 | adding file changes |
|
53 | 53 | added 3 changesets with 3 changes to 1 files |
|
54 | 54 | checking changesets |
|
55 | 55 | checking manifests |
|
56 | 56 | crosschecking files in changesets and manifests |
|
57 | 57 | checking files |
|
58 | 58 | 1 files, 3 changesets, 3 total revisions |
|
59 | 59 | |
|
60 | 60 | pushing to test-revflag-3 |
|
61 | 61 | searching for changes |
|
62 | 62 | adding changesets |
|
63 | 63 | adding manifests |
|
64 | 64 | adding file changes |
|
65 | 65 | added 4 changesets with 4 changes to 1 files |
|
66 | 66 | checking changesets |
|
67 | 67 | checking manifests |
|
68 | 68 | crosschecking files in changesets and manifests |
|
69 | 69 | checking files |
|
70 | 70 | 1 files, 4 changesets, 4 total revisions |
|
71 | 71 | |
|
72 | 72 | pushing to test-revflag-4 |
|
73 | 73 | searching for changes |
|
74 | 74 | adding changesets |
|
75 | 75 | adding manifests |
|
76 | 76 | adding file changes |
|
77 | 77 | added 2 changesets with 2 changes to 1 files |
|
78 | 78 | checking changesets |
|
79 | 79 | checking manifests |
|
80 | 80 | crosschecking files in changesets and manifests |
|
81 | 81 | checking files |
|
82 | 82 | 1 files, 2 changesets, 2 total revisions |
|
83 | 83 | |
|
84 | 84 | pushing to test-revflag-5 |
|
85 | 85 | searching for changes |
|
86 | 86 | adding changesets |
|
87 | 87 | adding manifests |
|
88 | 88 | adding file changes |
|
89 | 89 | added 3 changesets with 3 changes to 1 files |
|
90 | 90 | checking changesets |
|
91 | 91 | checking manifests |
|
92 | 92 | crosschecking files in changesets and manifests |
|
93 | 93 | checking files |
|
94 | 94 | 1 files, 3 changesets, 3 total revisions |
|
95 | 95 | |
|
96 | 96 | pushing to test-revflag-6 |
|
97 | 97 | searching for changes |
|
98 | 98 | adding changesets |
|
99 | 99 | adding manifests |
|
100 | 100 | adding file changes |
|
101 | 101 | added 4 changesets with 5 changes to 2 files |
|
102 | 102 | checking changesets |
|
103 | 103 | checking manifests |
|
104 | 104 | crosschecking files in changesets and manifests |
|
105 | 105 | checking files |
|
106 | 106 | 2 files, 4 changesets, 5 total revisions |
|
107 | 107 | |
|
108 | 108 | pushing to test-revflag-7 |
|
109 | 109 | searching for changes |
|
110 | 110 | adding changesets |
|
111 | 111 | adding manifests |
|
112 | 112 | adding file changes |
|
113 | 113 | added 5 changesets with 6 changes to 3 files |
|
114 | 114 | checking changesets |
|
115 | 115 | checking manifests |
|
116 | 116 | crosschecking files in changesets and manifests |
|
117 | 117 | checking files |
|
118 | 118 | 3 files, 5 changesets, 6 total revisions |
|
119 | 119 | |
|
120 | 120 | pushing to test-revflag-8 |
|
121 | 121 | searching for changes |
|
122 | 122 | adding changesets |
|
123 | 123 | adding manifests |
|
124 | 124 | adding file changes |
|
125 | 125 | added 5 changesets with 5 changes to 2 files |
|
126 | 126 | checking changesets |
|
127 | 127 | checking manifests |
|
128 | 128 | crosschecking files in changesets and manifests |
|
129 | 129 | checking files |
|
130 | 130 | 2 files, 5 changesets, 5 total revisions |
|
131 | 131 | |
|
132 | 132 | $ cd test-revflag-8 |
|
133 | 133 | |
|
134 | 134 | $ hg pull ../test-revflag-7 |
|
135 | 135 | pulling from ../test-revflag-7 |
|
136 | 136 | searching for changes |
|
137 | 137 | adding changesets |
|
138 | 138 | adding manifests |
|
139 | 139 | adding file changes |
|
140 | 140 | added 4 changesets with 2 changes to 3 files (+1 heads) |
|
141 | 141 | new changesets c70afb1ee985:faa2e4234c7a |
|
142 | 142 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
143 | 143 | |
|
144 | 144 | $ hg verify |
|
145 | 145 | checking changesets |
|
146 | 146 | checking manifests |
|
147 | 147 | crosschecking files in changesets and manifests |
|
148 | 148 | checking files |
|
149 | 149 | 4 files, 9 changesets, 7 total revisions |
|
150 | 150 | |
|
151 | 151 | $ cd .. |
|
152 | 152 | |
|
153 | 153 | Test server side validation during push |
|
154 | 154 | ======================================= |
|
155 | 155 | |
|
156 | 156 | $ hg init test-validation |
|
157 | 157 | $ cd test-validation |
|
158 | 158 | |
|
159 | 159 | $ cat > .hg/hgrc <<EOF |
|
160 | 160 | > [server] |
|
161 | 161 | > validate=1 |
|
162 | 162 | > EOF |
|
163 | 163 | |
|
164 | 164 | $ echo alpha > alpha |
|
165 | 165 | $ echo beta > beta |
|
166 | 166 | $ hg addr |
|
167 | 167 | adding alpha |
|
168 | 168 | adding beta |
|
169 | 169 | $ hg ci -m 1 |
|
170 | 170 | |
|
171 | 171 | $ cd .. |
|
172 | 172 | $ hg clone test-validation test-validation-clone |
|
173 | 173 | updating to branch default |
|
174 | 174 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
175 | 175 | |
|
176 | #if reporevlogstore | |
|
177 | ||
|
176 | 178 | Test spurious filelog entries: |
|
177 | 179 | |
|
178 | 180 | $ cd test-validation-clone |
|
179 | 181 | $ echo blah >> beta |
|
180 | 182 | $ cp .hg/store/data/beta.i tmp1 |
|
181 | 183 | $ hg ci -m 2 |
|
182 | 184 | $ cp .hg/store/data/beta.i tmp2 |
|
183 | 185 | $ hg -q rollback |
|
184 | 186 | $ mv tmp2 .hg/store/data/beta.i |
|
185 | 187 | $ echo blah >> beta |
|
186 | 188 | $ hg ci -m '2 (corrupt)' |
|
187 | 189 | |
|
188 | 190 | Expected to fail: |
|
189 | 191 | |
|
190 | 192 | $ hg verify |
|
191 | 193 | checking changesets |
|
192 | 194 | checking manifests |
|
193 | 195 | crosschecking files in changesets and manifests |
|
194 | 196 | checking files |
|
195 | 197 | beta@1: dddc47b3ba30 not in manifests |
|
196 | 198 | 2 files, 2 changesets, 4 total revisions |
|
197 | 199 | 1 integrity errors encountered! |
|
198 | 200 | (first damaged changeset appears to be 1) |
|
199 | 201 | [1] |
|
200 | 202 | |
|
201 | 203 | $ hg push |
|
202 | 204 | pushing to $TESTTMP/test-validation |
|
203 | 205 | searching for changes |
|
204 | 206 | adding changesets |
|
205 | 207 | adding manifests |
|
206 | 208 | adding file changes |
|
207 | 209 | transaction abort! |
|
208 | 210 | rollback completed |
|
209 | 211 | abort: received spurious file revlog entry |
|
210 | 212 | [255] |
|
211 | 213 | |
|
212 | 214 | $ hg -q rollback |
|
213 | 215 | $ mv tmp1 .hg/store/data/beta.i |
|
214 | 216 | $ echo beta > beta |
|
215 | 217 | |
|
216 | 218 | Test missing filelog entries: |
|
217 | 219 | |
|
218 | 220 | $ cp .hg/store/data/beta.i tmp |
|
219 | 221 | $ echo blah >> beta |
|
220 | 222 | $ hg ci -m '2 (corrupt)' |
|
221 | 223 | $ mv tmp .hg/store/data/beta.i |
|
222 | 224 | |
|
223 | 225 | Expected to fail: |
|
224 | 226 | |
|
225 | 227 | $ hg verify |
|
226 | 228 | checking changesets |
|
227 | 229 | checking manifests |
|
228 | 230 | crosschecking files in changesets and manifests |
|
229 | 231 | checking files |
|
230 | 232 | beta@1: manifest refers to unknown revision dddc47b3ba30 |
|
231 | 233 | 2 files, 2 changesets, 2 total revisions |
|
232 | 234 | 1 integrity errors encountered! |
|
233 | 235 | (first damaged changeset appears to be 1) |
|
234 | 236 | [1] |
|
235 | 237 | |
|
236 | 238 | $ hg push |
|
237 | 239 | pushing to $TESTTMP/test-validation |
|
238 | 240 | searching for changes |
|
239 | 241 | adding changesets |
|
240 | 242 | adding manifests |
|
241 | 243 | adding file changes |
|
242 | 244 | transaction abort! |
|
243 | 245 | rollback completed |
|
244 | 246 | abort: missing file data for beta:dddc47b3ba30e54484720ce0f4f768a0f4b6efb9 - run hg verify |
|
245 | 247 | [255] |
|
246 | 248 | |
|
247 | 249 | $ cd .. |
|
248 | 250 | |
|
251 | #endif | |
|
252 | ||
|
249 | 253 | Test push hook locking |
|
250 | 254 | ===================== |
|
251 | 255 | |
|
252 | 256 | $ hg init 1 |
|
253 | 257 | |
|
254 | 258 | $ echo '[ui]' >> 1/.hg/hgrc |
|
255 | 259 | $ echo 'timeout = 10' >> 1/.hg/hgrc |
|
256 | 260 | |
|
257 | 261 | $ echo foo > 1/foo |
|
258 | 262 | $ hg --cwd 1 ci -A -m foo |
|
259 | 263 | adding foo |
|
260 | 264 | |
|
261 | 265 | $ hg clone 1 2 |
|
262 | 266 | updating to branch default |
|
263 | 267 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
264 | 268 | |
|
265 | 269 | $ hg clone 2 3 |
|
266 | 270 | updating to branch default |
|
267 | 271 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
268 | 272 | |
|
269 | 273 | $ cat <<EOF > $TESTTMP/debuglocks-pretxn-hook.sh |
|
270 | 274 | > hg debuglocks |
|
271 | 275 | > true |
|
272 | 276 | > EOF |
|
273 | 277 | $ echo '[hooks]' >> 2/.hg/hgrc |
|
274 | 278 | $ echo "pretxnchangegroup.a = sh $TESTTMP/debuglocks-pretxn-hook.sh" >> 2/.hg/hgrc |
|
275 | 279 | $ echo 'changegroup.push = hg push -qf ../1' >> 2/.hg/hgrc |
|
276 | 280 | |
|
277 | 281 | $ echo bar >> 3/foo |
|
278 | 282 | $ hg --cwd 3 ci -m bar |
|
279 | 283 | |
|
280 | 284 | $ hg --cwd 3 push ../2 --config devel.legacy.exchange=bundle1 |
|
281 | 285 | pushing to ../2 |
|
282 | 286 | searching for changes |
|
283 | 287 | adding changesets |
|
284 | 288 | adding manifests |
|
285 | 289 | adding file changes |
|
286 | 290 | added 1 changesets with 1 changes to 1 files |
|
287 | 291 | lock: user *, process * (*s) (glob) |
|
288 | 292 | wlock: free |
|
289 | 293 | |
|
290 | 294 | $ hg --cwd 1 --config extensions.strip= strip tip -q |
|
291 | 295 | $ hg --cwd 2 --config extensions.strip= strip tip -q |
|
292 | 296 | $ hg --cwd 3 push ../2 # bundle2+ |
|
293 | 297 | pushing to ../2 |
|
294 | 298 | searching for changes |
|
295 | 299 | adding changesets |
|
296 | 300 | adding manifests |
|
297 | 301 | adding file changes |
|
298 | 302 | added 1 changesets with 1 changes to 1 files |
|
299 | 303 | lock: user *, process * (*s) (glob) |
|
300 | 304 | wlock: user *, process * (*s) (glob) |
|
301 | 305 | |
|
302 | 306 | Test bare push with multiple race checking options |
|
303 | 307 | -------------------------------------------------- |
|
304 | 308 | |
|
305 | 309 | $ hg init test-bare-push-no-concurrency |
|
306 | 310 | $ hg init test-bare-push-unrelated-concurrency |
|
307 | 311 | $ hg -R test-revflag push -r 0 test-bare-push-no-concurrency --config server.concurrent-push-mode=strict |
|
308 | 312 | pushing to test-bare-push-no-concurrency |
|
309 | 313 | searching for changes |
|
310 | 314 | adding changesets |
|
311 | 315 | adding manifests |
|
312 | 316 | adding file changes |
|
313 | 317 | added 1 changesets with 1 changes to 1 files |
|
314 | 318 | $ hg -R test-revflag push -r 0 test-bare-push-unrelated-concurrency --config server.concurrent-push-mode=check-related |
|
315 | 319 | pushing to test-bare-push-unrelated-concurrency |
|
316 | 320 | searching for changes |
|
317 | 321 | adding changesets |
|
318 | 322 | adding manifests |
|
319 | 323 | adding file changes |
|
320 | 324 | added 1 changesets with 1 changes to 1 files |
|
321 | 325 | |
|
322 | 326 | SEC: check for unsafe ssh url |
|
323 | 327 | |
|
324 | 328 | $ cat >> $HGRCPATH << EOF |
|
325 | 329 | > [ui] |
|
326 | 330 | > ssh = sh -c "read l; read l; read l" |
|
327 | 331 | > EOF |
|
328 | 332 | |
|
329 | 333 | $ hg -R test-revflag push 'ssh://-oProxyCommand=touch${IFS}owned/path' |
|
330 | 334 | pushing to ssh://-oProxyCommand%3Dtouch%24%7BIFS%7Downed/path |
|
331 | 335 | abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path' |
|
332 | 336 | [255] |
|
333 | 337 | $ hg -R test-revflag push 'ssh://%2DoProxyCommand=touch${IFS}owned/path' |
|
334 | 338 | pushing to ssh://-oProxyCommand%3Dtouch%24%7BIFS%7Downed/path |
|
335 | 339 | abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path' |
|
336 | 340 | [255] |
|
337 | 341 | $ hg -R test-revflag push 'ssh://fakehost|touch${IFS}owned/path' |
|
338 | 342 | pushing to ssh://fakehost%7Ctouch%24%7BIFS%7Downed/path |
|
339 | 343 | abort: no suitable response from remote hg! |
|
340 | 344 | [255] |
|
341 | 345 | $ hg -R test-revflag push 'ssh://fakehost%7Ctouch%20owned/path' |
|
342 | 346 | pushing to ssh://fakehost%7Ctouch%20owned/path |
|
343 | 347 | abort: no suitable response from remote hg! |
|
344 | 348 | [255] |
|
345 | 349 | |
|
346 | 350 | $ [ ! -f owned ] || echo 'you got owned' |
General Comments 0
You need to be logged in to leave comments.
Login now