##// END OF EJS Templates
auto-upgrade: add an option to silence the safe-mismatch message...
marmoute -
r50238:4f04bb0d default
parent child Browse files
Show More
@@ -2170,6 +2170,16 b' coreconfigitem('
2170 default=True,
2170 default=True,
2171 )
2171 )
2172 coreconfigitem(
2172 coreconfigitem(
2173 b'share',
2174 b'safe-mismatch.source-not-safe:verbose-upgrade',
2175 default=True,
2176 )
2177 coreconfigitem(
2178 b'share',
2179 b'safe-mismatch.source-safe:verbose-upgrade',
2180 default=True,
2181 )
2182 coreconfigitem(
2173 b'shelve',
2183 b'shelve',
2174 b'maxbackups',
2184 b'maxbackups',
2175 default=10,
2185 default=10,
@@ -2179,6 +2179,9 b' Alias definitions for revsets. See :hg:`'
2179 Check :hg:`help config.format.use-share-safe` for details about the
2179 Check :hg:`help config.format.use-share-safe` for details about the
2180 share-safe feature.
2180 share-safe feature.
2181
2181
2182 ``safe-mismatch.source-safe:verbose-upgrade``
2183 Display a message when upgrading, (default: True)
2184
2182 ``safe-mismatch.source-safe.warn``
2185 ``safe-mismatch.source-safe.warn``
2183 Shows a warning on operations if the shared repository does not use
2186 Shows a warning on operations if the shared repository does not use
2184 share-safe, but the source repository does.
2187 share-safe, but the source repository does.
@@ -2204,6 +2207,9 b' Alias definitions for revsets. See :hg:`'
2204 Check :hg:`help config.format.use-share-safe` for details about the
2207 Check :hg:`help config.format.use-share-safe` for details about the
2205 share-safe feature.
2208 share-safe feature.
2206
2209
2210 ``safe-mismatch.source-not-safe:verbose-upgrade``
2211 Display a message when upgrading, (default: True)
2212
2207 ``safe-mismatch.source-not-safe.warn``
2213 ``safe-mismatch.source-not-safe.warn``
2208 Shows a warning on operations if the shared repository uses share-safe,
2214 Shows a warning on operations if the shared repository uses share-safe,
2209 but the source repository does not.
2215 but the source repository does not.
@@ -628,6 +628,9 b' def makelocalrepository(baseui, path, in'
628 mismatch_config = ui.config(
628 mismatch_config = ui.config(
629 b'share', b'safe-mismatch.source-not-safe'
629 b'share', b'safe-mismatch.source-not-safe'
630 )
630 )
631 mismatch_verbose_upgrade = ui.configbool(
632 b'share', b'safe-mismatch.source-not-safe:verbose-upgrade'
633 )
631 if mismatch_config in (
634 if mismatch_config in (
632 b'downgrade-allow',
635 b'downgrade-allow',
633 b'allow',
636 b'allow',
@@ -643,6 +646,7 b' def makelocalrepository(baseui, path, in'
643 requirements,
646 requirements,
644 mismatch_config,
647 mismatch_config,
645 mismatch_warn,
648 mismatch_warn,
649 mismatch_verbose_upgrade,
646 )
650 )
647 elif mismatch_config == b'abort':
651 elif mismatch_config == b'abort':
648 raise error.Abort(
652 raise error.Abort(
@@ -668,6 +672,9 b' def makelocalrepository(baseui, path, in'
668 mismatch_warn = ui.configbool(
672 mismatch_warn = ui.configbool(
669 b'share', b'safe-mismatch.source-safe.warn'
673 b'share', b'safe-mismatch.source-safe.warn'
670 )
674 )
675 mismatch_verbose_upgrade = ui.configbool(
676 b'share', b'safe-mismatch.source-safe:verbose-upgrade'
677 )
671 if mismatch_config in (
678 if mismatch_config in (
672 b'upgrade-allow',
679 b'upgrade-allow',
673 b'allow',
680 b'allow',
@@ -683,6 +690,7 b' def makelocalrepository(baseui, path, in'
683 requirements,
690 requirements,
684 mismatch_config,
691 mismatch_config,
685 mismatch_warn,
692 mismatch_warn,
693 mismatch_verbose_upgrade,
686 )
694 )
687 elif mismatch_config == b'abort':
695 elif mismatch_config == b'abort':
688 raise error.Abort(
696 raise error.Abort(
@@ -305,6 +305,7 b' def upgrade_share_to_safe('
305 current_requirements,
305 current_requirements,
306 mismatch_config,
306 mismatch_config,
307 mismatch_warn,
307 mismatch_warn,
308 mismatch_verbose_upgrade,
308 ):
309 ):
309 """Upgrades a share to use share-safe mechanism"""
310 """Upgrades a share to use share-safe mechanism"""
310 wlock = None
311 wlock = None
@@ -337,6 +338,7 b' def upgrade_share_to_safe('
337 diffrequires.add(requirementsmod.SHARESAFE_REQUIREMENT)
338 diffrequires.add(requirementsmod.SHARESAFE_REQUIREMENT)
338 current_requirements.add(requirementsmod.SHARESAFE_REQUIREMENT)
339 current_requirements.add(requirementsmod.SHARESAFE_REQUIREMENT)
339 scmutil.writerequires(hgvfs, diffrequires)
340 scmutil.writerequires(hgvfs, diffrequires)
341 if mismatch_verbose_upgrade:
340 ui.warn(_(b'repository upgraded to use share-safe mode\n'))
342 ui.warn(_(b'repository upgraded to use share-safe mode\n'))
341 except error.LockError as e:
343 except error.LockError as e:
342 hint = _(
344 hint = _(
@@ -366,6 +368,7 b' def downgrade_share_to_non_safe('
366 current_requirements,
368 current_requirements,
367 mismatch_config,
369 mismatch_config,
368 mismatch_warn,
370 mismatch_warn,
371 mismatch_verbose_upgrade,
369 ):
372 ):
370 """Downgrades a share which use share-safe to not use it"""
373 """Downgrades a share which use share-safe to not use it"""
371 wlock = None
374 wlock = None
@@ -394,6 +397,7 b' def downgrade_share_to_non_safe('
394 current_requirements |= source_requirements
397 current_requirements |= source_requirements
395 current_requirements -= set(requirementsmod.SHARESAFE_REQUIREMENT)
398 current_requirements -= set(requirementsmod.SHARESAFE_REQUIREMENT)
396 scmutil.writerequires(hgvfs, current_requirements)
399 scmutil.writerequires(hgvfs, current_requirements)
400 if mismatch_verbose_upgrade:
397 ui.warn(_(b'repository downgraded to not use share-safe mode\n'))
401 ui.warn(_(b'repository downgraded to not use share-safe mode\n'))
398 except error.LockError as e:
402 except error.LockError as e:
399 hint = _(
403 hint = _(
@@ -521,12 +521,21 b' Testing automatic downgrade of shares wh'
521 [255]
521 [255]
522 $ rm ../ss-share/.hg/wlock
522 $ rm ../ss-share/.hg/wlock
523
523
524 $ cp -R ../ss-share ../ss-share-bck
524 $ hg log -GT "{node}: {desc}\n" -R ../ss-share --config share.safe-mismatch.source-not-safe=downgrade-abort
525 $ hg log -GT "{node}: {desc}\n" -R ../ss-share --config share.safe-mismatch.source-not-safe=downgrade-abort
525 repository downgraded to not use share-safe mode
526 repository downgraded to not use share-safe mode
526 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
527 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
527 |
528 |
528 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
529 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
529
530
531 $ rm -rf ../ss-share
532 $ mv ../ss-share-bck ../ss-share
533
534 $ hg log -GT "{node}: {desc}\n" -R ../ss-share --config share.safe-mismatch.source-not-safe=downgrade-abort --config share.safe-mismatch.source-not-safe:verbose-upgrade=no
535 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
536 |
537 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
538
530
539
531 $ hg log -GT "{node}: {desc}\n" -R ../ss-share
540 $ hg log -GT "{node}: {desc}\n" -R ../ss-share
532 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
541 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
@@ -588,12 +597,20 b' Check that if lock is taken, upgrade fai'
588 [255]
597 [255]
589
598
590 $ rm ../nss-share/.hg/wlock
599 $ rm ../nss-share/.hg/wlock
600 $ cp -R ../nss-share ../nss-share-bck
591 $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgrade-abort
601 $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgrade-abort
592 repository upgraded to use share-safe mode
602 repository upgraded to use share-safe mode
593 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
603 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
594 |
604 |
595 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
605 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
596
606
607 $ rm -rf ../nss-share
608 $ mv ../nss-share-bck ../nss-share
609 $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgrade-abort --config share.safe-mismatch.source-safe:verbose-upgrade=no
610 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar
611 |
612 o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo
613
597
614
598 Test that unshare works
615 Test that unshare works
599
616
General Comments 0
You need to be logged in to leave comments. Login now