Mercurial > hg
view contrib/debugshell.py @ 49779:7d6c8943353a stable
hg: show the correct message when cloning an LFS repo with extension disabled
The `extensions._disabledpaths()` doesn't handle fetching help from `__index__`,
so it returns an empty dictionary of paths. That means None is always returned
from `extensions.disabled_help()` when embedding resources inside the pyoxidizer
or py2exe binary, regardless of the arg or if is an external extension stored in
the filesystem. And that means wrongly telling the user with an explicitly
disabled LFS extension that it will be enabled locally upon cloning from an LFS
remote. That causes test-lfs-serve.t:295 to fail.
This effectively reverts most of the rest of 843418dc0b1b, while keeping the
help text change in place (which was specifically identified as a problem).
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Mon, 05 Dec 2022 15:14:33 -0500 |
parents | 6000f5b25c9b |
children |
line wrap: on
line source
# 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)