##// END OF EJS Templates
test: unquiet few tests to demonstrate changes in upcoming patches...
Pulkit Goyal -
r47095:8b02f132 default
parent child Browse files
Show More
@@ -1,574 +1,626
1 1 setup
2 2
3 3 $ cat >> $HGRCPATH <<EOF
4 4 > [extensions]
5 5 > share =
6 6 > [format]
7 7 > use-share-safe = True
8 8 > [storage]
9 9 > revlog.persistent-nodemap.slow-path=allow
10 10 > EOF
11 11
12 12 prepare source repo
13 13
14 14 $ hg init source
15 15 $ cd source
16 16 $ cat .hg/requires
17 17 share-safe
18 18 $ cat .hg/store/requires
19 19 dotencode
20 20 fncache
21 21 generaldelta
22 22 revlogv1
23 23 sparserevlog
24 24 store
25 25 $ hg debugrequirements
26 26 dotencode
27 27 fncache
28 28 generaldelta
29 29 revlogv1
30 30 share-safe
31 31 sparserevlog
32 32 store
33 33
34 34 $ echo a > a
35 35 $ hg ci -Aqm "added a"
36 36 $ echo b > b
37 37 $ hg ci -Aqm "added b"
38 38
39 39 $ HGEDITOR=cat hg config --shared
40 40 abort: repository is not shared; can't use --shared
41 41 [10]
42 42 $ cd ..
43 43
44 44 Create a shared repo and check the requirements are shared and read correctly
45 45 $ hg share source shared1
46 46 updating working directory
47 47 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
48 48 $ cd shared1
49 49 $ cat .hg/requires
50 50 share-safe
51 51 shared
52 52
53 53 $ hg debugrequirements -R ../source
54 54 dotencode
55 55 fncache
56 56 generaldelta
57 57 revlogv1
58 58 share-safe
59 59 sparserevlog
60 60 store
61 61
62 62 $ hg debugrequirements
63 63 dotencode
64 64 fncache
65 65 generaldelta
66 66 revlogv1
67 67 share-safe
68 68 shared
69 69 sparserevlog
70 70 store
71 71
72 72 $ echo c > c
73 73 $ hg ci -Aqm "added c"
74 74
75 75 Check that config of the source repository is also loaded
76 76
77 77 $ hg showconfig ui.curses
78 78 [1]
79 79
80 80 $ echo "[ui]" >> ../source/.hg/hgrc
81 81 $ echo "curses=true" >> ../source/.hg/hgrc
82 82
83 83 $ hg showconfig ui.curses
84 84 true
85 85
86 86 Test that extensions of source repository are also loaded
87 87
88 88 $ hg debugextensions
89 89 share
90 90 $ hg extdiff -p echo
91 91 hg: unknown command 'extdiff'
92 92 'extdiff' is provided by the following extension:
93 93
94 94 extdiff command to allow external programs to compare revisions
95 95
96 96 (use 'hg help extensions' for information on enabling extensions)
97 97 [10]
98 98
99 99 $ echo "[extensions]" >> ../source/.hg/hgrc
100 100 $ echo "extdiff=" >> ../source/.hg/hgrc
101 101
102 102 $ hg debugextensions -R ../source
103 103 extdiff
104 104 share
105 105 $ hg extdiff -R ../source -p echo
106 106
107 107 BROKEN: the command below will not work if config of shared source is not loaded
108 108 on dispatch but debugextensions says that extension
109 109 is loaded
110 110 $ hg debugextensions
111 111 extdiff
112 112 share
113 113
114 114 $ hg extdiff -p echo
115 115
116 116 However, local .hg/hgrc should override the config set by share source
117 117
118 118 $ echo "[ui]" >> .hg/hgrc
119 119 $ echo "curses=false" >> .hg/hgrc
120 120
121 121 $ hg showconfig ui.curses
122 122 false
123 123
124 124 $ HGEDITOR=cat hg config --shared
125 125 [ui]
126 126 curses=true
127 127 [extensions]
128 128 extdiff=
129 129
130 130 $ HGEDITOR=cat hg config --local
131 131 [ui]
132 132 curses=false
133 133
134 134 Testing that hooks set in source repository also runs in shared repo
135 135
136 136 $ cd ../source
137 137 $ cat <<EOF >> .hg/hgrc
138 138 > [extensions]
139 139 > hooklib=
140 140 > [hooks]
141 141 > pretxnchangegroup.reject_merge_commits = \
142 142 > python:hgext.hooklib.reject_merge_commits.hook
143 143 > EOF
144 144
145 145 $ cd ..
146 146 $ hg clone source cloned
147 147 updating to branch default
148 148 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
149 149 $ cd cloned
150 150 $ hg up 0
151 151 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
152 152 $ echo bar > bar
153 153 $ hg ci -Aqm "added bar"
154 154 $ hg merge
155 155 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
156 156 (branch merge, don't forget to commit)
157 157 $ hg ci -m "merge commit"
158 158
159 159 $ hg push ../source
160 160 pushing to ../source
161 161 searching for changes
162 162 adding changesets
163 163 adding manifests
164 164 adding file changes
165 165 error: pretxnchangegroup.reject_merge_commits hook failed: bcde3522682d rejected as merge on the same branch. Please consider rebase.
166 166 transaction abort!
167 167 rollback completed
168 168 abort: bcde3522682d rejected as merge on the same branch. Please consider rebase.
169 169 [255]
170 170
171 171 $ hg push ../shared1
172 172 pushing to ../shared1
173 173 searching for changes
174 174 adding changesets
175 175 adding manifests
176 176 adding file changes
177 177 error: pretxnchangegroup.reject_merge_commits hook failed: bcde3522682d rejected as merge on the same branch. Please consider rebase.
178 178 transaction abort!
179 179 rollback completed
180 180 abort: bcde3522682d rejected as merge on the same branch. Please consider rebase.
181 181 [255]
182 182
183 183 Test that if share source config is untrusted, we dont read it
184 184
185 185 $ cd ../shared1
186 186
187 187 $ cat << EOF > $TESTTMP/untrusted.py
188 188 > from mercurial import scmutil, util
189 189 > def uisetup(ui):
190 190 > class untrustedui(ui.__class__):
191 191 > def _trusted(self, fp, f):
192 192 > if util.normpath(fp.name).endswith(b'source/.hg/hgrc'):
193 193 > return False
194 194 > return super(untrustedui, self)._trusted(fp, f)
195 195 > ui.__class__ = untrustedui
196 196 > EOF
197 197
198 198 $ hg showconfig hooks
199 199 hooks.pretxnchangegroup.reject_merge_commits=python:hgext.hooklib.reject_merge_commits.hook
200 200
201 201 $ hg showconfig hooks --config extensions.untrusted=$TESTTMP/untrusted.py
202 202 [1]
203 203
204 204 Update the source repository format and check that shared repo works
205 205
206 206 $ cd ../source
207 207
208 208 Disable zstd related tests because its not present on pure version
209 209 #if zstd
210 210 $ echo "[format]" >> .hg/hgrc
211 211 $ echo "revlog-compression=zstd" >> .hg/hgrc
212 212
213 213 $ hg debugupgraderepo --run -q
214 214 upgrade will perform the following actions:
215 215
216 216 requirements
217 217 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store
218 218 added: revlog-compression-zstd
219 219
220 220 processed revlogs:
221 221 - all-filelogs
222 222 - changelog
223 223 - manifest
224 224
225 225 $ hg log -r .
226 226 changeset: 1:5f6d8a4bf34a
227 227 user: test
228 228 date: Thu Jan 01 00:00:00 1970 +0000
229 229 summary: added b
230 230
231 231 #endif
232 232 $ echo "[format]" >> .hg/hgrc
233 233 $ echo "use-persistent-nodemap=True" >> .hg/hgrc
234 234
235 235 $ hg debugupgraderepo --run -q -R ../shared1
236 236 abort: cannot upgrade repository; unsupported source requirement: shared
237 237 [255]
238 238
239 239 $ hg debugupgraderepo --run -q
240 240 upgrade will perform the following actions:
241 241
242 242 requirements
243 243 preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-zstd !)
244 244 preserved: dotencode, fncache, generaldelta, revlog-compression-zstd, revlogv1, share-safe, sparserevlog, store (zstd !)
245 245 added: persistent-nodemap
246 246
247 247 processed revlogs:
248 248 - all-filelogs
249 249 - changelog
250 250 - manifest
251 251
252 252 $ hg log -r .
253 253 changeset: 1:5f6d8a4bf34a
254 254 user: test
255 255 date: Thu Jan 01 00:00:00 1970 +0000
256 256 summary: added b
257 257
258 258
259 259 Shared one should work
260 260 $ cd ../shared1
261 261 $ hg log -r .
262 262 changeset: 2:155349b645be
263 263 tag: tip
264 264 user: test
265 265 date: Thu Jan 01 00:00:00 1970 +0000
266 266 summary: added c
267 267
268 268
269 269 Testing that nonsharedrc is loaded for source and not shared
270 270
271 271 $ cd ../source
272 272 $ touch .hg/hgrc-not-shared
273 273 $ echo "[ui]" >> .hg/hgrc-not-shared
274 274 $ echo "traceback=true" >> .hg/hgrc-not-shared
275 275
276 276 $ hg showconfig ui.traceback
277 277 true
278 278
279 279 $ HGEDITOR=cat hg config --non-shared
280 280 [ui]
281 281 traceback=true
282 282
283 283 $ cd ../shared1
284 284 $ hg showconfig ui.traceback
285 285 [1]
286 286
287 287 Unsharing works
288 288
289 289 $ hg unshare
290 290
291 291 Test that source config is added to the shared one after unshare, and the config
292 292 of current repo is still respected over the config which came from source config
293 293 $ cd ../cloned
294 294 $ hg push ../shared1
295 295 pushing to ../shared1
296 296 searching for changes
297 297 adding changesets
298 298 adding manifests
299 299 adding file changes
300 300 error: pretxnchangegroup.reject_merge_commits hook failed: bcde3522682d rejected as merge on the same branch. Please consider rebase.
301 301 transaction abort!
302 302 rollback completed
303 303 abort: bcde3522682d rejected as merge on the same branch. Please consider rebase.
304 304 [255]
305 305 $ hg showconfig ui.curses -R ../shared1
306 306 false
307 307
308 308 $ cd ../
309 309
310 310 Test that upgrading using debugupgraderepo works
311 311 =================================================
312 312
313 313 $ hg init non-share-safe --config format.use-share-safe=false
314 314 $ cd non-share-safe
315 315 $ hg debugrequirements
316 316 dotencode
317 317 fncache
318 318 generaldelta
319 319 revlogv1
320 320 sparserevlog
321 321 store
322 322 $ echo foo > foo
323 323 $ hg ci -Aqm 'added foo'
324 324 $ echo bar > bar
325 325 $ hg ci -Aqm 'added bar'
326 326
327 327 Create a share before upgrading
328 328
329 329 $ cd ..
330 330 $ hg share non-share-safe nss-share
331 331 updating working directory
332 332 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
333 333 $ hg debugrequirements -R nss-share
334 334 dotencode
335 335 fncache
336 336 generaldelta
337 337 revlogv1
338 338 shared
339 339 sparserevlog
340 340 store
341 341 $ cd non-share-safe
342 342
343 343 Upgrade
344 344
345 345 $ hg debugupgraderepo -q
346 346 requirements
347 347 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
348 348 added: share-safe
349 349
350 350 processed revlogs:
351 351 - all-filelogs
352 352 - changelog
353 353 - manifest
354 354
355 $ hg debugupgraderepo --run -q
355 $ hg debugupgraderepo --run
356 356 upgrade will perform the following actions:
357 357
358 358 requirements
359 359 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
360 360 added: share-safe
361 361
362 share-safe
363 Upgrades a repository to share-safe format so that future shares of this repository share its requirements and configs.
364
362 365 processed revlogs:
363 366 - all-filelogs
364 367 - changelog
365 368 - manifest
366 369
370 beginning upgrade...
371 repository locked and read-only
372 creating temporary repository to stage upgraded data: $TESTTMP/non-share-safe/.hg/upgrade.* (glob)
373 (it is safe to interrupt this process any time before data migration completes)
374 migrating 6 total revisions (2 in filelogs, 2 in manifests, 2 in changelog)
375 migrating 626 bytes in store; 271 bytes tracked data
376 migrating 2 filelogs containing 2 revisions (138 bytes in store; 8 bytes tracked data)
377 finished migrating 2 filelog revisions across 2 filelogs; change in size: 0 bytes
378 migrating 1 manifests containing 2 revisions (230 bytes in store; 135 bytes tracked data)
379 finished migrating 2 manifest revisions across 1 manifests; change in size: 0 bytes
380 migrating changelog containing 2 revisions (258 bytes in store; 128 bytes tracked data)
381 finished migrating 2 changelog revisions; change in size: 0 bytes
382 finished migrating 6 total revisions; total change in store size: 0 bytes
383 copying phaseroots
384 data fully upgraded in a temporary repository
385 marking source repository as being upgraded; clients will be unable to read from repository
386 starting in-place swap of repository data
387 replaced files will be backed up at $TESTTMP/non-share-safe/.hg/upgradebackup.* (glob)
388 replacing store...
389 store replacement complete; repository was inconsistent for *s (glob)
390 finalizing requirements file and making repository readable again
391 removing temporary repository $TESTTMP/non-share-safe/.hg/upgrade.* (glob)
392 copy of old repository backed up at $TESTTMP/non-share-safe/.hg/upgradebackup.* (glob)
393 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
367 394 repository upgraded to share safe mode, existing shares will still work in old non-safe mode. Re-share existing shares to use them in safe mode New shares will be created in safe mode.
368 395
369 396 $ hg debugrequirements
370 397 dotencode
371 398 fncache
372 399 generaldelta
373 400 revlogv1
374 401 share-safe
375 402 sparserevlog
376 403 store
377 404
378 405 $ cat .hg/requires
379 406 share-safe
380 407
381 408 $ cat .hg/store/requires
382 409 dotencode
383 410 fncache
384 411 generaldelta
385 412 revlogv1
386 413 sparserevlog
387 414 store
388 415
389 416 $ hg log -GT "{node}: {desc}\n"
390 417 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
391 418 |
392 419 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
393 420
394 421
395 422 Make sure existing shares dont work with default config
396 423
397 424 $ hg log -GT "{node}: {desc}\n" -R ../nss-share
398 425 abort: version mismatch: source uses share-safe functionality while the current share does not
399 426 [255]
400 427
401 428
402 429 Create a safe share from upgrade one
403 430
404 431 $ cd ..
405 432 $ hg share non-share-safe ss-share
406 433 updating working directory
407 434 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
408 435 $ cd ss-share
409 436 $ hg log -GT "{node}: {desc}\n"
410 437 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
411 438 |
412 439 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
413 440
414 441 $ cd ../non-share-safe
415 442
416 443 Test that downgrading works too
417 444
418 445 $ cat >> $HGRCPATH <<EOF
419 446 > [extensions]
420 447 > share =
421 448 > [format]
422 449 > use-share-safe = False
423 450 > EOF
424 451
425 452 $ hg debugupgraderepo -q
426 453 requirements
427 454 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
428 455 removed: share-safe
429 456
430 457 processed revlogs:
431 458 - all-filelogs
432 459 - changelog
433 460 - manifest
434 461
435 $ hg debugupgraderepo -q --run
462 $ hg debugupgraderepo --run
436 463 upgrade will perform the following actions:
437 464
438 465 requirements
439 466 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
440 467 removed: share-safe
441 468
442 469 processed revlogs:
443 470 - all-filelogs
444 471 - changelog
445 472 - manifest
446 473
474 beginning upgrade...
475 repository locked and read-only
476 creating temporary repository to stage upgraded data: $TESTTMP/non-share-safe/.hg/upgrade.* (glob)
477 (it is safe to interrupt this process any time before data migration completes)
478 migrating 6 total revisions (2 in filelogs, 2 in manifests, 2 in changelog)
479 migrating 626 bytes in store; 271 bytes tracked data
480 migrating 2 filelogs containing 2 revisions (138 bytes in store; 8 bytes tracked data)
481 finished migrating 2 filelog revisions across 2 filelogs; change in size: 0 bytes
482 migrating 1 manifests containing 2 revisions (230 bytes in store; 135 bytes tracked data)
483 finished migrating 2 manifest revisions across 1 manifests; change in size: 0 bytes
484 migrating changelog containing 2 revisions (258 bytes in store; 128 bytes tracked data)
485 finished migrating 2 changelog revisions; change in size: 0 bytes
486 finished migrating 6 total revisions; total change in store size: 0 bytes
487 copying phaseroots
488 copying requires
489 data fully upgraded in a temporary repository
490 marking source repository as being upgraded; clients will be unable to read from repository
491 starting in-place swap of repository data
492 replaced files will be backed up at $TESTTMP/non-share-safe/.hg/upgradebackup.* (glob)
493 replacing store...
494 store replacement complete; repository was inconsistent for *s (glob)
495 finalizing requirements file and making repository readable again
496 removing temporary repository $TESTTMP/non-share-safe/.hg/upgrade.* (glob)
497 copy of old repository backed up at $TESTTMP/non-share-safe/.hg/upgradebackup.* (glob)
498 the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified
447 499 repository downgraded to not use share safe mode, existing shares will not work and needs to be reshared.
448 500
449 501 $ hg debugrequirements
450 502 dotencode
451 503 fncache
452 504 generaldelta
453 505 revlogv1
454 506 sparserevlog
455 507 store
456 508
457 509 $ cat .hg/requires
458 510 dotencode
459 511 fncache
460 512 generaldelta
461 513 revlogv1
462 514 sparserevlog
463 515 store
464 516
465 517 $ test -f .hg/store/requires
466 518 [1]
467 519
468 520 $ hg log -GT "{node}: {desc}\n"
469 521 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
470 522 |
471 523 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
472 524
473 525
474 526 Make sure existing shares still works
475 527
476 528 $ hg log -GT "{node}: {desc}\n" -R ../nss-share
477 529 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
478 530 |
479 531 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
480 532
481 533
482 534 $ hg log -GT "{node}: {desc}\n" -R ../ss-share
483 535 abort: share source does not support exp-sharesafe requirement
484 536 [255]
485 537
486 538 Testing automatic downgrade of shares when config is set
487 539
488 540 $ touch ../ss-share/.hg/wlock
489 541 $ hg log -GT "{node}: {desc}\n" -R ../ss-share --config share.safe-mismatch.source-not-safe=downgrade-abort
490 542 abort: failed to downgrade share, got error: Lock held
491 543 [255]
492 544 $ rm ../ss-share/.hg/wlock
493 545
494 546 $ hg log -GT "{node}: {desc}\n" -R ../ss-share --config share.safe-mismatch.source-not-safe=downgrade-abort
495 547 repository downgraded to not use share-safe mode
496 548 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
497 549 |
498 550 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
499 551
500 552
501 553 $ hg log -GT "{node}: {desc}\n" -R ../ss-share
502 554 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
503 555 |
504 556 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
505 557
506 558
507 559
508 560 Testing automatic upgrade of shares when config is set
509 561
510 562 $ hg debugupgraderepo -q --run --config format.use-share-safe=True
511 563 upgrade will perform the following actions:
512 564
513 565 requirements
514 566 preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
515 567 added: share-safe
516 568
517 569 processed revlogs:
518 570 - all-filelogs
519 571 - changelog
520 572 - manifest
521 573
522 574 repository upgraded to share safe mode, existing shares will still work in old non-safe mode. Re-share existing shares to use them in safe mode New shares will be created in safe mode.
523 575 $ hg debugrequirements
524 576 dotencode
525 577 fncache
526 578 generaldelta
527 579 revlogv1
528 580 share-safe
529 581 sparserevlog
530 582 store
531 583 $ hg log -GT "{node}: {desc}\n" -R ../nss-share
532 584 abort: version mismatch: source uses share-safe functionality while the current share does not
533 585 [255]
534 586
535 587 Check that if lock is taken, upgrade fails but read operation are successful
536 588 $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgra
537 589 abort: share-safe mismatch with source.
538 590 Unrecognized value 'upgra' of `share.safe-mismatch.source-safe` set.
539 591 (run `hg help config.share.safe-mismatch.source-safe`)
540 592 [255]
541 593 $ touch ../nss-share/.hg/wlock
542 594 $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgrade-allow
543 595 failed to upgrade share, got error: Lock held
544 596 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
545 597 |
546 598 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
547 599
548 600
549 601 $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgrade-allow --config share.safe-mismatch.source-safe.warn=False
550 602 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
551 603 |
552 604 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
553 605
554 606
555 607 $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgrade-abort
556 608 abort: failed to upgrade share, got error: Lock held
557 609 [255]
558 610
559 611 $ rm ../nss-share/.hg/wlock
560 612 $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgrade-abort
561 613 repository upgraded to use share-safe mode
562 614 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
563 615 |
564 616 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
565 617
566 618
567 619 Test that unshare works
568 620
569 621 $ hg unshare -R ../nss-share
570 622 $ hg log -GT "{node}: {desc}\n" -R ../nss-share
571 623 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
572 624 |
573 625 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
574 626
General Comments 0
You need to be logged in to leave comments. Login now