##// END OF EJS Templates
phases: large rewrite on retract boundary...
phases: large rewrite on retract boundary The new code is still pure Python, so we still have room to going significantly faster. However its complexity of the complex part is `O(|[min_new_draft, tip]|)` instead of `O(|[min_draft, tip]|` which should help tremendously one repository with old draft (like mercurial-devel or mozilla-try). This is especially useful as the most common "retract boundary" operation happens when we commit/rewrite new drafts or when we push new draft to a non-publishing server. In this case, the smallest new_revs is very close to the tip and there is very few work to do. A few smaller optimisation could be done for these cases and will be introduced in later changesets. We still have iterate over large sets of roots, but this is already a great improvement for a very small amount of work. We gather information on the affected changeset as we go as we can put it to use in the next changesets. This extra data collection might slowdown the `register_new` case a bit, however for register_new, it should not really matters. The set of new nodes is either small, so the impact is negligible, or the set of new nodes is large, and the amount of work to do to had them will dominate the overhead the collecting information in `changed_revs`. As this new code compute the changes on the fly, it unlock other interesting improvement to be done in later changeset.

File last commit:

r52222:398a105b default
r52302:2f39c7ae default
Show More
__init__.py
82 lines | 2.3 KiB | text/x-python | PythonLexer
revlog: introduce an explicit NodeMap class for pure code...
r43924 # mercurial.revlogutils -- basic utilities for revlog
#
# Copyright 2019 Pierre-Yves David <pierre-yves.david@octobus.net>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
revlog: move `offset_type` to `revlogutils`...
r48186
revlog: move `revisioninfo` in `revlogutils`...
r48191 from ..thirdparty import attr
revlog: move `offset_type` to `revlogutils`...
r48186 from ..interfaces import repository
revlog: add a function to build index entry tuple...
r48187 # See mercurial.revlogutils.constants for doc
COMP_MODE_INLINE = 2
rank: add a "rank" value to the revlog-entry tuple...
r49330 RANK_UNKNOWN = -1
revlog: add a function to build index entry tuple...
r48187
revlog: move `offset_type` to `revlogutils`...
r48186
def offset_type(offset, type):
if (type & ~repository.REVISION_FLAGS_KNOWN) != 0:
raise ValueError(b'unknown revlog index flags: %d' % type)
return int(int(offset) << 16 | type)
revlog: add a function to build index entry tuple...
r48187
def entry(
data_offset,
data_compressed_length,
data_delta_base,
link_rev,
parent_rev_1,
parent_rev_2,
node_id,
flags=0,
data_uncompressed_length=-1,
data_compression_mode=COMP_MODE_INLINE,
sidedata_offset=0,
sidedata_compressed_length=0,
sidedata_compression_mode=COMP_MODE_INLINE,
rank: add a "rank" value to the revlog-entry tuple...
r49330 rank=RANK_UNKNOWN,
revlog: add a function to build index entry tuple...
r48187 ):
"""Build one entry from symbolic name
This is useful to abstract the actual detail of how we build the entry
tuple for caller who don't care about it.
This should always be called using keyword arguments. Some arguments have
default value, this match the value used by index version that does not store such data.
"""
return (
offset_type(data_offset, flags),
data_compressed_length,
data_uncompressed_length,
data_delta_base,
link_rev,
parent_rev_1,
parent_rev_2,
node_id,
sidedata_offset,
sidedata_compressed_length,
data_compression_mode,
sidedata_compression_mode,
rank: add a "rank" value to the revlog-entry tuple...
r49330 rank,
revlog: add a function to build index entry tuple...
r48187 )
revlog: move `revisioninfo` in `revlogutils`...
r48191
@attr.s(slots=True, frozen=True)
Gregory Szorc
py3: use class X: instead of class X(object):...
r49801 class revisioninfo:
revlog: move `revisioninfo` in `revlogutils`...
r48191 """Information about a revision that allows building its fulltext
node: expected hash of the revision
delta-find: clarify that revisioninfo.p1/p2 constains nodeid...
r52222 p1, p2: parent revs of the revision (as node)
revlog: move `revisioninfo` in `revlogutils`...
r48191 btext: built text cache consisting of a one-element list
find-delta: pass the cache-delta usage policy alongside the cache-delta...
r50572 cachedelta: (baserev, uncompressed_delta, usage_mode) or None
revlog: move `revisioninfo` in `revlogutils`...
r48191 flags: flags associated to the revision storage
One of btext[0] or cachedelta must be set.
"""
node = attr.ib()
p1 = attr.ib()
p2 = attr.ib()
btext = attr.ib()
textlen = attr.ib()
cachedelta = attr.ib()
flags = attr.ib()