##// END OF EJS Templates
contrib: add a hint if the Windows dependency MSI is already installed...
contrib: add a hint if the Windows dependency MSI is already installed In the past, I've gotten confused when the script failed on seemingly random python installs (and thus the py3.8 install was commented out from the last time this happened to me, which has been reverted here). This particular error code means the package was already installed. For python, it means the major and minor version are the same, but the micro version may differ. In practice, ignoring the python installation failure will cause the pip installation that happens next to fail, because python.exe for that version is somewhere else on the system. This could probably be fixed by running py.exe with the major and minor version, but that is skipped during the install for some reason. I didn't feel like over complicating this though, and at least there's a better hint when the problem occurs. Differential Revision: https://phab.mercurial-scm.org/D12560

File last commit:

r49730:6000f5b2 default
r49955:246ee748 default
Show More
debugshell.py
64 lines | 1.4 KiB | text/x-python | PythonLexer
# debugshell extension
"""a python shell with repo, changelog & manifest objects"""
import code
import mercurial
import sys
from mercurial import (
demandimport,
pycompat,
registrar,
)
cmdtable = {}
command = registrar.command(cmdtable)
def pdb(ui, repo, msg, **opts):
objects = {
'mercurial': mercurial,
'repo': repo,
'cl': repo.changelog,
'mf': repo.manifestlog,
}
code.interact(msg, local=objects)
def ipdb(ui, repo, msg, **opts):
import IPython
cl = repo.changelog
mf = repo.manifestlog
cl, mf # use variables to appease pyflakes
IPython.embed()
@command(b'debugshell|dbsh', [])
def debugshell(ui, repo, **opts):
bannermsg = "loaded repo : %s\n" "using source: %s" % (
pycompat.sysstr(repo.root),
mercurial.__path__[0],
)
pdbmap = {'pdb': 'code', 'ipdb': 'IPython'}
debugger = ui.config(b"ui", b"debugger")
if not debugger:
debugger = 'pdb'
else:
debugger = pycompat.sysstr(debugger)
# if IPython doesn't exist, fallback to code.interact
try:
with demandimport.deactivated():
__import__(pdbmap[debugger])
except ImportError:
ui.warnnoi18n(
b"%s debugger specified but %s module was not found\n"
% (debugger, pdbmap[debugger])
)
debugger = b'pdb'
getattr(sys.modules[__name__], debugger)(ui, repo, bannermsg, **opts)