Mercurial > hg
changeset 47263:6c84fc9c9a90
changelogv2: introduce a "changelogv2" feature
Right now, this means using revlogv2, but only for the changelog. We will have
the format more unique in future changesets.
Differential Revision: https://phab.mercurial-scm.org/D10660
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 29 Mar 2021 22:40:54 +0200 |
parents | 468e451fc0de |
children | 60668fce06d0 |
files | mercurial/changegroup.py mercurial/configitems.py mercurial/localrepo.py mercurial/requirements.py mercurial/revlog.py mercurial/upgrade_utils/actions.py tests/test-copies-chain-merge.t tests/test-copies-in-changeset.t tests/test-persistent-nodemap.t tests/test-sidedata.t tests/test-transaction-safety.t tests/test-upgrade-repo.t |
diffstat | 12 files changed, 92 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/changegroup.py Tue May 04 05:18:57 2021 +0200 +++ b/mercurial/changegroup.py Mon Mar 29 22:40:54 2021 +0200 @@ -295,7 +295,10 @@ # Only useful if we're adding sidedata categories. If both peers have # the same categories, then we simply don't do anything. adding_sidedata = ( - requirements.REVLOGV2_REQUIREMENT in repo.requirements + ( + requirements.REVLOGV2_REQUIREMENT in repo.requirements + or requirements.CHANGELOGV2_REQUIREMENT in repo.requirements + ) and self.version == b'04' and srctype == b'pull' ) @@ -1723,6 +1726,7 @@ want_v4 = ( repo.ui.configbool(b'experimental', b'changegroup4') or requirements.REVLOGV2_REQUIREMENT in repo.requirements + or requirements.CHANGELOGV2_REQUIREMENT in repo.requirements ) if not want_v4: versions.discard(b'04')
--- a/mercurial/configitems.py Tue May 04 05:18:57 2021 +0200 +++ b/mercurial/configitems.py Mon Mar 29 22:40:54 2021 +0200 @@ -1341,6 +1341,21 @@ default=lambda: [b'zstd', b'zlib'], alias=[(b'experimental', b'format.compression')], ) +# Experimental TODOs: +# +# * Same as for evlogv2 (but for the reduction of the number of files) +# * drop the storage of the base +# * Improvement to investigate +# - storing .hgtags fnode +# - storing `rank` of changesets +# - storing branch related identifier + +coreconfigitem( + b'format', + b'exp-use-changelog-v2', + default=None, + experimental=True, +) coreconfigitem( b'format', b'usefncache',
--- a/mercurial/localrepo.py Tue May 04 05:18:57 2021 +0200 +++ b/mercurial/localrepo.py Mon Mar 29 22:40:54 2021 +0200 @@ -737,7 +737,10 @@ storevfs = store.vfs storevfs.options = resolvestorevfsoptions(ui, requirements, features) - if requirementsmod.REVLOGV2_REQUIREMENT in requirements: + if ( + requirementsmod.REVLOGV2_REQUIREMENT in requirements + or requirementsmod.CHANGELOGV2_REQUIREMENT in requirements + ): features.add(repository.REPO_FEATURE_SIDE_DATA) # the revlogv2 docket introduced race condition that we need to fix features.discard(repository.REPO_FEATURE_STREAM_CLONE) @@ -1021,6 +1024,8 @@ options[b'revlogv1'] = True if requirementsmod.REVLOGV2_REQUIREMENT in requirements: options[b'revlogv2'] = True + if requirementsmod.CHANGELOGV2_REQUIREMENT in requirements: + options[b'changelogv2'] = True if requirementsmod.GENERALDELTA_REQUIREMENT in requirements: options[b'generaldelta'] = True @@ -1220,6 +1225,7 @@ requirementsmod.TREEMANIFEST_REQUIREMENT, requirementsmod.COPIESSDC_REQUIREMENT, requirementsmod.REVLOGV2_REQUIREMENT, + requirementsmod.CHANGELOGV2_REQUIREMENT, requirementsmod.SPARSEREVLOG_REQUIREMENT, requirementsmod.NODEMAP_REQUIREMENT, bookmarks.BOOKMARKS_IN_STORE_REQUIREMENT, @@ -3529,6 +3535,10 @@ if ui.configbool(b'experimental', b'treemanifest'): requirements.add(requirementsmod.TREEMANIFEST_REQUIREMENT) + changelogv2 = ui.config(b'format', b'exp-use-changelog-v2') + if changelogv2 == b'enable-unstable-format-and-corrupt-my-data': + requirements.add(requirementsmod.CHANGELOGV2_REQUIREMENT) + revlogv2 = ui.config(b'experimental', b'revlogv2') if revlogv2 == b'enable-unstable-format-and-corrupt-my-data': requirements.discard(requirementsmod.REVLOGV1_REQUIREMENT)
--- a/mercurial/requirements.py Tue May 04 05:18:57 2021 +0200 +++ b/mercurial/requirements.py Mon Mar 29 22:40:54 2021 +0200 @@ -30,6 +30,10 @@ # Increment the sub-version when the revlog v2 format changes to lock out old # clients. +CHANGELOGV2_REQUIREMENT = b'exp-changelog-v2' + +# Increment the sub-version when the revlog v2 format changes to lock out old +# clients. REVLOGV2_REQUIREMENT = b'exp-revlogv2.2' # A repository with the sparserevlog feature will have delta chains that
--- a/mercurial/revlog.py Tue May 04 05:18:57 2021 +0200 +++ b/mercurial/revlog.py Mon Mar 29 22:40:54 2021 +0200 @@ -42,6 +42,7 @@ FLAG_GENERALDELTA, FLAG_INLINE_DATA, INDEX_HEADER, + KIND_CHANGELOG, REVLOGV0, REVLOGV1, REVLOGV1_FLAGS, @@ -458,7 +459,9 @@ mmapindexthreshold = None opts = self.opener.options - if b'revlogv2' in opts: + if b'changelogv2' in opts and self.revlog_kind == KIND_CHANGELOG: + new_header = REVLOGV2 + elif b'revlogv2' in opts: new_header = REVLOGV2 elif b'revlogv1' in opts: new_header = REVLOGV1 | FLAG_INLINE_DATA
--- a/mercurial/upgrade_utils/actions.py Tue May 04 05:18:57 2021 +0200 +++ b/mercurial/upgrade_utils/actions.py Mon Mar 29 22:40:54 2021 +0200 @@ -373,6 +373,15 @@ @registerformatvariant +class changelogv2(requirementformatvariant): + name = b'changelog-v2' + _requirement = requirements.CHANGELOGV2_REQUIREMENT + default = False + description = _(b'An iteration of the revlog focussed on changelog needs.') + upgrademessage = _(b'quite experimental') + + +@registerformatvariant class removecldeltachain(formatvariant): name = b'plain-cl-delta'
--- a/tests/test-copies-chain-merge.t Tue May 04 05:18:57 2021 +0200 +++ b/tests/test-copies-chain-merge.t Mon Mar 29 22:40:54 2021 +0200 @@ -1660,6 +1660,7 @@ persistent-nodemap: yes yes no (rust !) copies-sdc: no yes no revlog-v2: no yes no + changelog-v2: no no no plain-cl-delta: yes yes yes compression: * (glob) compression-level: default default default @@ -1699,6 +1700,7 @@ persistent-nodemap: yes yes no (rust !) copies-sdc: no yes no revlog-v2: no yes no + changelog-v2: no no no plain-cl-delta: yes yes yes compression: * (glob) compression-level: default default default
--- a/tests/test-copies-in-changeset.t Tue May 04 05:18:57 2021 +0200 +++ b/tests/test-copies-in-changeset.t Mon Mar 29 22:40:54 2021 +0200 @@ -43,6 +43,7 @@ persistent-nodemap: yes yes no (rust !) copies-sdc: yes yes no revlog-v2: yes yes no + changelog-v2: no no no plain-cl-delta: yes yes yes compression: zlib zlib zlib (no-zstd !) compression: zstd zstd zstd (zstd !) @@ -59,6 +60,7 @@ persistent-nodemap: yes yes no (rust !) copies-sdc: no no no revlog-v2: no no no + changelog-v2: no no no plain-cl-delta: yes yes yes compression: zlib zlib zlib (no-zstd !) compression: zstd zstd zstd (zstd !) @@ -432,6 +434,7 @@ persistent-nodemap: yes yes no (rust !) copies-sdc: yes yes no revlog-v2: yes yes no + changelog-v2: no no no plain-cl-delta: yes yes yes compression: zlib zlib zlib (no-zstd !) compression: zstd zstd zstd (zstd !) @@ -461,6 +464,7 @@ persistent-nodemap: yes yes no (rust !) copies-sdc: no no no revlog-v2: yes yes no + changelog-v2: no no no plain-cl-delta: yes yes yes compression: zlib zlib zlib (no-zstd !) compression: zstd zstd zstd (zstd !) @@ -487,6 +491,7 @@ persistent-nodemap: yes yes no (rust !) copies-sdc: yes yes no revlog-v2: yes yes no + changelog-v2: no no no plain-cl-delta: yes yes yes compression: zlib zlib zlib (no-zstd !) compression: zstd zstd zstd (zstd !)
--- a/tests/test-persistent-nodemap.t Tue May 04 05:18:57 2021 +0200 +++ b/tests/test-persistent-nodemap.t Mon Mar 29 22:40:54 2021 +0200 @@ -64,6 +64,7 @@ persistent-nodemap: yes copies-sdc: no revlog-v2: no + changelog-v2: no plain-cl-delta: yes compression: zlib (no-zstd !) compression: zstd (zstd !) @@ -583,6 +584,7 @@ persistent-nodemap: yes no no copies-sdc: no no no revlog-v2: no no no + changelog-v2: no no no plain-cl-delta: yes yes yes compression: zlib zlib zlib (no-zstd !) compression: zstd zstd zstd (zstd !) @@ -630,6 +632,7 @@ persistent-nodemap: no yes no copies-sdc: no no no revlog-v2: no no no + changelog-v2: no no no plain-cl-delta: yes yes yes compression: zlib zlib zlib (no-zstd !) compression: zstd zstd zstd (zstd !)
--- a/tests/test-sidedata.t Tue May 04 05:18:57 2021 +0200 +++ b/tests/test-sidedata.t Mon Mar 29 22:40:54 2021 +0200 @@ -60,6 +60,7 @@ persistent-nodemap: yes yes no (rust !) copies-sdc: no no no revlog-v2: no no no + changelog-v2: no no no plain-cl-delta: yes yes yes compression: zlib zlib zlib (no-zstd !) compression: zstd zstd zstd (zstd !) @@ -75,6 +76,7 @@ persistent-nodemap: yes yes no (rust !) copies-sdc: no no no revlog-v2: no yes no + changelog-v2: no no no plain-cl-delta: yes yes yes compression: zlib zlib zlib (no-zstd !) compression: zstd zstd zstd (zstd !) @@ -96,6 +98,7 @@ persistent-nodemap: yes yes no (rust !) copies-sdc: no no no revlog-v2: yes no no + changelog-v2: no no no plain-cl-delta: yes yes yes compression: zlib zlib zlib (no-zstd !) compression: zstd zstd zstd (zstd !) @@ -111,6 +114,7 @@ persistent-nodemap: yes yes no (rust !) copies-sdc: no no no revlog-v2: yes no no + changelog-v2: no no no plain-cl-delta: yes yes yes compression: zlib zlib zlib (no-zstd !) compression: zstd zstd zstd (zstd !)
--- a/tests/test-transaction-safety.t Tue May 04 05:18:57 2021 +0200 +++ b/tests/test-transaction-safety.t Mon Mar 29 22:40:54 2021 +0200 @@ -1,7 +1,7 @@ Test transaction safety ======================= -#testcases revlogv1 revlogv2 +#testcases revlogv1 revlogv2 changelogv2 #if revlogv1 @@ -21,6 +21,15 @@ #endif +#if changelogv2 + + $ cat << EOF >> $HGRCPATH + > [format] + > exp-use-changelog-v2=enable-unstable-format-and-corrupt-my-data + > EOF + +#endif + This test basic case to make sure external process do not see transaction content until it is committed.
--- a/tests/test-upgrade-repo.t Tue May 04 05:18:57 2021 +0200 +++ b/tests/test-upgrade-repo.t Mon Mar 29 22:40:54 2021 +0200 @@ -65,6 +65,7 @@ persistent-nodemap: yes (rust !) copies-sdc: no revlog-v2: no + changelog-v2: no plain-cl-delta: yes compression: zlib compression-level: default @@ -79,6 +80,7 @@ persistent-nodemap: yes yes no (rust !) copies-sdc: no no no revlog-v2: no no no + changelog-v2: no no no plain-cl-delta: yes yes yes compression: zlib zlib zlib (no-zstd !) compression: zlib zlib zstd (zstd !) @@ -94,6 +96,7 @@ persistent-nodemap: yes yes no (rust !) copies-sdc: no no no revlog-v2: no no no + changelog-v2: no no no plain-cl-delta: yes yes yes compression: zlib zlib zlib (no-zstd !) compression: zlib zlib zstd (zstd !) @@ -109,6 +112,7 @@ [formatvariant.name.mismatchdefault|persistent-nodemap:][formatvariant.repo.mismatchdefault| yes][formatvariant.config.special| yes][formatvariant.default| no] (rust !) [formatvariant.name.uptodate|copies-sdc: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no] [formatvariant.name.uptodate|revlog-v2: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no] + [formatvariant.name.uptodate|changelog-v2: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no] [formatvariant.name.uptodate|plain-cl-delta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes] [formatvariant.name.uptodate|compression: ][formatvariant.repo.uptodate| zlib][formatvariant.config.default| zlib][formatvariant.default| zlib] (no-zstd !) [formatvariant.name.mismatchdefault|compression: ][formatvariant.repo.mismatchdefault| zlib][formatvariant.config.special| zlib][formatvariant.default| zstd] (zstd !) @@ -166,6 +170,12 @@ "repo": false }, { + "config": false, + "default": false, + "name": "changelog-v2", + "repo": false + }, + { "config": true, "default": true, "name": "plain-cl-delta", @@ -324,6 +334,7 @@ persistent-nodemap: no copies-sdc: no revlog-v2: no + changelog-v2: no plain-cl-delta: yes compression: zlib compression-level: default @@ -338,6 +349,7 @@ persistent-nodemap: no yes no (rust !) copies-sdc: no no no revlog-v2: no no no + changelog-v2: no no no plain-cl-delta: yes yes yes compression: zlib zlib zlib (no-zstd !) compression: zlib zlib zstd (zstd !) @@ -353,6 +365,7 @@ persistent-nodemap: no yes no (rust !) copies-sdc: no no no revlog-v2: no no no + changelog-v2: no no no plain-cl-delta: yes yes yes compression: zlib zlib zlib (no-zstd !) compression: zlib zlib zstd (zstd !) @@ -368,6 +381,7 @@ [formatvariant.name.mismatchconfig|persistent-nodemap:][formatvariant.repo.mismatchconfig| no][formatvariant.config.special| yes][formatvariant.default| no] (rust !) [formatvariant.name.uptodate|copies-sdc: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no] [formatvariant.name.uptodate|revlog-v2: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no] + [formatvariant.name.uptodate|changelog-v2: ][formatvariant.repo.uptodate| no][formatvariant.config.default| no][formatvariant.default| no] [formatvariant.name.uptodate|plain-cl-delta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes] [formatvariant.name.uptodate|compression: ][formatvariant.repo.uptodate| zlib][formatvariant.config.default| zlib][formatvariant.default| zlib] (no-zstd !) [formatvariant.name.mismatchdefault|compression: ][formatvariant.repo.mismatchdefault| zlib][formatvariant.config.special| zlib][formatvariant.default| zstd] (zstd !) @@ -1349,6 +1363,7 @@ persistent-nodemap: yes yes no (rust !) copies-sdc: no no no revlog-v2: no no no + changelog-v2: no no no plain-cl-delta: yes yes yes compression: zlib zlib zlib (no-zstd !) compression: zstd zlib zstd (zstd !) @@ -1389,6 +1404,7 @@ persistent-nodemap: yes yes no (rust !) copies-sdc: no no no revlog-v2: no no no + changelog-v2: no no no plain-cl-delta: yes yes yes compression: zlib zlib zlib (no-zstd !) compression: zlib zlib zstd (zstd !) @@ -1432,6 +1448,7 @@ persistent-nodemap: yes yes no (rust !) copies-sdc: no no no revlog-v2: no no no + changelog-v2: no no no plain-cl-delta: yes yes yes compression: zlib zlib zlib (no-zstd !) compression: zstd zstd zstd (zstd !) @@ -1481,6 +1498,7 @@ persistent-nodemap: yes yes no (rust !) copies-sdc: no no no revlog-v2: yes no no + changelog-v2: no no no plain-cl-delta: yes yes yes compression: zlib zlib zlib (no-zstd !) compression: zstd zstd zstd (zstd !) @@ -1527,6 +1545,7 @@ persistent-nodemap: yes yes no (rust !) copies-sdc: no no no revlog-v2: no no no + changelog-v2: no no no plain-cl-delta: yes yes yes compression: zlib zlib zlib (no-zstd !) compression: zstd zstd zstd (zstd !) @@ -1574,6 +1593,7 @@ persistent-nodemap: yes yes no (rust !) copies-sdc: no no no revlog-v2: yes yes no + changelog-v2: no no no plain-cl-delta: yes yes yes compression: zlib zlib zlib (no-zstd !) compression: zstd zstd zstd (zstd !)