D9844: revlogv2: allow upgrading to v2
Alphare created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Revlogv2 implies sidedata. Right now sidedata is not really used in production, and Revlogv2 will be used for the first production-ready version of sidedata support. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9844 AFFECTED FILES mercurial/configitems.py mercurial/localrepo.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-upgrade-repo.t CHANGE DETAILS diff --git a/tests/test-upgrade-repo.t b/tests/test-upgrade-repo.t --- a/tests/test-upgrade-repo.t +++ b/tests/test-upgrade-repo.t @@ -21,7 +21,7 @@ > EOF $ hg -R no-revlogv1 debugupgraderepo - abort: cannot upgrade repository; requirement missing: revlogv1 + abort: cannot upgrade repository; missing a revlog version [255] Cannot upgrade shared repositories @@ -61,6 +61,7 @@ sidedata:no persistent-nodemap: no copies-sdc: no + revlog-v2: no plain-cl-delta: yes compression:zlib compression-level: default @@ -74,6 +75,7 @@ sidedata:no no no persistent-nodemap: no no no copies-sdc: no no no + revlog-v2: no no no plain-cl-delta: yesyes yes compression:zlib zlibzlib compression-level: default default default @@ -87,6 +89,7 @@ sidedata:no no no persistent-nodemap: no no no copies-sdc: no no no + revlog-v2: no no no plain-cl-delta: yesyes yes compression:zlib zlibzlib compression-level: default default default @@ -100,6 +103,7 @@ [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] [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|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] [formatvariant.name.uptodate|compression-level: ][formatvariant.repo.uptodate| default][formatvariant.config.default| default][formatvariant.default| default] @@ -154,6 +158,12 @@ "repo": false }, { +"config": false, +"default": false, +"name": "revlog-v2", +"repo": false + }, + { "config": true, "default": true, "name": "plain-cl-delta", @@ -306,6 +316,7 @@ sidedata:no persistent-nodemap: no copies-sdc: no + revlog-v2: no plain-cl-delta: yes compression:zlib compression-level: default @@ -319,6 +330,7 @@ sidedata:no no no persistent-nodemap: no no no copies-sdc: no no no + revlog-v2: no no no plain-cl-delta: yesyes yes compression:zlib zlibzlib compression-level: default default default @@ -332,6 +344,7 @@ sidedata:no no no persistent-nodemap: no no no copies-sdc: no no no + revlog-v2: no no no plain-cl-delta: yesyes yes compression:zlib zlibzlib compression-level: default default default @@ -345,6 +358,7 @@ [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] [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|plain-cl-delta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes] [formatvariant.name.uptodate|compression:
D9843: revlog: introduce v2 format
Alphare created this revision. Herald added a reviewer: indygreg. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY As documented in [1], this is still tentative and could be subject to change, but we need to lay down the foundations in order to work on the next abstraction layers. [1] https://www.mercurial-scm.org/wiki/RevlogV2Plan REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9843 AFFECTED FILES mercurial/localrepo.py mercurial/pure/parsers.py mercurial/requirements.py mercurial/revlog.py mercurial/revlogutils/constants.py tests/test-parseindex2.py tests/test-requires.t tests/test-revlog-v2.t tests/test-revlog.t CHANGE DETAILS diff --git a/tests/test-revlog.t b/tests/test-revlog.t --- a/tests/test-revlog.t +++ b/tests/test-revlog.t @@ -22,10 +22,10 @@ Unknown version is rejected >>> with open('.hg/store/00changelog.i', 'wb') as fh: - ... fh.write(b'\x00\x00\x00\x02') and None + ... fh.write(b'\x00\x00\x00\x03') and None $ hg log - abort: unknown version (2) in revlog 00changelog.i + abort: unknown version (3) in revlog 00changelog.i [50] $ cd .. diff --git a/tests/test-revlog-v2.t b/tests/test-revlog-v2.t --- a/tests/test-revlog-v2.t +++ b/tests/test-revlog-v2.t @@ -22,7 +22,7 @@ $ cd empty-repo $ cat .hg/requires dotencode - exp-revlogv2.1 + exp-revlogv2.2 fncache sparserevlog store @@ -32,10 +32,10 @@ Unknown flags to revlog are rejected >>> with open('.hg/store/00changelog.i', 'wb') as fh: - ... fh.write(b'\xff\x00\xde\xad') and None + ... fh.write(b'\xff\x00\x00\x02') and None $ hg log - abort: unknown flags (0xff00) in version 57005 revlog 00changelog.i + abort: unknown flags (0xff00) in version 2 revlog 00changelog.i [50] $ cd .. @@ -58,8 +58,8 @@ $ f --hexdump --bytes 4 .hg/store/00changelog.i .hg/store/00changelog.i: - : 00 01 de ad || + : 00 01 00 02 || $ f --hexdump --bytes 4 .hg/store/data/foo.i .hg/store/data/foo.i: - : 00 01 de ad || + : 00 01 00 02 || diff --git a/tests/test-requires.t b/tests/test-requires.t --- a/tests/test-requires.t +++ b/tests/test-requires.t @@ -5,7 +5,7 @@ $ hg commit -m test $ rm .hg/requires $ hg tip - abort: unknown version (2) in revlog 00changelog.i + abort: unknown version (65535) in revlog 00changelog.i [50] $ echo indoor-pool > .hg/requires $ hg tip diff --git a/tests/test-parseindex2.py b/tests/test-parseindex2.py --- a/tests/test-parseindex2.py +++ b/tests/test-parseindex2.py @@ -117,8 +117,8 @@ ) -def parse_index2(data, inline): -index, chunkcache = parsers.parse_index2(data, inline) +def parse_index2(data, inline, revlogv2=False): +index, chunkcache = parsers.parse_index2(data, inline, revlogv2=revlogv2) return list(index), chunkcache diff --git a/mercurial/revlogutils/constants.py b/mercurial/revlogutils/constants.py --- a/mercurial/revlogutils/constants.py +++ b/mercurial/revlogutils/constants.py @@ -14,9 +14,7 @@ # revlog header flags REVLOGV0 = 0 REVLOGV1 = 1 -# Dummy value until file format is finalized. -# Reminder: change the bounds check in revlog.__init__ when this is changed. -REVLOGV2 = 0xDEAD +REVLOGV2 = 2 # Shared across v1 and v2. FLAG_INLINE_DATA = 1 << 16 # Only used by v1, implied by v2. diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -69,6 +69,7 @@ templatefilters, util, ) +from .pure import parsers as pureparsers from .interfaces import ( repository, util as interfaceutil, @@ -364,6 +365,40 @@ return p +# index v2: +# 6 bytes: offset +# 2 bytes: flags +# 4 bytes: compressed length +# 4 bytes: uncompressed length +# 4 bytes: base rev +# 4 bytes: link rev +# 4 bytes: parent 1 rev +# 4 bytes: parent 2 rev +# 32 bytes: nodeid +# 8 bytes: UnifiedRevlog identifier +# 4 bytes: rank (number of changesets under this one, this one included) +# 8 bytes: sidedata offset +# 4 bytes: sidedata compressed length +# 8 bytes: Padding to align to 96 bytes +indexformatv2 = struct.Struct(b">Qii20s12xQiQi8x") +indexformatv2_pack = indexformatv2.pack + + +class revlogv2io(object): +def __init__(self): +self.size = indexformatv2.size + +def parseindex(self, data, inline): +index, cache = parsers.parse_index2(data, inline, revlogv2=True) +return index, cache + +def packentry(self, entry, node, version, rev): +p = indexformatv2_pack(*entry) +if rev == 0: +p = versionformat_pack(version) + p[4:] +return p + + NodemapRevlogIO = None if util.safehasattr(parsers, 'parse_index_devel_nodemap'): @@ -647,6 +682,8 @@
D9846: cext: add support for revlogv2
Alphare created this revision. Herald added a reviewer: indygreg. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9846 AFFECTED FILES mercurial/cext/parsers.c mercurial/cext/revlog.c mercurial/revlog.py CHANGE DETAILS diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -69,7 +69,6 @@ templatefilters, util, ) -from .pure import parsers as pureparsers from .interfaces import ( repository, util as interfaceutil, diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c --- a/mercurial/cext/revlog.c +++ b/mercurial/cext/revlog.c @@ -98,6 +98,7 @@ int ntlookups; /* # lookups */ int ntmisses; /* # lookups that miss the cache */ int inlined; + long hdrsize; /* size of index headers. Differs in v1 v.s. v2 format */ }; static Py_ssize_t index_length(const indexObject *self) @@ -113,14 +114,19 @@ static int index_find_node(indexObject *self, const char *node); #if LONG_MAX == 0x7fffL -static const char *const tuple_format = PY23("Kiis#", "Kiiy#"); +static const char *const v1_tuple_format = PY23("Kiis#", "Kiiy#"); +static const char *const v2_tuple_format = PY23("Kiis#KiKi", "Kiiy#KiKi"); #else -static const char *const tuple_format = PY23("kiis#", "kiiy#"); +static const char *const v1_tuple_format = PY23("kiis#", "kiiy#"); +static const char *const v2_tuple_format = PY23("kiis#kiki", "kiiy#kiki"); #endif /* A RevlogNG v1 index entry is 64 bytes long. */ static const long v1_hdrsize = 64; +/* A Revlogv2 index entry is 96 bytes long. */ +static const long v2_hdrsize = 96; + static void raise_revlog_error(void) { PyObject *mod = NULL, *dict = NULL, *errclass = NULL; @@ -157,7 +163,7 @@ static const char *index_deref(indexObject *self, Py_ssize_t pos) { if (pos >= self->length) - return self->added + (pos - self->length) * v1_hdrsize; + return self->added + (pos - self->length) * self->hdrsize; if (self->inlined && pos > 0) { if (self->offsets == NULL) { @@ -174,7 +180,7 @@ return self->offsets[pos]; } - return (const char *)(self->buf.buf) + pos * v1_hdrsize; + return (const char *)(self->buf.buf) + pos * self->hdrsize; } /* @@ -280,8 +286,9 @@ */ static PyObject *index_get(indexObject *self, Py_ssize_t pos) { - uint64_t offset_flags; - int comp_len, uncomp_len, base_rev, link_rev, parent_1, parent_2; + uint64_t offset_flags, sidedata_offset, unified_revlog_id; + int comp_len, uncomp_len, base_rev, link_rev, parent_1, parent_2, +sidedata_comp_len, rank; const char *c_node_id; const char *data; Py_ssize_t length = index_length(self); @@ -320,9 +327,22 @@ parent_2 = getbe32(data + 28); c_node_id = data + 32; - return Py_BuildValue(tuple_format, offset_flags, comp_len, uncomp_len, -base_rev, link_rev, parent_1, parent_2, c_node_id, -self->nodelen); + if (self->hdrsize == v1_hdrsize) { +return Py_BuildValue(v1_tuple_format, offset_flags, comp_len, uncomp_len, + base_rev, link_rev, parent_1, parent_2, c_node_id, + self->nodelen); + } else { +unified_revlog_id = getbe64(data + 64); +rank = getbe32(data + 72); +sidedata_offset = getbe64(data + 76); +sidedata_comp_len = getbe32(data + 84); + +return Py_BuildValue(v2_tuple_format, offset_flags, comp_len, + uncomp_len, base_rev, link_rev, parent_1, + parent_2, c_node_id, self->nodelen, + unified_revlog_id, rank, + sidedata_offset, sidedata_comp_len); + } } /* @@ -373,18 +393,30 @@ static PyObject *index_append(indexObject *self, PyObject *obj) { - uint64_t offset_flags; + uint64_t offset_flags, unified_revlog_id, sidedata_offset; int rev, comp_len, uncomp_len, base_rev, link_rev, parent_1, parent_2; - Py_ssize_t c_node_id_len; + Py_ssize_t c_node_id_len, rank, sidedata_comp_len; const char *c_node_id; char *data; - if (!PyArg_ParseTuple(obj, tuple_format, _flags, _len, - _len, _rev, _rev, _1, - _2, _node_id, _node_id_len)) { - PyErr_SetString(PyExc_TypeError, "8-tuple required"); - return NULL; + if (self->hdrsize == v1_hdrsize) { +if (!PyArg_ParseTuple(obj, v1_tuple_format, _flags, _len, + _len, _rev, _rev, _1, + _2, _node_id, _node_id_len)) { + PyErr_SetString(PyExc_TypeError, "8-tuple required"); + return
D9845: bitmanipulation: add utils to read/write bigendian 64bit integers
Alphare created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9845 AFFECTED FILES mercurial/bitmanipulation.h CHANGE DETAILS diff --git a/mercurial/bitmanipulation.h b/mercurial/bitmanipulation.h --- a/mercurial/bitmanipulation.h +++ b/mercurial/bitmanipulation.h @@ -5,6 +5,29 @@ #include "compat.h" +/* Reads a 64 bit integer from big-endian bytes. Assumes that the data is long + enough */ +static inline uint64_t getbe64(const char *c) +{ + const unsigned char *d = (const unsigned char *)c; + + return uint64_t)d[0]) << 56) + | + (((uint64_t)d[1]) << 48) + | + (((uint64_t)d[2]) << 40) + | + (((uint64_t)d[3]) << 32) + | + (((uint64_t)d[4]) << 24) + | + (((uint64_t)d[5]) << 16) + | + (((uint64_t)d[6]) << 8) + | + (d[7])); +} + static inline uint32_t getbe32(const char *c) { const unsigned char *d = (const unsigned char *)c; @@ -27,6 +50,20 @@ return ((d[0] << 8) | (d[1])); } +/* Writes a 64 bit integer to bytes in a big-endian format. + Assumes that the buffer is long enough */ +static inline void putbe64(uint64_t x, char *c) +{ + c[0] = (x >> 56) & 0xff; + c[1] = (x >> 48) & 0xff; + c[2] = (x >> 40) & 0xff; + c[3] = (x >> 32) & 0xff; + c[4] = (x >> 24) & 0xff; + c[5] = (x >> 16) & 0xff; + c[6] = (x >> 8) & 0xff; + c[7] = (x) & 0xff; +} + static inline void putbe32(uint32_t x, char *c) { c[0] = (x >> 24) & 0xff; To: Alphare, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial-devel | Pipeline #16795 has failed for branch/default | 53124766
Your pipeline has failed. Project: mercurial-devel ( https://foss.heptapod.net/octobus/mercurial-devel ) Branch: branch/default ( https://foss.heptapod.net/octobus/mercurial-devel/-/commits/branch/default ) Commit: 53124766 ( https://foss.heptapod.net/octobus/mercurial-devel/-/commit/5312476682e019ff27ae2350860309006bab2838 ) Commit Message: merge with stable Commit Author: Augie Fackler Pipeline #16795 ( https://foss.heptapod.net/octobus/mercurial-devel/-/pipelines/16795 ) triggered by Administrator ( https://foss.heptapod.net/root ) had 1 failed build. Job #154584 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/154584/raw ) Stage: tests Name: test-py2 -- You're receiving this email because of your account on foss.heptapod.net. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9842: tests: deal with more timing differences in output
joerg.sonnenberger created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9842 AFFECTED FILES tests/test-wireproto-exchangev2-shallow.t CHANGE DETAILS diff --git a/tests/test-wireproto-exchangev2-shallow.t b/tests/test-wireproto-exchangev2-shallow.t --- a/tests/test-wireproto-exchangev2-shallow.t +++ b/tests/test-wireproto-exchangev2-shallow.t @@ -100,10 +100,15 @@ received frame(size=1170; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation) received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) (?) add changeset 3390ef850073 + received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) (?) add changeset b709380892b1 + received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) (?) add changeset 47fe012ab237 + received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) (?) add changeset 97765fc3cd62 + received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) (?) add changeset dc666cf9ecf3 + received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) (?) add changeset 93a8bd067ed2 received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) (?) checking for updated bookmarks @@ -269,10 +274,15 @@ received frame(size=1170; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation) received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) (?) add changeset 3390ef850073 + received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) (?) add changeset b709380892b1 + received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) (?) add changeset 47fe012ab237 + received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) (?) add changeset 97765fc3cd62 + received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) (?) add changeset dc666cf9ecf3 + received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) (?) add changeset 93a8bd067ed2 received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) (?) checking for updated bookmarks @@ -407,8 +417,11 @@ received frame(size=783; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation) received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) (?) add changeset 3390ef850073 + received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) (?) add changeset b709380892b1 + received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) (?) add changeset 47fe012ab237 + received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) (?) add changeset 97765fc3cd62 received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) (?) checking for updated bookmarks @@ -522,6 +535,7 @@ received frame(size=400; request=1; stream=2; streamflags=encoded; type=command-response; flags=continuation) received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) (?) add changeset dc666cf9ecf3 + received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) (?) add changeset 93a8bd067ed2 received frame(size=0; request=1; stream=2; streamflags=; type=command-response; flags=eos) (?) checking for updated bookmarks To: joerg.sonnenberger, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[Bug 6470] New: test-wireproto-exchangev2-shallow.t is flaky
https://bz.mercurial-scm.org/show_bug.cgi?id=6470 Bug ID: 6470 Summary: test-wireproto-exchangev2-shallow.t is flaky Product: Mercurial Version: unspecified Hardware: PC OS: Linux Status: UNCONFIRMED Severity: feature Priority: wish Component: Mercurial Assignee: bugzi...@mercurial-scm.org Reporter: pierre-yves.da...@ens-lyon.org CC: mercurial-devel@mercurial-scm.org Python Version: --- Their seems to be possible unstability in output order: https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/154367 -- You are receiving this mail because: You are on the CC list for the bug. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9841: share-share: have the hint issue more consistently and point to the right doc
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This should help user in trouble to find solution in the documentation. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9841 AFFECTED FILES mercurial/localrepo.py mercurial/upgrade.py tests/test-share-safe.t CHANGE DETAILS diff --git a/tests/test-share-safe.t b/tests/test-share-safe.t --- a/tests/test-share-safe.t +++ b/tests/test-share-safe.t @@ -396,6 +396,7 @@ $ hg log -GT "{node}: {desc}\n" -R ../nss-share abort: version mismatch: source uses share-safe functionality while the current share does not + (see `hg help config.format.use-share-safe` for more information) [255] @@ -481,6 +482,7 @@ $ hg log -GT "{node}: {desc}\n" -R ../ss-share abort: share source does not support exp-sharesafe requirement + (see `hg help config.format.use-share-safe` for more information) [255] Testing automatic downgrade of shares when config is set @@ -488,6 +490,7 @@ $ touch ../ss-share/.hg/wlock $ 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 + (see `hg help config.format.use-share-safe` for more information) [255] $ rm ../ss-share/.hg/wlock @@ -530,13 +533,14 @@ store $ hg log -GT "{node}: {desc}\n" -R ../nss-share abort: version mismatch: source uses share-safe functionality while the current share does not + (see `hg help config.format.use-share-safe` for more information) [255] 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`) + (see `hg help config.format.use-share-safe` for more information) [255] $ touch ../nss-share/.hg/wlock $ hg log -GT "{node}: {desc}\n" -R ../nss-share --config share.safe-mismatch.source-safe=upgrade-allow @@ -554,6 +558,7 @@ $ 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 + (see `hg help config.format.use-share-safe` for more information) [255] $ rm ../nss-share/.hg/wlock diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py --- a/mercurial/upgrade.py +++ b/mercurial/upgrade.py @@ -282,15 +282,20 @@ scmutil.writerequires(hgvfs, diffrequires) ui.warn(_(b'repository upgraded to use share-safe mode\n')) except error.LockError as e: +hint = _( +"see `hg help config.format.use-share-safe` for more information" +) if mismatch_config == b'upgrade-abort': raise error.Abort( _(b'failed to upgrade share, got error: %s') -% stringutil.forcebytestr(e.strerror) +% stringutil.forcebytestr(e.strerror), +hint=hint, ) elif mismatch_warn: ui.warn( _(b'failed to upgrade share, got error: %s\n') -% stringutil.forcebytestr(e.strerror) +% stringutil.forcebytestr(e.strerror), +hint=hint, ) finally: if wlock: @@ -334,17 +339,22 @@ scmutil.writerequires(hgvfs, current_requirements) ui.warn(_(b'repository downgraded to not use share-safe mode\n')) except error.LockError as e: +hint = _( +"see `hg help config.format.use-share-safe` for more information" +) # 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) +% stringutil.forcebytestr(e.strerror), +hint=hint, ) elif mismatch_warn: ui.warn( _(b'failed to downgrade share, got error: %s\n') -% stringutil.forcebytestr(e.strerror) +% stringutil.forcebytestr(e.strerror), +hint=hint, ) finally: if wlock: diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -575,6 +575,9 @@ and requirementsmod.SHARESAFE_REQUIREMENT not in _readrequires(sharedvfs, True) ): +hint = _( +"see `hg help config.format.use-share-safe` for more information" +) mismatch_warn = ui.configbool(
D9840: doc: point to the main share-safe doc in the "mismatch" config
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY User should be able to find their way with that. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9840 AFFECTED FILES mercurial/helptext/config.txt CHANGE DETAILS diff --git a/mercurial/helptext/config.txt b/mercurial/helptext/config.txt --- a/mercurial/helptext/config.txt +++ b/mercurial/helptext/config.txt @@ -1977,6 +1977,9 @@ tries to upgrade the share; if it fails, continue by respecting the share source setting +Check :hg:`help config format.use-share-safe` for details about the +share-safe feature. + ``safe-mismatch.source-safe.warn`` Shows a warning on operations if the shared repository does not use share-safe, but the source repository does. @@ -2000,6 +2003,9 @@ tries to downgrade the share to not use share-safe; if it fails, continue by respecting the shared source setting +Check :hg:`help config format.use-share-safe` for details about the +share-safe feature. + ``safe-mismatch.source-not-safe.warn`` Shows a warning on operations if the shared repository uses share-safe, but the source repository does not. To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9839: doc: improves the share-safe documentation
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY The associated behavior is now clearer and we point to the other configuration that control the mismatching behavior. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9839 AFFECTED FILES mercurial/helptext/config.txt CHANGE DETAILS diff --git a/mercurial/helptext/config.txt b/mercurial/helptext/config.txt --- a/mercurial/helptext/config.txt +++ b/mercurial/helptext/config.txt @@ -913,8 +913,28 @@ Disabled by default. ``use-share-safe`` -Enable or disable the "share-safe" functionality, which enables shares -to read requirements and configuration of its source repository. +Enforce "safe" behaviors for all "share" that access this repository. + +With this feature "share" using this repository as source will: + +* read the source repositories configuration (`/.hg/hgrc`) +* read and use the source repositories "requirements" + (except the working copy specific one.) + +Without this feature, "share" using this repository as source will: + +* keep tracking the repository "requirements" in the share only, ignoring + the source one, possibly diverging from them. +* ignore source repository config. This can create problem, like silently + ignoring important hooks + +Beware that upgrading/downgrading a repository to use this feature will not +affect any of its share. The existing share will be upgraded and, by +default, Mercurial will refuse to interract with them until the mismatch is +resolve. See :hg:`help congfig share.safe-mismatch.source-safe` and +:hg:`help congfig share.safe-mismatch.source-not-safe` for details. + +Introduced in Mercurial 5.7. Disabled by default. To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9837: doc: relocate doc for `share.safe-mismatch.source-safe.warn`
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY The documentation for the option is now right after its parent configuration: `share.safe-mismatch.source-safe` REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9837 AFFECTED FILES mercurial/helptext/config.txt CHANGE DETAILS diff --git a/mercurial/helptext/config.txt b/mercurial/helptext/config.txt --- a/mercurial/helptext/config.txt +++ b/mercurial/helptext/config.txt @@ -1959,6 +1959,11 @@ tries to upgrade the share; if it fails, continue by respecting the share source setting +``safe-mismatch.source-safe.warn`` +Shows a warning on operations if the shared repository does not use +share-safe, but the source repository does. +(default: True) + ``safe-mismatch.source-not-safe`` Controls what happens when the shared repository uses the share-safe @@ -1977,12 +1982,6 @@ 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 a warning on operations if the shared repository does not use -share-safe, but the source repository does. -(default: True) - ``safe-mismatch.source-not-safe.warn`` Shows a warning on operations if the shared repository uses share-safe, but the source repository does not. To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9838: doc: remove the section about share-safe from its verbose gating
marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY The feature is no longer experimental. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9838 AFFECTED FILES mercurial/helptext/config.txt CHANGE DETAILS diff --git a/mercurial/helptext/config.txt b/mercurial/helptext/config.txt --- a/mercurial/helptext/config.txt +++ b/mercurial/helptext/config.txt @@ -147,14 +147,12 @@ merge tool configuration but packagers can also put other default configuration there. -.. container:: verbose - -On versions 5.7 and later, if share-safe functionality is enabled, -shares will read config file of share source too. -`` is read before reading ``. - -For configs which should not be shared, `` -should be used. +On versions 5.7 and later, if share-safe functionality is enabled, +shares will read config file of share source too. +`` is read before reading ``. + +For configs which should not be shared, `` +should be used. Syntax == To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel