##// END OF EJS Templates
config: pass both relative and absolute paths to `include` callback...
config: pass both relative and absolute paths to `include` callback The `include` callback is responsible for loading configs from `%include` statements. The callback currently gets passed the absolute path [1] to the config to read. That is created by joining the dirname of the file that contains the `%include` statement. For PyOxidizer support, I'm trying to reduce dependence on paths. This patch helps with that by passing the relative path found in the `%include` statement (but with username expansion, etc.) to the `include` callback. It also turns out that the existing callers can easily adapt to using the relative path. Coming patches will clean that up and then we'll remove the absolute path from the callback. [1] The "absolute path" bit is a bit of a lie -- it's going to be an absolute path if the path that was passed into `config.parse()` was absolute. Differential Revision: https://phab.mercurial-scm.org/D8790

File last commit:

r44418:f91834ec default
r45768:f7f142d7 default
Show More
__init__.py
78 lines | 2.4 KiB | text/x-python | PythonLexer
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 # __init__.py - narrowhg extension
#
# Copyright 2017 Google, Inc.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
'''create clones which fetch history data for subset of files (EXPERIMENTAL)'''
from __future__ import absolute_import
from mercurial import (
localrepo,
registrar,
Pulkit Goyal
interfaces: create a new folder for interfaces and move repository.py in it...
r43078 )
Augie Fackler
formatting: blacken the codebase...
r43346 from mercurial.interfaces import repository
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096
from . import (
narrowbundle2,
narrowcommands,
narrowrepo,
narrowtemplates,
narrowwirepeer,
)
Matt Harbison
narrow: move `testedwith` after module imports...
r44418 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
# extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
# be specifying the version(s) of Mercurial they are tested with, or
# leave the attribute unspecified.
testedwith = b'ships-with-hg-core'
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 configtable = {}
configitem = registrar.configitem(configtable)
# Narrowhg *has* support for serving ellipsis nodes (which are used at
# least by Google's internal server), but that support is pretty
# fragile and has a lot of problems on real-world repositories that
# have complex graph topologies. This could probably be corrected, but
# absent someone needing the full support for ellipsis nodes in
# repositories with merges, it's unlikely this work will get done. As
# of this writining in late 2017, all repositories large enough for
# ellipsis nodes to be a hard requirement also enforce strictly linear
# history for other scaling reasons.
Augie Fackler
formatting: blacken the codebase...
r43346 configitem(
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 b'experimental',
b'narrowservebrokenellipses',
Augie Fackler
formatting: blacken the codebase...
r43346 default=False,
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 alias=[(b'narrow', b'serveellipses')],
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 )
# Export the commands table for Mercurial to see.
cmdtable = narrowcommands.table
Augie Fackler
formatting: blacken the codebase...
r43346
Gregory Szorc
narrow: use featuresetupfuncs...
r37154 def featuresetup(ui, features):
Martin von Zweigbergk
narrow: move requirement constant from changegroup to repository...
r38871 features.add(repository.NARROW_REQUIREMENT)
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096
Augie Fackler
formatting: blacken the codebase...
r43346
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 def uisetup(ui):
"""Wraps user-facing mercurial commands with narrow-aware versions."""
Gregory Szorc
narrow: use featuresetupfuncs...
r37154 localrepo.featuresetupfuncs.add(featuresetup)
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 narrowbundle2.setup()
narrowcommands.setup()
narrowwirepeer.uisetup()
Augie Fackler
formatting: blacken the codebase...
r43346
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 def reposetup(ui, repo):
"""Wraps local repositories with narrow repo support."""
Martin von Zweigbergk
narrow: use repo.local() instead of isinstance()...
r37203 if not repo.local():
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 return
Augie Fackler
formatting: byteify all mercurial/ and hgext/ string literals...
r43347 repo.ui.setconfig(b'experimental', b'narrow', True, b'narrow-ext')
Martin von Zweigbergk
narrow: move requirement constant from changegroup to repository...
r38871 if repository.NARROW_REQUIREMENT in repo.requirements:
Kyle Lippincott
narrow: only wrap dirstate functions once, instead of per-reposetup...
r38142 narrowrepo.wraprepo(repo)
Augie Fackler
narrow: import experimental extension from narrowhg revision cb51d673e9c5...
r36096 narrowwirepeer.reposetup(repo)
Augie Fackler
formatting: blacken the codebase...
r43346
Augie Fackler
narrowtemplates: update to use registrar mechanism...
r36108 templatekeyword = narrowtemplates.templatekeyword
revsetpredicate = narrowtemplates.revsetpredicate