Mercurial > hg
view mercurial/rewriteutil.py @ 39491:4ca7a67c94c8
sparse-revlog: add a test checking revlog deltas for a churning file
The test repository contains 5000 revisions and is therefore slow to build:
five minutes with CHG, over fifteen minutes without. It is too slow to build
during the test. Bundling all content produce a sizeable result, 20BM, too
large to be committed. Instead, we commit a script to build the expected
bundle and the test checks if the bundle is available. Any run of the script
will produce the same repository content, using resulting in the same hashes.
Using smaller repositories was tried, however, it misses most of the cases we
are planning to improve. Having them in a 5000 repository is already nice, we
usually see these case in repositories in the order of magnitude of one
million revisions.
This test will be very useful to check various changes strategy for building
delta to store in a sparse-revlog.
In this series we will focus our attention on the following metrics:
The ones that will impact the final storage performance (size, space):
* size of the revlog data file (".hg/store/data/*.d")
* chain length info
The ones that describe the deltas patterns:
* number of snapshot revision (and their level)
* size taken by snapshot revision (and their level)
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Mon, 10 Sep 2018 09:08:24 -0700 |
parents | 490df753894d |
children | 8c6329fa6038 |
line wrap: on
line source
# rewriteutil.py - utility functions for rewriting changesets # # Copyright 2017 Octobus <contact@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. from __future__ import absolute_import from .i18n import _ from . import ( error, node, obsolete, revset, ) def precheck(repo, revs, action='rewrite'): """check if revs can be rewritten action is used to control the error message. Make sure this function is called after taking the lock. """ if node.nullrev in revs: msg = _("cannot %s null changeset") % (action) hint = _("no changeset checked out") raise error.Abort(msg, hint=hint) publicrevs = repo.revs('%ld and public()', revs) if len(repo[None].parents()) > 1: raise error.Abort(_("cannot %s while merging") % action) if publicrevs: msg = _("cannot %s public changesets") % (action) hint = _("see 'hg help phases' for details") raise error.Abort(msg, hint=hint) newunstable = disallowednewunstable(repo, revs) if newunstable: raise error.Abort(_("cannot %s changeset with children") % action) def disallowednewunstable(repo, revs): """Checks whether editing the revs will create new unstable changesets and are we allowed to create them. To allow new unstable changesets, set the config: `experimental.evolution.allowunstable=True` """ allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt) if allowunstable: return revset.baseset() return repo.revs("(%ld::) - %ld", revs, revs)