in hgext/configwizard/__init__.py [0:0]
def configwizard(ui, repo, statedir=None, **opts):
"""Ensure your Mercurial configuration is up to date."""
runsteps = set(wizardsteps)
# Mercurial <1.7 had a bug where monkeypatching ui.__class__
# during uisetup() doesn't work. So we do our own ui.hasconfig()
# here. Other uses of ui.hasconfig() are allowed, as they will
# have a properly monkeypatched ui.__class__.
if b"steps" in ui._data(False)._data.get(b"configwizard", {}):
runsteps = set(ui.configlist(b"configwizard", b"steps"))
hgversion = util.versiontuple(n=3)
# The point release version can be None for e.g. X.Y versions. Normalize
# to make tuple compares work.
if hgversion[2] is None:
hgversion = (hgversion[0], hgversion[1], 0)
if hgversion < MINIMUM_SUPPORTED_VERSION:
ui.warn(
VERSION_TOO_OLD
% (
hgversion[0],
hgversion[1],
MINIMUM_SUPPORTED_VERSION[0],
MINIMUM_SUPPORTED_VERSION[1],
)
)
raise error.Abort(b"upgrade Mercurial then run again")
update_evolve(ui)
if not runsteps:
# Don't prompt if we're asked to not do anything beyond the version
# check and evolve update.
return 0
uiprompt(ui, INITIAL_MESSAGE, default=b"<RETURN>")
with demandimport.deactivated():
# Mercurial 4.2 moved function from scmutil to rcutil.
try:
from mercurial.rcutil import userrcpath
except ImportError:
from mercurial.scmutil import userrcpath
configpaths = [p for p in userrcpath() if os.path.exists(p)]
path = configpaths[0] if configpaths else userrcpath()[0]
cw = configobjwrapper(path)
if b"hgversion" in runsteps:
if _checkhgversion(ui, hgversion):
return 1
if b"pyversion" in runsteps:
_checkpyversion(ui)
if b"username" in runsteps:
_checkusername(ui, cw)
if b"tweakdefaults" in runsteps:
_checktweakdefaults(ui, cw)
if b"diff" in runsteps:
_checkdiffsettings(ui, cw)
if b"historyediting" in runsteps:
_checkhistoryediting(ui, cw, hgversion)
if b"evolve" in runsteps:
_checkevolve(ui, cw)
if b"fsmonitor" in runsteps:
_checkfsmonitor(ui, cw, hgversion)
if b"blackbox" in runsteps:
_promptnativeextension(
ui,
cw,
b"blackbox",
b"Enable logging of commands to help diagnose bugs "
b"and performance problems",
)
if b"shelve" in runsteps:
_promptnativeextension(
ui, cw, b"shelve", b"Enable the shelve feature. Equivalent to git stash"
)
if b"security" in runsteps:
_checksecurity(ui, cw, hgversion)
if b"firefoxtree" in runsteps:
_promptvctextension(ui, cw, b"firefoxtree", FIREFOXTREE_INFO)
if b"clang-format" in runsteps:
_promptvctextension(ui, cw, b"clang-format", CLANG_FORMAT_INFO)
if b"js-format" in runsteps:
_promptvctextension(ui, cw, b"js-format", JS_FORMAT_INFO)
if b"wip" in runsteps:
_checkwip(ui, cw)
if b"smartannotate" in runsteps:
_checksmartannotate(ui, cw)
if b"pushtotry" in runsteps:
_promptvctextension(ui, cw, b"push-to-try", PUSHTOTRY_INFO)
if b"multiplevct" in runsteps:
_checkmultiplevct(ui, cw)
if b"configchange" in runsteps:
_handleconfigchange(ui, cw)
if b"permissions" in runsteps:
_checkpermissions(ui, cw)
return 0