Show More
@@ -558,6 +558,16 b' def makelocalrepository(baseui, path, in' | |||||
558 | # is present. We never write SHARESAFE_REQUIREMENT for a repo if store |
|
558 | # is present. We never write SHARESAFE_REQUIREMENT for a repo if store | |
559 | # is not present, refer checkrequirementscompat() for that |
|
559 | # is not present, refer checkrequirementscompat() for that | |
560 | if requirementsmod.SHARESAFE_REQUIREMENT in requirements: |
|
560 | if requirementsmod.SHARESAFE_REQUIREMENT in requirements: | |
|
561 | ||||
|
562 | if ( | |||
|
563 | shared | |||
|
564 | and requirementsmod.SHARESAFE_REQUIREMENT | |||
|
565 | not in _readrequires(sharedvfs, True) | |||
|
566 | ): | |||
|
567 | raise error.Abort( | |||
|
568 | _(b"share source does not support exp-sharesafe requirement") | |||
|
569 | ) | |||
|
570 | ||||
561 | if shared: |
|
571 | if shared: | |
562 | # This is a shared repo |
|
572 | # This is a shared repo | |
563 | storevfs = vfsmod.vfs(sharedvfs.join(b'store')) |
|
573 | storevfs = vfsmod.vfs(sharedvfs.join(b'store')) |
@@ -80,6 +80,7 b' def supportremovedrequirements(repo):' | |||||
80 | requirements.SIDEDATA_REQUIREMENT, |
|
80 | requirements.SIDEDATA_REQUIREMENT, | |
81 | requirements.COPIESSDC_REQUIREMENT, |
|
81 | requirements.COPIESSDC_REQUIREMENT, | |
82 | requirements.NODEMAP_REQUIREMENT, |
|
82 | requirements.NODEMAP_REQUIREMENT, | |
|
83 | requirements.SHARESAFE_REQUIREMENT, | |||
83 | } |
|
84 | } | |
84 | for name in compression.compengines: |
|
85 | for name in compression.compengines: | |
85 | engine = compression.compengines[name] |
|
86 | engine = compression.compengines[name] | |
@@ -1470,3 +1471,11 b' def upgraderepo(' | |||||
1470 | b' New shares will be created in safe mode.\n' |
|
1471 | b' New shares will be created in safe mode.\n' | |
1471 | ) |
|
1472 | ) | |
1472 | ) |
|
1473 | ) | |
|
1474 | if sharedsafe.name in removedreqs: | |||
|
1475 | ui.warn( | |||
|
1476 | _( | |||
|
1477 | b'repository downgraded to not use share safe mode, ' | |||
|
1478 | b'existing shares will not work and needs to' | |||
|
1479 | b' be reshared.\n' | |||
|
1480 | ) | |||
|
1481 | ) |
@@ -377,4 +377,79 b' Make sure existing shares still works' | |||||
377 | | |
|
377 | | | |
378 | o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo |
|
378 | o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo | |
379 |
|
379 | |||
|
380 | ||||
|
381 | ||||
|
382 | Create a safe share from upgrade one | |||
|
383 | ||||
|
384 | $ cd .. | |||
|
385 | $ hg share non-share-safe ss-share | |||
|
386 | updating working directory | |||
|
387 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
388 | $ cd ss-share | |||
|
389 | $ hg log -GT "{node}: {desc}\n" | |||
|
390 | @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar | |||
|
391 | | | |||
|
392 | o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo | |||
|
393 | ||||
|
394 | $ cd ../non-share-safe | |||
|
395 | ||||
|
396 | Test that downgrading works too | |||
|
397 | ||||
|
398 | $ cat >> $HGRCPATH <<EOF | |||
|
399 | > [extensions] | |||
|
400 | > share = | |||
|
401 | > [format] | |||
|
402 | > exp-share-safe = False | |||
|
403 | > EOF | |||
|
404 | ||||
|
405 | $ hg debugupgraderepo -q | |||
|
406 | requirements | |||
|
407 | preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store | |||
|
408 | removed: exp-sharesafe | |||
|
409 | ||||
|
410 | $ hg debugupgraderepo -q --run | |||
|
411 | upgrade will perform the following actions: | |||
|
412 | ||||
|
413 | requirements | |||
|
414 | preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store | |||
|
415 | removed: exp-sharesafe | |||
|
416 | ||||
|
417 | repository downgraded to not use share safe mode, existing shares will not work and needs to be reshared. | |||
|
418 | ||||
|
419 | $ hg debugrequirements | |||
|
420 | dotencode | |||
|
421 | fncache | |||
|
422 | generaldelta | |||
|
423 | revlogv1 | |||
|
424 | sparserevlog | |||
|
425 | store | |||
|
426 | ||||
|
427 | $ cat .hg/requires | |||
|
428 | dotencode | |||
|
429 | fncache | |||
|
430 | generaldelta | |||
|
431 | revlogv1 | |||
|
432 | sparserevlog | |||
|
433 | store | |||
|
434 | ||||
|
435 | $ test -f .hg/store/requires | |||
|
436 | [1] | |||
|
437 | ||||
|
438 | $ hg log -GT "{node}: {desc}\n" | |||
|
439 | @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar | |||
|
440 | | | |||
|
441 | o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo | |||
|
442 | ||||
|
443 | ||||
|
444 | Make sure existing shares still works | |||
|
445 | ||||
|
446 | $ hg log -GT "{node}: {desc}\n" -R ../nss-share | |||
|
447 | @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar | |||
|
448 | | | |||
|
449 | o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo | |||
|
450 | ||||
380 | $ hg unshare -R ../nss-share |
|
451 | $ hg unshare -R ../nss-share | |
|
452 | ||||
|
453 | $ hg log -GT "{node}: {desc}\n" -R ../ss-share | |||
|
454 | abort: share source does not support exp-sharesafe requirement | |||
|
455 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now