##// END OF EJS Templates
revsetbenchmarks: use a more compact output format with a header...
revsetbenchmarks: use a more compact output format with a header We change the output from: revset #0: draft() 0) wall 0.011989 comb 0.010000 user 0.000000 sys 0.010000 (best of 177) 1) wall 0.012226 comb 0.010000 user 0.000000 sys 0.010000 (best of 193) 2) wall 0.011838 comb 0.020000 user 0.000000 sys 0.020000 (best of 208) to: revset #0: draft() wall comb user sys count 0) 0.012028 0.010000 0.000000 0.010000 170 1) 0.012218 0.010000 0.000000 0.010000 157 2) 0.012622 0.010000 0.000000 0.010000 189 This opens the road to more useful output.

File last commit:

r21243:8b5c039f default
r25534:43e5a681 default
Show More
debugshell.py
54 lines | 1.3 KiB | text/x-python | PythonLexer
# debugshell extension
"""a python shell with repo, changelog & manifest objects"""
import sys
import mercurial
import code
from mercurial import cmdutil
cmdtable = {}
command = cmdutil.command(cmdtable)
def pdb(ui, repo, msg, **opts):
objects = {
'mercurial': mercurial,
'repo': repo,
'cl': repo.changelog,
'mf': repo.manifest,
}
code.interact(msg, local=objects)
def ipdb(ui, repo, msg, **opts):
import IPython
cl = repo.changelog
mf = repo.manifest
cl, mf # use variables to appease pyflakes
IPython.embed()
@command('debugshell|dbsh', [])
def debugshell(ui, repo, **opts):
bannermsg = "loaded repo : %s\n" \
"using source: %s" % (repo.root,
mercurial.__path__[0])
pdbmap = {
'pdb' : 'code',
'ipdb' : 'IPython'
}
debugger = ui.config("ui", "debugger")
if not debugger:
debugger = 'pdb'
# if IPython doesn't exist, fallback to code.interact
try:
__import__(pdbmap[debugger])
except ImportError:
ui.warn("%s debugger specified but %s module was not found\n"
% (debugger, pdbmap[debugger]))
debugger = 'pdb'
getattr(sys.modules[__name__], debugger)(ui, repo, bannermsg, **opts)