##// END OF EJS Templates
share-share: have the hint issue more consistently and point to the right doc...
marmoute -
r47077:4a58561a stable
parent child Browse files
Show More
@@ -568,6 +568,7 b' def makelocalrepository(baseui, path, in'
568 # repository was shared the old way. We check the share source .hg/requires
568 # repository was shared the old way. We check the share source .hg/requires
569 # for SHARESAFE_REQUIREMENT to detect whether the current repository needs
569 # for SHARESAFE_REQUIREMENT to detect whether the current repository needs
570 # to be reshared
570 # to be reshared
571 hint = _("see `hg help config.format.use-share-safe` for more information")
571 if requirementsmod.SHARESAFE_REQUIREMENT in requirements:
572 if requirementsmod.SHARESAFE_REQUIREMENT in requirements:
572
573
573 if (
574 if (
@@ -601,12 +602,10 b' def makelocalrepository(baseui, path, in'
601 raise error.Abort(
602 raise error.Abort(
602 _(
603 _(
603 b"share source does not support exp-sharesafe requirement"
604 b"share source does not support exp-sharesafe requirement"
604 )
605 ),
606 hint=hint,
605 )
607 )
606 else:
608 else:
607 hint = _(
608 "run `hg help config.share.safe-mismatch.source-not-safe`"
609 )
610 raise error.Abort(
609 raise error.Abort(
611 _(
610 _(
612 b"share-safe mismatch with source.\nUnrecognized"
611 b"share-safe mismatch with source.\nUnrecognized"
@@ -646,10 +645,10 b' def makelocalrepository(baseui, path, in'
646 _(
645 _(
647 b'version mismatch: source uses share-safe'
646 b'version mismatch: source uses share-safe'
648 b' functionality while the current share does not'
647 b' functionality while the current share does not'
649 )
648 ),
649 hint=hint,
650 )
650 )
651 else:
651 else:
652 hint = _("run `hg help config.share.safe-mismatch.source-safe`")
653 raise error.Abort(
652 raise error.Abort(
654 _(
653 _(
655 b"share-safe mismatch with source.\nUnrecognized"
654 b"share-safe mismatch with source.\nUnrecognized"
@@ -282,15 +282,20 b' def upgrade_share_to_safe('
282 scmutil.writerequires(hgvfs, diffrequires)
282 scmutil.writerequires(hgvfs, diffrequires)
283 ui.warn(_(b'repository upgraded to use share-safe mode\n'))
283 ui.warn(_(b'repository upgraded to use share-safe mode\n'))
284 except error.LockError as e:
284 except error.LockError as e:
285 hint = _(
286 "see `hg help config.format.use-share-safe` for more information"
287 )
285 if mismatch_config == b'upgrade-abort':
288 if mismatch_config == b'upgrade-abort':
286 raise error.Abort(
289 raise error.Abort(
287 _(b'failed to upgrade share, got error: %s')
290 _(b'failed to upgrade share, got error: %s')
288 % stringutil.forcebytestr(e.strerror)
291 % stringutil.forcebytestr(e.strerror),
292 hint=hint,
289 )
293 )
290 elif mismatch_warn:
294 elif mismatch_warn:
291 ui.warn(
295 ui.warn(
292 _(b'failed to upgrade share, got error: %s\n')
296 _(b'failed to upgrade share, got error: %s\n')
293 % stringutil.forcebytestr(e.strerror)
297 % stringutil.forcebytestr(e.strerror),
298 hint=hint,
294 )
299 )
295 finally:
300 finally:
296 if wlock:
301 if wlock:
@@ -334,17 +339,22 b' def downgrade_share_to_non_safe('
334 scmutil.writerequires(hgvfs, current_requirements)
339 scmutil.writerequires(hgvfs, current_requirements)
335 ui.warn(_(b'repository downgraded to not use share-safe mode\n'))
340 ui.warn(_(b'repository downgraded to not use share-safe mode\n'))
336 except error.LockError as e:
341 except error.LockError as e:
342 hint = _(
343 "see `hg help config.format.use-share-safe` for more information"
344 )
337 # If upgrade-abort is set, abort when upgrade fails, else let the
345 # If upgrade-abort is set, abort when upgrade fails, else let the
338 # process continue as `upgrade-allow` is set
346 # process continue as `upgrade-allow` is set
339 if mismatch_config == b'downgrade-abort':
347 if mismatch_config == b'downgrade-abort':
340 raise error.Abort(
348 raise error.Abort(
341 _(b'failed to downgrade share, got error: %s')
349 _(b'failed to downgrade share, got error: %s')
342 % stringutil.forcebytestr(e.strerror)
350 % stringutil.forcebytestr(e.strerror),
351 hint=hint,
343 )
352 )
344 elif mismatch_warn:
353 elif mismatch_warn:
345 ui.warn(
354 ui.warn(
346 _(b'failed to downgrade share, got error: %s\n')
355 _(b'failed to downgrade share, got error: %s\n')
347 % stringutil.forcebytestr(e.strerror)
356 % stringutil.forcebytestr(e.strerror),
357 hint=hint,
348 )
358 )
349 finally:
359 finally:
350 if wlock:
360 if wlock:
@@ -396,6 +396,7 b' Make sure existing shares dont work with'
396
396
397 $ hg log -GT "{node}: {desc}\n" -R ../nss-share
397 $ hg log -GT "{node}: {desc}\n" -R ../nss-share
398 abort: version mismatch: source uses share-safe functionality while the current share does not
398 abort: version mismatch: source uses share-safe functionality while the current share does not
399 (see `hg help config.format.use-share-safe` for more information)
399 [255]
400 [255]
400
401
401
402
@@ -481,6 +482,7 b' Make sure existing shares still works'
481
482
482 $ hg log -GT "{node}: {desc}\n" -R ../ss-share
483 $ hg log -GT "{node}: {desc}\n" -R ../ss-share
483 abort: share source does not support exp-sharesafe requirement
484 abort: share source does not support exp-sharesafe requirement
485 (see `hg help config.format.use-share-safe` for more information)
484 [255]
486 [255]
485
487
486 Testing automatic downgrade of shares when config is set
488 Testing automatic downgrade of shares when config is set
@@ -488,6 +490,7 b' Testing automatic downgrade of shares wh'
488 $ touch ../ss-share/.hg/wlock
490 $ touch ../ss-share/.hg/wlock
489 $ hg log -GT "{node}: {desc}\n" -R ../ss-share --config share.safe-mismatch.source-not-safe=downgrade-abort
491 $ hg log -GT "{node}: {desc}\n" -R ../ss-share --config share.safe-mismatch.source-not-safe=downgrade-abort
490 abort: failed to downgrade share, got error: Lock held
492 abort: failed to downgrade share, got error: Lock held
493 (see `hg help config.format.use-share-safe` for more information)
491 [255]
494 [255]
492 $ rm ../ss-share/.hg/wlock
495 $ rm ../ss-share/.hg/wlock
493
496
@@ -530,13 +533,14 b' Testing automatic upgrade of shares when'
530 store
533 store
531 $ hg log -GT "{node}: {desc}\n" -R ../nss-share
534 $ hg log -GT "{node}: {desc}\n" -R ../nss-share
532 abort: version mismatch: source uses share-safe functionality while the current share does not
535 abort: version mismatch: source uses share-safe functionality while the current share does not
536 (see `hg help config.format.use-share-safe` for more information)
533 [255]
537 [255]
534
538
535 Check that if lock is taken, upgrade fails but read operation are successful
539 Check that if lock is taken, upgrade fails but read operation are successful
536 $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgra
540 $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgra
537 abort: share-safe mismatch with source.
541 abort: share-safe mismatch with source.
538 Unrecognized value 'upgra' of `share.safe-mismatch.source-safe` set.
542 Unrecognized value 'upgra' of `share.safe-mismatch.source-safe` set.
539 (run `hg help config.share.safe-mismatch.source-safe`)
543 (see `hg help config.format.use-share-safe` for more information)
540 [255]
544 [255]
541 $ touch ../nss-share/.hg/wlock
545 $ touch ../nss-share/.hg/wlock
542 $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgrade-allow
546 $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgrade-allow
@@ -554,6 +558,7 b' Check that if lock is taken, upgrade fai'
554
558
555 $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgrade-abort
559 $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgrade-abort
556 abort: failed to upgrade share, got error: Lock held
560 abort: failed to upgrade share, got error: Lock held
561 (see `hg help config.format.use-share-safe` for more information)
557 [255]
562 [255]
558
563
559 $ rm ../nss-share/.hg/wlock
564 $ rm ../nss-share/.hg/wlock
General Comments 0
You need to be logged in to leave comments. Login now