##// END OF EJS Templates
py3: make contrib/debugshell.py work with Python 3...
Pulkit Goyal -
r41980:b10bbbe9 default
parent child Browse files
Show More
@@ -7,6 +7,7 b' import mercurial'
7 7 import sys
8 8 from mercurial import (
9 9 demandimport,
10 pycompat,
10 11 registrar,
11 12 )
12 13
@@ -32,10 +33,10 b' def ipdb(ui, repo, msg, **opts):'
32 33
33 34 IPython.embed()
34 35
35 @command('debugshell|dbsh', [])
36 @command(b'debugshell|dbsh', [])
36 37 def debugshell(ui, repo, **opts):
37 38 bannermsg = ("loaded repo : %s\n"
38 "using source: %s" % (repo.root,
39 "using source: %s" % (pycompat.sysstr(repo.root),
39 40 mercurial.__path__[0]))
40 41
41 42 pdbmap = {
@@ -43,17 +44,19 b' def debugshell(ui, repo, **opts):'
43 44 'ipdb' : 'IPython'
44 45 }
45 46
46 debugger = ui.config("ui", "debugger")
47 debugger = ui.config(b"ui", b"debugger")
47 48 if not debugger:
48 49 debugger = 'pdb'
50 else:
51 debugger = pycompat.sysstr(debugger)
49 52
50 53 # if IPython doesn't exist, fallback to code.interact
51 54 try:
52 55 with demandimport.deactivated():
53 56 __import__(pdbmap[debugger])
54 57 except ImportError:
55 ui.warn(("%s debugger specified but %s module was not found\n")
58 ui.warn((b"%s debugger specified but %s module was not found\n")
56 59 % (debugger, pdbmap[debugger]))
57 debugger = 'pdb'
60 debugger = b'pdb'
58 61
59 62 getattr(sys.modules[__name__], debugger)(ui, repo, bannermsg, **opts)
General Comments 0
You need to be logged in to leave comments. Login now