##// END OF EJS Templates
narrow: don't hexify paths and double-hexify known nodes on wire (BC)...
narrow: don't hexify paths and double-hexify known nodes on wire (BC) It isn't obvious, but wireprototypes.encodelist() is meant only for binary nodeids. So when we used it for encoding hex nodeids and paths, the encoded result was surprising and hard to read. This patch changes the encoding to make the list of paths a comma-separated list and the list of common nodes to be a encodelist()-encoded list of binary nodeids (so the result is just singly-hexified nodeids). This is clearly a breaking change, but the feature is experimental and we're not aware of anyone running a server using this command yet. Differential Revision: https://phab.mercurial-scm.org/D6851

File last commit:

r41980:b10bbbe9 default
r43214:c2676b5a default
Show More
debugshell.py
62 lines | 1.5 KiB | text/x-python | PythonLexer
Vishakh H
contrib: add debugshell extension
r11633 # debugshell extension
"""a python shell with repo, changelog & manifest objects"""
Pulkit Goyal
debugshell: use absolute_import
r28476 from __future__ import absolute_import
import code
Vishakh H
contrib: add debugshell extension
r11633 import mercurial
Pulkit Goyal
debugshell: use absolute_import
r28476 import sys
Gregory Szorc
debugshell: disable demand importer when importing debugger...
r27721 from mercurial import (
demandimport,
Pulkit Goyal
py3: make contrib/debugshell.py work with Python 3...
r41980 pycompat,
Yuya Nishihara
registrar: move cmdutil.command to registrar module (API)...
r32337 registrar,
Gregory Szorc
debugshell: disable demand importer when importing debugger...
r27721 )
Gregory Szorc
debugshell: declare command using decorator
r21243
cmdtable = {}
Yuya Nishihara
registrar: move cmdutil.command to registrar module (API)...
r32337 command = registrar.command(cmdtable)
Vishakh H
contrib: add debugshell extension
r11633
Sean Farley
debugshell: abstract out pdb code.interact
r19771 def pdb(ui, repo, msg, **opts):
Vishakh H
contrib: add debugshell extension
r11633 objects = {
'mercurial': mercurial,
'repo': repo,
'cl': repo.changelog,
Durham Goode
manifest: remove last uses of repo.manifest...
r30375 'mf': repo.manifestlog,
Vishakh H
contrib: add debugshell extension
r11633 }
Sean Farley
debugshell: abstract out pdb code.interact
r19771
code.interact(msg, local=objects)
Sean Farley
debugshell: add function to embed ipython
r19772 def ipdb(ui, repo, msg, **opts):
import IPython
cl = repo.changelog
Durham Goode
manifest: remove last uses of repo.manifest...
r30375 mf = repo.manifestlog
Matt Mackall
debugshell: appease pyflakes
r19794 cl, mf # use variables to appease pyflakes
Sean Farley
debugshell: add function to embed ipython
r19772
IPython.embed()
Pulkit Goyal
py3: make contrib/debugshell.py work with Python 3...
r41980 @command(b'debugshell|dbsh', [])
Sean Farley
debugshell: abstract out pdb code.interact
r19771 def debugshell(ui, repo, **opts):
Augie Fackler
cleanup: use () to wrap long lines instead of \...
r41925 bannermsg = ("loaded repo : %s\n"
Pulkit Goyal
py3: make contrib/debugshell.py work with Python 3...
r41980 "using source: %s" % (pycompat.sysstr(repo.root),
Augie Fackler
cleanup: use () to wrap long lines instead of \...
r41925 mercurial.__path__[0]))
Sean Farley
debugshell: abstract out pdb code.interact
r19771
Sean Farley
debugshell: check ui.debugger for which debugger to use
r19773 pdbmap = {
'pdb' : 'code',
'ipdb' : 'IPython'
}
Pulkit Goyal
py3: make contrib/debugshell.py work with Python 3...
r41980 debugger = ui.config(b"ui", b"debugger")
Sean Farley
debugshell: check ui.debugger for which debugger to use
r19773 if not debugger:
debugger = 'pdb'
Pulkit Goyal
py3: make contrib/debugshell.py work with Python 3...
r41980 else:
debugger = pycompat.sysstr(debugger)
Sean Farley
debugshell: check ui.debugger for which debugger to use
r19773
# if IPython doesn't exist, fallback to code.interact
try:
Gregory Szorc
debugshell: disable demand importer when importing debugger...
r27721 with demandimport.deactivated():
__import__(pdbmap[debugger])
Sean Farley
debugshell: check ui.debugger for which debugger to use
r19773 except ImportError:
Pulkit Goyal
py3: make contrib/debugshell.py work with Python 3...
r41980 ui.warn((b"%s debugger specified but %s module was not found\n")
Sean Farley
debugshell: check ui.debugger for which debugger to use
r19773 % (debugger, pdbmap[debugger]))
Pulkit Goyal
py3: make contrib/debugshell.py work with Python 3...
r41980 debugger = b'pdb'
Sean Farley
debugshell: check ui.debugger for which debugger to use
r19773
getattr(sys.modules[__name__], debugger)(ui, repo, bannermsg, **opts)