diff --git a/mercurial/configitems.py b/mercurial/configitems.py index 723d241543b0f5bec37cb00a36130958ab349992_bWVyY3VyaWFsL2NvbmZpZ2l0ZW1zLnB5..858fd8aa6f6a780965275568b6d267dc8c62e302_bWVyY3VyaWFsL2NvbmZpZ2l0ZW1zLnB5 100644 --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -1098,26 +1098,6 @@ ) coreconfigitem( b'experimental', - b'sharesafe-auto-downgrade-shares', - default=False, -) -coreconfigitem( - b'experimental', - b'sharesafe-auto-upgrade-shares', - default=False, -) -coreconfigitem( - b'experimental', - b'sharesafe-auto-upgrade-fail-error', - default=False, -) -coreconfigitem( - b'experimental', - b'sharesafe-warn-outdated-shares', - default=True, -) -coreconfigitem( - b'experimental', b'single-head-per-branch', default=False, ) @@ -1292,5 +1272,5 @@ ) coreconfigitem( b'format', - b'exp-share-safe', + b'use-share-safe', default=False, @@ -1296,5 +1276,4 @@ default=False, - experimental=True, ) coreconfigitem( b'format', @@ -1926,6 +1905,26 @@ default=b'identity', ) coreconfigitem( + b'share', + b'safe-mismatch.source-not-safe', + default=b'abort', +) +coreconfigitem( + b'share', + b'safe-mismatch.source-safe', + default=b'abort', +) +coreconfigitem( + b'share', + b'safe-mismatch.source-not-safe.warn', + default=True, +) +coreconfigitem( + b'share', + b'safe-mismatch.source-safe.warn', + default=True, +) +coreconfigitem( b'shelve', b'maxbackups', default=10, diff --git a/mercurial/helptext/config.txt b/mercurial/helptext/config.txt index 723d241543b0f5bec37cb00a36130958ab349992_bWVyY3VyaWFsL2hlbHB0ZXh0L2NvbmZpZy50eHQ=..858fd8aa6f6a780965275568b6d267dc8c62e302_bWVyY3VyaWFsL2hlbHB0ZXh0L2NvbmZpZy50eHQ= 100644 --- a/mercurial/helptext/config.txt +++ b/mercurial/helptext/config.txt @@ -914,6 +914,12 @@ Disabled by default. +``use-share-safe`` + Enable or disable the "share-safe" functionality which enables shares + to read requirements and configuration of it's source repository. + + Disabled by default. + ``usestore`` Enable or disable the "store" repository format which improves compatibility with systems that fold case or otherwise mangle @@ -1932,6 +1938,49 @@ Currently, only the rebase and absorb commands consider this configuration. (EXPERIMENTAL) +``share`` +--------- + +``safe-mismatch.source-safe`` + + Controls what happens when the shared repository does not uses share-safe + mechanism but it source repository does. + + Possible values are `abort` (default), `allow`, `upgrade-abort` and + `upgrade-abort`. + `abort`: Disallows running any command and aborts + `allow`: Respects the feature presence in share source + `upgrade-abort`: tries to upgrade the share to use sharesafe + if it fails aborts + `upgrade-allow`: tries to upgrade the share, if it fails continue by + respecting the share source setting + +``safe-mismatch.source-not-safe`` + + Controls what happens when the shared repository uses share-safe mechanism + however it source does not. + + Possible values are `abort` (default), `allow`, `downgrade-abort` and + `downgrade-abort`. + `abort`: Disallows running any command and aborts + `allow`: Respects the feature presence in share source + `downgrade-abort`: tries to downgrade the share to not use share-safe + if it fails aborts + `downgrade-allow`: tries to downgrade the share to not use share safe + if it fails continue by respecting the shared + source setting + + +``safe-mismatch.source-safe.warn`` + Shows warning on operations if share repository does not use share safe + but source repository does. + (default: True) + +``safe-mismatch.source-not-safe.warn`` + Shows warning on operations if share repository uses share safe + but source repository does not. + (default: True) + ``storage`` ----------- diff --git a/mercurial/helptext/internals/requirements.txt b/mercurial/helptext/internals/requirements.txt index 723d241543b0f5bec37cb00a36130958ab349992_bWVyY3VyaWFsL2hlbHB0ZXh0L2ludGVybmFscy9yZXF1aXJlbWVudHMudHh0..858fd8aa6f6a780965275568b6d267dc8c62e302_bWVyY3VyaWFsL2hlbHB0ZXh0L2ludGVybmFscy9yZXF1aXJlbWVudHMudHh0 100644 --- a/mercurial/helptext/internals/requirements.txt +++ b/mercurial/helptext/internals/requirements.txt @@ -159,10 +159,6 @@ exp-sharesafe ============= -NOTE: This requirement is for internal development only. The semantics are not -frozed yet, the feature is experimental. It's not advised to use it for any -production repository yet. - Represents that the repository can be shared safely. Requirements and config of the source repository will be shared. Requirements are stored in ``.hg/store`` instead of directly in ``.hg/`` where @@ -172,5 +168,5 @@ Support for this requirement was added in Mercurial 5.7 (released February 2021). The requirement will only be present on repositories that have -opted in to this format (by having ``format.exp-share-safe=true`` set when +opted in to this format (by having ``format.use-share-safe=true`` set when they were created). diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py index 723d241543b0f5bec37cb00a36130958ab349992_bWVyY3VyaWFsL2xvY2FscmVwby5weQ==..858fd8aa6f6a780965275568b6d267dc8c62e302_bWVyY3VyaWFsL2xvY2FscmVwby5weQ== 100644 --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -575,8 +575,16 @@ and requirementsmod.SHARESAFE_REQUIREMENT not in _readrequires(sharedvfs, True) ): - if ui.configbool( - b'experimental', b'sharesafe-auto-downgrade-shares' + mismatch_warn = ui.configbool( + b'share', b'safe-mismatch.source-not-safe.warn' + ) + mismatch_config = ui.config( + b'share', b'safe-mismatch.source-not-safe' + ) + if mismatch_config in ( + b'downgrade-allow', + b'allow', + b'downgrade-abort', ): # prevent cyclic import localrepo -> upgrade -> localrepo from . import upgrade @@ -586,4 +594,6 @@ hgvfs, sharedvfs, requirements, + mismatch_config, + mismatch_warn, ) @@ -589,7 +599,7 @@ ) - else: + elif mismatch_config == b'abort': raise error.Abort( _( b"share source does not support exp-sharesafe requirement" ) ) @@ -591,10 +601,23 @@ raise error.Abort( _( b"share source does not support exp-sharesafe requirement" ) ) + else: + hint = _( + "run `hg help config.share.safe-mismatch.source-not-safe`" + ) + raise error.Abort( + _( + b"share-safe mismatch with source.\nUnrecognized" + b" value '%s 'of `share.safe-mismatch.source-not-safe`" + b" set." + ) + % mismatch_config, + hint=hint, + ) else: requirements |= _readrequires(storevfs, False) elif shared: sourcerequires = _readrequires(sharedvfs, False) if requirementsmod.SHARESAFE_REQUIREMENT in sourcerequires: @@ -596,9 +619,17 @@ else: requirements |= _readrequires(storevfs, False) elif shared: sourcerequires = _readrequires(sharedvfs, False) if requirementsmod.SHARESAFE_REQUIREMENT in sourcerequires: - if ui.configbool(b'experimental', b'sharesafe-auto-upgrade-shares'): + mismatch_config = ui.config(b'share', b'safe-mismatch.source-safe') + mismatch_warn = ui.configbool( + b'share', b'safe-mismatch.source-safe.warn' + ) + if mismatch_config in ( + b'upgrade-allow', + b'allow', + b'upgrade-abort', + ): # prevent cyclic import localrepo -> upgrade -> localrepo from . import upgrade @@ -607,4 +638,6 @@ hgvfs, storevfs, requirements, + mismatch_config, + mismatch_warn, ) @@ -610,6 +643,4 @@ ) - elif ui.configbool( - b'experimental', b'sharesafe-warn-outdated-shares' - ): - ui.warn( + elif mismatch_config == b'abort': + raise error.Abort( _( @@ -615,5 +646,5 @@ _( - b'warning: source repository supports share-safe functionality.' - b' Reshare to upgrade.\n' + b'version mismatch: source uses share-safe' + b' functionality while current share does not' ) ) @@ -618,5 +649,15 @@ ) ) + else: + hint = _("run `hg help config.share.safe-mismatch.source-safe`") + raise error.Abort( + _( + b"share-safe mismatch with source.\nUnrecognized" + b" value '%s' of `share.safe-mismatch.source-safe` set." + ) + % mismatch_config, + hint=hint, + ) # The .hg/hgrc file may load extensions or contain config options # that influence repository construction. Attempt to load it and @@ -3433,7 +3474,7 @@ # if share-safe is enabled, let's create the new repository with the new # requirement - if ui.configbool(b'format', b'exp-share-safe'): + if ui.configbool(b'format', b'use-share-safe'): requirements.add(requirementsmod.SHARESAFE_REQUIREMENT) return requirements @@ -3472,7 +3513,7 @@ if requirementsmod.SHARESAFE_REQUIREMENT in requirements: ui.warn( _( - b"ignoring enabled 'format.exp-share-safe' config because " + b"ignoring enabled 'format.use-share-safe' config because " b"it is incompatible with disabled 'format.usestore'" b" config\n" ) diff --git a/mercurial/requirements.py b/mercurial/requirements.py index 723d241543b0f5bec37cb00a36130958ab349992_bWVyY3VyaWFsL3JlcXVpcmVtZW50cy5weQ==..858fd8aa6f6a780965275568b6d267dc8c62e302_bWVyY3VyaWFsL3JlcXVpcmVtZW50cy5weQ== 100644 --- a/mercurial/requirements.py +++ b/mercurial/requirements.py @@ -55,7 +55,7 @@ # A repository with share implemented safely. The repository has different # store and working copy requirements i.e. both `.hg/requires` and # `.hg/store/requires` are present. -SHARESAFE_REQUIREMENT = b'exp-sharesafe' +SHARESAFE_REQUIREMENT = b'share-safe' # List of requirements which are working directory specific # These requirements cannot be shared between repositories if they diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py index 723d241543b0f5bec37cb00a36130958ab349992_bWVyY3VyaWFsL3VwZ3JhZGUucHk=..858fd8aa6f6a780965275568b6d267dc8c62e302_bWVyY3VyaWFsL3VwZ3JhZGUucHk= 100644 --- a/mercurial/upgrade.py +++ b/mercurial/upgrade.py @@ -241,6 +241,13 @@ upgrade_op.print_post_op_messages() -def upgrade_share_to_safe(ui, hgvfs, storevfs, current_requirements): +def upgrade_share_to_safe( + ui, + hgvfs, + storevfs, + current_requirements, + mismatch_config, + mismatch_warn, +): """Upgrades a share to use share-safe mechanism""" wlock = None @@ -245,4 +252,17 @@ """Upgrades a share to use share-safe mechanism""" wlock = None + store_requirements = localrepo._readrequires(storevfs, False) + original_crequirements = current_requirements.copy() + # after upgrade, store requires will be shared, so lets find + # the requirements which are not present in store and + # write them to share's .hg/requires + diffrequires = current_requirements - store_requirements + # add share-safe requirement as it will mark the share as share-safe + diffrequires.add(requirementsmod.SHARESAFE_REQUIREMENT) + current_requirements.add(requirementsmod.SHARESAFE_REQUIREMENT) + # in `allow` case, we don't try to upgrade, we just respect the source + # state, update requirements and continue + if mismatch_config == b'allow': + return try: wlock = lockmod.trylock(ui, hgvfs, b'wlock', 0, 0) @@ -247,10 +267,16 @@ try: wlock = lockmod.trylock(ui, hgvfs, b'wlock', 0, 0) - store_requirements = localrepo._readrequires(storevfs, False) - # after upgrade, store requires will be shared, so lets find - # the requirements which are not present in store and - # write them to share's .hg/requires - diffrequires = current_requirements - store_requirements - # add share-safe requirement as it will mark the share as share-safe - diffrequires.add(requirementsmod.SHARESAFE_REQUIREMENT) + # some process might change the requirement in between, re-read + # and update current_requirements + locked_requirements = localrepo._readrequires(hgvfs, True) + if locked_requirements != original_crequirements: + removed = current_requirements - locked_requirements + # update current_requirements in place because it's passed + # as reference + current_requirements -= removed + current_requirements |= locked_requirements + diffrequires = current_requirements - store_requirements + # add share-safe requirement as it will mark the share as share-safe + diffrequires.add(requirementsmod.SHARESAFE_REQUIREMENT) + current_requirements.add(requirementsmod.SHARESAFE_REQUIREMENT) scmutil.writerequires(hgvfs, diffrequires) @@ -256,4 +282,3 @@ scmutil.writerequires(hgvfs, diffrequires) - current_requirements.add(requirementsmod.SHARESAFE_REQUIREMENT) ui.warn(_(b'repository upgraded to use share-safe mode\n')) except error.LockError as e: @@ -258,7 +283,7 @@ ui.warn(_(b'repository upgraded to use share-safe mode\n')) except error.LockError as e: - if ui.configbool(b'experimental', b'sharesafe-auto-upgrade-fail-error'): + if mismatch_config == b'upgrade-abort': raise error.Abort( _(b'failed to upgrade share, got error: %s') % stringutil.forcebytestr(e.strerror) ) @@ -261,8 +286,8 @@ raise error.Abort( _(b'failed to upgrade share, got error: %s') % stringutil.forcebytestr(e.strerror) ) - elif ui.configbool(b'experimental', b'sharesafe-warn-outdated-shares'): + elif mismatch_warn: ui.warn( _(b'failed to upgrade share, got error: %s\n') % stringutil.forcebytestr(e.strerror) @@ -277,6 +302,8 @@ hgvfs, sharedvfs, current_requirements, + mismatch_config, + mismatch_warn, ): """Downgrades a share which use share-safe to not use it""" wlock = None @@ -280,5 +307,16 @@ ): """Downgrades a share which use share-safe to not use it""" wlock = None + source_requirements = localrepo._readrequires(sharedvfs, True) + original_crequirements = current_requirements.copy() + # we cannot be 100% sure on which requirements were present in store when + # the source supported share-safe. However, we do know that working + # directory requirements were not there. Hence we remove them + source_requirements -= requirementsmod.WORKING_DIR_REQUIREMENTS + current_requirements |= source_requirements + current_requirements.remove(requirementsmod.SHARESAFE_REQUIREMENT) + if mismatch_config == b'allow': + return + try: wlock = lockmod.trylock(ui, hgvfs, b'wlock', 0, 0) @@ -283,12 +321,16 @@ try: wlock = lockmod.trylock(ui, hgvfs, b'wlock', 0, 0) - source_requirements = localrepo._readrequires(sharedvfs, True) - # we cannot be 100% sure on which requirements were present in store when - # the source supported share-safe. However, we do know that working - # directory requirements were not there. Hence we remove them - source_requirements -= requirementsmod.WORKING_DIR_REQUIREMENTS - current_requirements |= source_requirements - current_requirements.remove(requirementsmod.SHARESAFE_REQUIREMENT) + # some process might change the requirement in between, re-read + # and update current_requirements + locked_requirements = localrepo._readrequires(hgvfs, True) + if locked_requirements != original_crequirements: + removed = current_requirements - locked_requirements + # update current_requirements in place because it's passed + # as reference + current_requirements -= removed + current_requirements |= locked_requirements + current_requirements |= source_requirements + current_requirements -= set(requirementsmod.SHARESAFE_REQUIREMENT) scmutil.writerequires(hgvfs, current_requirements) ui.warn(_(b'repository downgraded to not use share-safe mode\n')) except error.LockError as e: @@ -292,12 +334,18 @@ scmutil.writerequires(hgvfs, current_requirements) ui.warn(_(b'repository downgraded to not use share-safe mode\n')) except error.LockError as e: - # raise error right away because if downgrade failed, we cannot load - # the repository because it does not have complete set of requirements - raise error.Abort( - _(b'failed to downgrade share, got error: %s') - % stringutil.forcebytestr(e.strerror) - ) + # If upgrade-abort is set, abort when upgrade fails, else let the + # process continue as `upgrade-allow` is set + if mismatch_config == b'downgrade-abort': + raise error.Abort( + _(b'failed to downgrade share, got error: %s') + % stringutil.forcebytestr(e.strerror) + ) + elif mismatch_warn: + ui.warn( + _(b'failed to downgrade share, got error: %s\n') + % stringutil.forcebytestr(e.strerror) + ) finally: if wlock: wlock.release() diff --git a/mercurial/upgrade_utils/actions.py b/mercurial/upgrade_utils/actions.py index 723d241543b0f5bec37cb00a36130958ab349992_bWVyY3VyaWFsL3VwZ3JhZGVfdXRpbHMvYWN0aW9ucy5weQ==..858fd8aa6f6a780965275568b6d267dc8c62e302_bWVyY3VyaWFsL3VwZ3JhZGVfdXRpbHMvYWN0aW9ucy5weQ== 100644 --- a/mercurial/upgrade_utils/actions.py +++ b/mercurial/upgrade_utils/actions.py @@ -237,7 +237,7 @@ @registerformatvariant class sharesafe(requirementformatvariant): - name = b'exp-sharesafe' + name = b'share-safe' _requirement = requirements.SHARESAFE_REQUIREMENT default = False diff --git a/tests/test-copies-chain-merge.t b/tests/test-copies-chain-merge.t index 723d241543b0f5bec37cb00a36130958ab349992_dGVzdHMvdGVzdC1jb3BpZXMtY2hhaW4tbWVyZ2UudA==..858fd8aa6f6a780965275568b6d267dc8c62e302_dGVzdHMvdGVzdC1jb3BpZXMtY2hhaW4tbWVyZ2UudA== 100644 --- a/tests/test-copies-chain-merge.t +++ b/tests/test-copies-chain-merge.t @@ -696,7 +696,7 @@ fncache: yes yes yes dotencode: yes yes yes generaldelta: yes yes yes - exp-sharesafe: no no no + share-safe: no no no sparserevlog: yes yes yes sidedata: no yes no persistent-nodemap: no no no diff --git a/tests/test-copies-in-changeset.t b/tests/test-copies-in-changeset.t index 723d241543b0f5bec37cb00a36130958ab349992_dGVzdHMvdGVzdC1jb3BpZXMtaW4tY2hhbmdlc2V0LnQ=..858fd8aa6f6a780965275568b6d267dc8c62e302_dGVzdHMvdGVzdC1jb3BpZXMtaW4tY2hhbmdlc2V0LnQ= 100644 --- a/tests/test-copies-in-changeset.t +++ b/tests/test-copies-in-changeset.t @@ -37,7 +37,7 @@ fncache: yes yes yes dotencode: yes yes yes generaldelta: yes yes yes - exp-sharesafe: no no no + share-safe: no no no sparserevlog: yes yes yes sidedata: yes yes no persistent-nodemap: no no no @@ -51,7 +51,7 @@ fncache: yes yes yes dotencode: yes yes yes generaldelta: yes yes yes - exp-sharesafe: no no no + share-safe: no no no sparserevlog: yes yes yes sidedata: no no no persistent-nodemap: no no no @@ -419,7 +419,7 @@ fncache: yes yes yes dotencode: yes yes yes generaldelta: yes yes yes - exp-sharesafe: no no no + share-safe: no no no sparserevlog: yes yes yes sidedata: yes yes no persistent-nodemap: no no no @@ -445,7 +445,7 @@ fncache: yes yes yes dotencode: yes yes yes generaldelta: yes yes yes - exp-sharesafe: no no no + share-safe: no no no sparserevlog: yes yes yes sidedata: yes yes no persistent-nodemap: no no no @@ -473,7 +473,7 @@ fncache: yes yes yes dotencode: yes yes yes generaldelta: yes yes yes - exp-sharesafe: no no no + share-safe: no no no sparserevlog: yes yes yes sidedata: yes yes no persistent-nodemap: no no no diff --git a/tests/test-help.t b/tests/test-help.t index 723d241543b0f5bec37cb00a36130958ab349992_dGVzdHMvdGVzdC1oZWxwLnQ=..858fd8aa6f6a780965275568b6d267dc8c62e302_dGVzdHMvdGVzdC1oZWxwLnQ= 100644 --- a/tests/test-help.t +++ b/tests/test-help.t @@ -1553,6 +1553,8 @@ "use-persistent-nodemap" + "use-share-safe" + "usestore" "sparse-revlog" diff --git a/tests/test-persistent-nodemap.t b/tests/test-persistent-nodemap.t index 723d241543b0f5bec37cb00a36130958ab349992_dGVzdHMvdGVzdC1wZXJzaXN0ZW50LW5vZGVtYXAudA==..858fd8aa6f6a780965275568b6d267dc8c62e302_dGVzdHMvdGVzdC1wZXJzaXN0ZW50LW5vZGVtYXAudA== 100644 --- a/tests/test-persistent-nodemap.t +++ b/tests/test-persistent-nodemap.t @@ -37,7 +37,7 @@ fncache: yes dotencode: yes generaldelta: yes - exp-sharesafe: no + share-safe: no sparserevlog: yes sidedata: no persistent-nodemap: yes @@ -556,7 +556,7 @@ fncache: yes yes yes dotencode: yes yes yes generaldelta: yes yes yes - exp-sharesafe: no no no + share-safe: no no no sparserevlog: yes yes yes sidedata: no no no persistent-nodemap: yes no no @@ -592,7 +592,7 @@ fncache: yes yes yes dotencode: yes yes yes generaldelta: yes yes yes - exp-sharesafe: no no no + share-safe: no no no sparserevlog: yes yes yes sidedata: no no no persistent-nodemap: no yes no diff --git a/tests/test-share-bookmarks.t b/tests/test-share-bookmarks.t index 723d241543b0f5bec37cb00a36130958ab349992_dGVzdHMvdGVzdC1zaGFyZS1ib29rbWFya3MudA==..858fd8aa6f6a780965275568b6d267dc8c62e302_dGVzdHMvdGVzdC1zaGFyZS1ib29rbWFya3MudA== 100644 --- a/tests/test-share-bookmarks.t +++ b/tests/test-share-bookmarks.t @@ -3,7 +3,7 @@ #if safe $ echo "[format]" >> $HGRCPATH - $ echo "exp-share-safe = True" >> $HGRCPATH + $ echo "use-share-safe = True" >> $HGRCPATH #endif $ echo "[extensions]" >> $HGRCPATH @@ -290,4 +290,4 @@ $ hg init brokenrepo --config format.bookmarks-in-store=True --config format.usestore=false ignoring enabled 'format.bookmarks-in-store' config beacuse it is incompatible with disabled 'format.usestore' config - ignoring enabled 'format.exp-share-safe' config because it is incompatible with disabled 'format.usestore' config (safe !) + ignoring enabled 'format.use-share-safe' config because it is incompatible with disabled 'format.usestore' config (safe !) diff --git a/tests/test-share-safe.t b/tests/test-share-safe.t index 723d241543b0f5bec37cb00a36130958ab349992_dGVzdHMvdGVzdC1zaGFyZS1zYWZlLnQ=..858fd8aa6f6a780965275568b6d267dc8c62e302_dGVzdHMvdGVzdC1zaGFyZS1zYWZlLnQ= 100644 --- a/tests/test-share-safe.t +++ b/tests/test-share-safe.t @@ -4,7 +4,7 @@ > [extensions] > share = > [format] - > exp-share-safe = True + > use-share-safe = True > [storage] > revlog.persistent-nodemap.slow-path=allow > EOF @@ -14,7 +14,7 @@ $ hg init source $ cd source $ cat .hg/requires - exp-sharesafe + share-safe $ cat .hg/store/requires dotencode fncache @@ -24,7 +24,6 @@ store $ hg debugrequirements dotencode - exp-sharesafe fncache generaldelta revlogv1 @@ -28,6 +27,7 @@ fncache generaldelta revlogv1 + share-safe sparserevlog store @@ -47,8 +47,8 @@ 2 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cd shared1 $ cat .hg/requires - exp-sharesafe + share-safe shared $ hg debugrequirements -R ../source dotencode @@ -51,8 +51,7 @@ shared $ hg debugrequirements -R ../source dotencode - exp-sharesafe fncache generaldelta revlogv1 @@ -56,8 +55,9 @@ fncache generaldelta revlogv1 + share-safe sparserevlog store $ hg debugrequirements dotencode @@ -59,9 +59,8 @@ sparserevlog store $ hg debugrequirements dotencode - exp-sharesafe fncache generaldelta revlogv1 @@ -65,6 +64,7 @@ fncache generaldelta revlogv1 + share-safe shared sparserevlog store @@ -214,7 +214,7 @@ upgrade will perform the following actions: requirements - preserved: dotencode, exp-sharesafe, fncache, generaldelta, revlogv1, sparserevlog, store + preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store added: revlog-compression-zstd processed revlogs: @@ -240,8 +240,8 @@ upgrade will perform the following actions: requirements - preserved: dotencode, exp-sharesafe, fncache, generaldelta, revlogv1, sparserevlog, store (no-zstd !) - preserved: dotencode, exp-sharesafe, fncache, generaldelta, revlog-compression-zstd, revlogv1, sparserevlog, store (zstd !) + preserved: dotencode, fncache, generaldelta, revlogv1, share-safe, sparserevlog, store (no-zstd !) + preserved: dotencode, fncache, generaldelta, revlog-compression-zstd, revlogv1, share-safe, sparserevlog, store (zstd !) added: persistent-nodemap processed revlogs: @@ -310,7 +310,7 @@ Test that upgrading using debugupgraderepo works ================================================= - $ hg init non-share-safe --config format.exp-share-safe=false + $ hg init non-share-safe --config format.use-share-safe=false $ cd non-share-safe $ hg debugrequirements dotencode @@ -345,7 +345,7 @@ $ hg debugupgraderepo -q requirements preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store - added: exp-sharesafe + added: share-safe processed revlogs: - all-filelogs @@ -357,7 +357,7 @@ requirements preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store - added: exp-sharesafe + added: share-safe processed revlogs: - all-filelogs @@ -368,7 +368,6 @@ $ hg debugrequirements dotencode - exp-sharesafe fncache generaldelta revlogv1 @@ -372,7 +371,8 @@ fncache generaldelta revlogv1 + share-safe sparserevlog store $ cat .hg/requires @@ -375,8 +375,8 @@ sparserevlog store $ cat .hg/requires - exp-sharesafe + share-safe $ cat .hg/store/requires dotencode @@ -392,12 +392,6 @@ o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo -Make sure existing shares still works - - $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config experimental.sharesafe-warn-outdated-shares=false - @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar - | - o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo - +Make sure existing shares dont work with default config $ hg log -GT "{node}: {desc}\n" -R ../nss-share @@ -402,10 +396,7 @@ $ hg log -GT "{node}: {desc}\n" -R ../nss-share - warning: source repository supports share-safe functionality. Reshare to upgrade. - @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar - | - o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo - + abort: version mismatch: source uses share-safe functionality while current share does not + [255] Create a safe share from upgrade one @@ -428,9 +419,9 @@ > [extensions] > share = > [format] - > exp-share-safe = False + > use-share-safe = False > EOF $ hg debugupgraderepo -q requirements preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store @@ -432,9 +423,9 @@ > EOF $ hg debugupgraderepo -q requirements preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store - removed: exp-sharesafe + removed: share-safe processed revlogs: - all-filelogs @@ -446,7 +437,7 @@ requirements preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store - removed: exp-sharesafe + removed: share-safe processed revlogs: - all-filelogs @@ -495,8 +486,8 @@ Testing automatic downgrade of shares when config is set $ touch ../ss-share/.hg/wlock - $ hg log -GT "{node}: {desc}\n" -R ../ss-share --config experimental.sharesafe-auto-downgrade-shares=true + $ hg log -GT "{node}: {desc}\n" -R ../ss-share --config share.safe-mismatch.source-not-safe=downgrade-abort abort: failed to downgrade share, got error: Lock held [255] $ rm ../ss-share/.hg/wlock @@ -499,8 +490,8 @@ abort: failed to downgrade share, got error: Lock held [255] $ rm ../ss-share/.hg/wlock - $ hg log -GT "{node}: {desc}\n" -R ../ss-share --config experimental.sharesafe-auto-downgrade-shares=true + $ hg log -GT "{node}: {desc}\n" -R ../ss-share --config share.safe-mismatch.source-not-safe=downgrade-abort repository downgraded to not use share-safe mode @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar | @@ -516,8 +507,8 @@ Testing automatic upgrade of shares when config is set - $ hg debugupgraderepo -q --run --config format.exp-share-safe=True + $ hg debugupgraderepo -q --run --config format.use-share-safe=True upgrade will perform the following actions: requirements preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store @@ -520,8 +511,8 @@ upgrade will perform the following actions: requirements preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store - added: exp-sharesafe + added: share-safe processed revlogs: - all-filelogs @@ -531,7 +522,6 @@ 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. $ hg debugrequirements dotencode - exp-sharesafe fncache generaldelta revlogv1 @@ -535,6 +525,7 @@ fncache generaldelta revlogv1 + share-safe sparserevlog store $ hg log -GT "{node}: {desc}\n" -R ../nss-share @@ -538,10 +529,7 @@ sparserevlog store $ hg log -GT "{node}: {desc}\n" -R ../nss-share - warning: source repository supports share-safe functionality. Reshare to upgrade. - @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar - | - o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo - + abort: version mismatch: source uses share-safe functionality while current share does not + [255] Check that if lock is taken, upgrade fails but read operation are successful @@ -546,3 +534,8 @@ Check that if lock is taken, upgrade fails but read operation are successful + $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgra + abort: share-safe mismatch with source. + Unrecognized value 'upgra' of `share.safe-mismatch.source-safe` set. + (run `hg help config.share.safe-mismatch.source-safe`) + [255] $ touch ../nss-share/.hg/wlock @@ -548,8 +541,8 @@ $ touch ../nss-share/.hg/wlock - $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config experimental.sharesafe-auto-upgrade-shares=true + $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgrade-allow failed to upgrade share, got error: Lock held @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar | o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo @@ -550,12 +543,12 @@ failed to upgrade share, got error: Lock held @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar | o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo - $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config experimental.sharesafe-auto-upgrade-shares=true --config experimental.sharesafe-warn-outdated-shares=false + $ 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 @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar | o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo @@ -557,10 +550,10 @@ @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar | o f3ba8b99bb6f897c87bbc1c07b75c6ddf43a4f77: added foo - $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config experimental.sharesafe-auto-upgrade-shares=true --config experimental.sharesafe-auto-upgrade-fail-error=true + $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgrade-abort abort: failed to upgrade share, got error: Lock held [255] $ rm ../nss-share/.hg/wlock @@ -563,8 +556,8 @@ abort: failed to upgrade share, got error: Lock held [255] $ rm ../nss-share/.hg/wlock - $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config experimental.sharesafe-auto-upgrade-shares=true + $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgrade-abort repository upgraded to use share-safe mode @ f63db81e6dde1d9c78814167f77fb1fb49283f4f: added bar | diff --git a/tests/test-share.t b/tests/test-share.t index 723d241543b0f5bec37cb00a36130958ab349992_dGVzdHMvdGVzdC1zaGFyZS50..858fd8aa6f6a780965275568b6d267dc8c62e302_dGVzdHMvdGVzdC1zaGFyZS50 100644 --- a/tests/test-share.t +++ b/tests/test-share.t @@ -2,7 +2,7 @@ #if safe $ echo "[format]" >> $HGRCPATH - $ echo "exp-share-safe = True" >> $HGRCPATH + $ echo "use-share-safe = True" >> $HGRCPATH #endif $ echo "[extensions]" >> $HGRCPATH @@ -281,7 +281,7 @@ Test sharing a repository which was created with store requirement disable $ hg init nostore --config format.usestore=false - ignoring enabled 'format.exp-share-safe' config because it is incompatible with disabled 'format.usestore' config (safe !) + ignoring enabled 'format.use-share-safe' config because it is incompatible with disabled 'format.usestore' config (safe !) $ hg share nostore sharednostore abort: cannot create shared repository as source was created with 'format.usestore' config disabled [255] diff --git a/tests/test-sidedata.t b/tests/test-sidedata.t index 723d241543b0f5bec37cb00a36130958ab349992_dGVzdHMvdGVzdC1zaWRlZGF0YS50..858fd8aa6f6a780965275568b6d267dc8c62e302_dGVzdHMvdGVzdC1zaWRlZGF0YS50 100644 --- a/tests/test-sidedata.t +++ b/tests/test-sidedata.t @@ -54,7 +54,7 @@ fncache: yes yes yes dotencode: yes yes yes generaldelta: yes yes yes - exp-sharesafe: no no no + share-safe: no no no sparserevlog: yes yes yes sidedata: no no no persistent-nodemap: no no no @@ -67,7 +67,7 @@ fncache: yes yes yes dotencode: yes yes yes generaldelta: yes yes yes - exp-sharesafe: no no no + share-safe: no no no sparserevlog: yes yes yes sidedata: no yes no persistent-nodemap: no no no @@ -86,7 +86,7 @@ fncache: yes yes yes dotencode: yes yes yes generaldelta: yes yes yes - exp-sharesafe: no no no + share-safe: no no no sparserevlog: yes yes yes sidedata: yes no no persistent-nodemap: no no no @@ -99,7 +99,7 @@ fncache: yes yes yes dotencode: yes yes yes generaldelta: yes yes yes - exp-sharesafe: no no no + share-safe: no no no sparserevlog: yes yes yes sidedata: yes no no persistent-nodemap: no no no diff --git a/tests/test-upgrade-repo.t b/tests/test-upgrade-repo.t index 723d241543b0f5bec37cb00a36130958ab349992_dGVzdHMvdGVzdC11cGdyYWRlLXJlcG8udA==..858fd8aa6f6a780965275568b6d267dc8c62e302_dGVzdHMvdGVzdC11cGdyYWRlLXJlcG8udA== 100644 --- a/tests/test-upgrade-repo.t +++ b/tests/test-upgrade-repo.t @@ -56,7 +56,7 @@ fncache: yes dotencode: yes generaldelta: yes - exp-sharesafe: no + share-safe: no sparserevlog: yes sidedata: no persistent-nodemap: no @@ -69,7 +69,7 @@ fncache: yes yes yes dotencode: yes yes yes generaldelta: yes yes yes - exp-sharesafe: no no no + share-safe: no no no sparserevlog: yes yes yes sidedata: no no no persistent-nodemap: no no no @@ -82,7 +82,7 @@ fncache: yes no yes dotencode: yes no yes generaldelta: yes yes yes - exp-sharesafe: no no no + share-safe: no no no sparserevlog: yes yes yes sidedata: no no no persistent-nodemap: no no no @@ -95,7 +95,7 @@ [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special| no][formatvariant.default| yes] [formatvariant.name.mismatchconfig|dotencode: ][formatvariant.repo.mismatchconfig| yes][formatvariant.config.special| no][formatvariant.default| yes] [formatvariant.name.uptodate|generaldelta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes] - [formatvariant.name.uptodate|exp-sharesafe: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no] + [formatvariant.name.uptodate|share-safe: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no] [formatvariant.name.uptodate|sparserevlog: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes] [formatvariant.name.uptodate|sidedata: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no] [formatvariant.name.uptodate|persistent-nodemap:][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no] @@ -126,7 +126,7 @@ { "config": false, "default": false, - "name": "exp-sharesafe", + "name": "share-safe", "repo": false }, { @@ -301,7 +301,7 @@ fncache: no dotencode: no generaldelta: no - exp-sharesafe: no + share-safe: no sparserevlog: no sidedata: no persistent-nodemap: no @@ -314,7 +314,7 @@ fncache: no yes yes dotencode: no yes yes generaldelta: no yes yes - exp-sharesafe: no no no + share-safe: no no no sparserevlog: no yes yes sidedata: no no no persistent-nodemap: no no no @@ -327,7 +327,7 @@ fncache: no yes yes dotencode: no yes yes generaldelta: no no yes - exp-sharesafe: no no no + share-safe: no no no sparserevlog: no no yes sidedata: no no no persistent-nodemap: no no no @@ -340,7 +340,7 @@ [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes] [formatvariant.name.mismatchconfig|dotencode: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes] [formatvariant.name.mismatchdefault|generaldelta: ][formatvariant.repo.mismatchdefault| no][formatvariant.config.special| no][formatvariant.default| yes] - [formatvariant.name.uptodate|exp-sharesafe: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no] + [formatvariant.name.uptodate|share-safe: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no] [formatvariant.name.mismatchdefault|sparserevlog: ][formatvariant.repo.mismatchdefault| no][formatvariant.config.special| no][formatvariant.default| yes] [formatvariant.name.uptodate|sidedata: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no] [formatvariant.name.uptodate|persistent-nodemap:][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no] @@ -1297,7 +1297,7 @@ fncache: yes yes yes dotencode: yes yes yes generaldelta: yes yes yes - exp-sharesafe: no no no + share-safe: no no no sparserevlog: yes yes yes sidedata: no no no persistent-nodemap: no no no @@ -1333,7 +1333,7 @@ fncache: yes yes yes dotencode: yes yes yes generaldelta: yes yes yes - exp-sharesafe: no no no + share-safe: no no no sparserevlog: yes yes yes sidedata: no no no persistent-nodemap: no no no @@ -1372,7 +1372,7 @@ fncache: yes yes yes dotencode: yes yes yes generaldelta: yes yes yes - exp-sharesafe: no no no + share-safe: no no no sparserevlog: yes yes yes sidedata: no no no persistent-nodemap: no no no @@ -1415,7 +1415,7 @@ fncache: yes yes yes dotencode: yes yes yes generaldelta: yes yes yes - exp-sharesafe: no no no + share-safe: no no no sparserevlog: yes yes yes sidedata: yes no no persistent-nodemap: no no no @@ -1458,7 +1458,7 @@ fncache: yes yes yes dotencode: yes yes yes generaldelta: yes yes yes - exp-sharesafe: no no no + share-safe: no no no sparserevlog: yes yes yes sidedata: no no no persistent-nodemap: no no no @@ -1501,7 +1501,7 @@ fncache: yes yes yes dotencode: yes yes yes generaldelta: yes yes yes - exp-sharesafe: no no no + share-safe: no no no sparserevlog: yes yes yes sidedata: yes yes no persistent-nodemap: no no no