mirror of
https://github.com/facebook/sapling.git
synced 2024-10-12 01:39:21 +03:00
e75b9fc1b1
Summary: This commit moves most of the stuff in hgext3rd and related tests to hg-crew/hgext and hg-crew/test respectively. The things that are not moved are the ones which require some more complex imports. Depends on D6675309 Test Plan: - tests are failing at this commit, fixes are in the following commits Reviewers: #sourcecontrol Differential Revision: https://phabricator.intern.facebook.com/D6675329
54 lines
1.5 KiB
Python
54 lines
1.5 KiB
Python
# configwarn.py - warn unsupported user configs
|
|
#
|
|
# Copyright 2017 Facebook, Inc.
|
|
#
|
|
# This software may be used and distributed according to the terms of the
|
|
# GNU General Public License version 2 or any later version.
|
|
|
|
"""warn unsupported user configs
|
|
|
|
Config::
|
|
|
|
[configwarn]
|
|
# Config names that are supposed to be set by system config and not
|
|
# overrided by user config.
|
|
systemconfigs = diff.git, extensions.hggit
|
|
"""
|
|
|
|
from __future__ import absolute_import
|
|
|
|
from mercurial.i18n import _
|
|
from mercurial import (
|
|
rcutil,
|
|
registrar,
|
|
)
|
|
|
|
configtable = {}
|
|
configitem = registrar.configitem(configtable)
|
|
|
|
configitem('configwarn', 'systemconfigs', default=[])
|
|
|
|
def reposetup(ui, repo):
|
|
# use reposetup, not uisetup to work better with chg and it checks reporc.
|
|
if not repo.local():
|
|
return
|
|
|
|
nonsystempaths = set(rcutil.userrcpath() + [repo.vfs.join('hgrc')])
|
|
systemconfigs = ui.configlist('configwarn', 'systemconfigs')
|
|
|
|
for configname in systemconfigs:
|
|
if '.' not in configname:
|
|
continue
|
|
|
|
section, name = configname.split('.', 1)
|
|
source = ui.configsource(section, name)
|
|
|
|
if ':' not in source:
|
|
continue
|
|
|
|
path, lineno = source.split(':', 1)
|
|
if path in nonsystempaths and lineno.isdigit():
|
|
ui.warn(_('warning: overriding config %s is unsupported (hint: '
|
|
'remove line %s from %s to resolve this issue)\n')
|
|
% (configname, lineno, path))
|