Mercurial > hg
view hgext/largefiles/storefactory.py @ 49672:e92de86cf4f8
emitrevision: consider ancestors revision to emit as available base
This should make more delta base valid. This notably affects:
* case where we skipped some parent with empty delta to directly delta against
an ancestors
* case where an intermediate snapshots is stored.
This change means we could sent largish intermediate snapshots over the wire.
However this is actually a sub goal here. Sending snapshots over the wire means
the client have a high odd of simply storing the pre-computed delta instead of
doing a lengthy process that will… end up doing the same intermediate snapshot.
In addition the overall size of snapshot (or any level) is "only" some or the
overall delta size. (0.17% for my mercurial clone, 20% for my clone of Mozilla
try). So Sending them other the wire is unlikely to change large impact on the
bandwidth used.
If we decide that minimising the bandwidth is an explicit goal, we should
introduce new logic to filter-out snapshot as delta. The current code has no
notion explicite of snapshot so far, they just tended to fall into the wobbly
filtering options.
In some cases, this patch can yield large improvement to the bundling time:
### data-env-vars.name = mozilla-try-2019-02-18-zstd-sparse-revlog
# benchmark.name = perf-bundle
# benchmark.variants.revs = last-100000
before: 68.787066 seconds
after: 47.552677 seconds (-30.87%)
That translate to large improvement to the pull time :
### data-env-vars.name = mozilla-try-2019-02-18-zstd-sparse-revlog
# benchmark.name = pull
# benchmark.variants.issue6528 = disabled
# benchmark.variants.revs = last-100000
before: 142.186625 seconds
after: 75.897745 seconds (-46.62%)
No significant negative impact have been observed.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sat, 12 Nov 2022 00:18:41 +0100 |
parents | 6000f5b25c9b |
children | 8d0a220caee5 |
line wrap: on
line source
# This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. import re from mercurial.i18n import _ from mercurial.pycompat import getattr from mercurial import ( error, hg, util, ) from mercurial.utils import ( urlutil, ) from . import ( lfutil, localstore, wirestore, ) # During clone this function is passed the src's ui object # but it needs the dest's ui object so it can read out of # the config file. Use repo.ui instead. def openstore(repo=None, remote=None, put=False, ui=None): if ui is None: ui = repo.ui if not remote: lfpullsource = getattr(repo, 'lfpullsource', None) if put: path = urlutil.get_unique_push_path( b'lfpullsource', repo, ui, lfpullsource ) else: path, _branches = urlutil.get_unique_pull_path( b'lfpullsource', repo, ui, lfpullsource ) # XXX we should not explicitly pass b'default', as this will result in # b'default' being returned if no `paths.default` was defined. We # should explicitely handle the lack of value instead. if repo is None: path, _branches = urlutil.get_unique_pull_path( b'lfs', repo, ui, b'default' ) remote = hg.peer(repo or ui, {}, path) elif path == b'default-push' or path == b'default': remote = repo else: path, _branches = urlutil.parseurl(path) remote = hg.peer(repo or ui, {}, path) # The path could be a scheme so use Mercurial's normal functionality # to resolve the scheme to a repository and use its path path = util.safehasattr(remote, b'url') and remote.url() or remote.path match = _scheme_re.match(path) if not match: # regular filesystem path scheme = b'file' else: scheme = match.group(1) try: storeproviders = _storeprovider[scheme] except KeyError: raise error.Abort(_(b'unsupported URL scheme %r') % scheme) for classobj in storeproviders: try: return classobj(ui, repo, remote) except lfutil.storeprotonotcapable: pass raise error.Abort( _(b'%s does not appear to be a largefile store') % urlutil.hidepassword(path) ) _storeprovider = { b'file': [localstore.localstore], b'http': [wirestore.wirestore], b'https': [wirestore.wirestore], b'ssh': [wirestore.wirestore], } _scheme_re = re.compile(br'^([a-zA-Z0-9+-.]+)://') def getlfile(ui, hash): return util.chunkbuffer(openstore(ui=ui)._get(hash))