Show More
@@ -7,6 +7,7 b' import mercurial' | |||||
7 | import sys |
|
7 | import sys | |
8 | from mercurial import ( |
|
8 | from mercurial import ( | |
9 | demandimport, |
|
9 | demandimport, | |
|
10 | pycompat, | |||
10 | registrar, |
|
11 | registrar, | |
11 | ) |
|
12 | ) | |
12 |
|
13 | |||
@@ -32,10 +33,10 b' def ipdb(ui, repo, msg, **opts):' | |||||
32 |
|
33 | |||
33 | IPython.embed() |
|
34 | IPython.embed() | |
34 |
|
35 | |||
35 | @command('debugshell|dbsh', []) |
|
36 | @command(b'debugshell|dbsh', []) | |
36 | def debugshell(ui, repo, **opts): |
|
37 | def debugshell(ui, repo, **opts): | |
37 | bannermsg = ("loaded repo : %s\n" |
|
38 | bannermsg = ("loaded repo : %s\n" | |
38 | "using source: %s" % (repo.root, |
|
39 | "using source: %s" % (pycompat.sysstr(repo.root), | |
39 | mercurial.__path__[0])) |
|
40 | mercurial.__path__[0])) | |
40 |
|
41 | |||
41 | pdbmap = { |
|
42 | pdbmap = { | |
@@ -43,17 +44,19 b' def debugshell(ui, repo, **opts):' | |||||
43 | 'ipdb' : 'IPython' |
|
44 | 'ipdb' : 'IPython' | |
44 | } |
|
45 | } | |
45 |
|
46 | |||
46 | debugger = ui.config("ui", "debugger") |
|
47 | debugger = ui.config(b"ui", b"debugger") | |
47 | if not debugger: |
|
48 | if not debugger: | |
48 | debugger = 'pdb' |
|
49 | debugger = 'pdb' | |
|
50 | else: | |||
|
51 | debugger = pycompat.sysstr(debugger) | |||
49 |
|
52 | |||
50 | # if IPython doesn't exist, fallback to code.interact |
|
53 | # if IPython doesn't exist, fallback to code.interact | |
51 | try: |
|
54 | try: | |
52 | with demandimport.deactivated(): |
|
55 | with demandimport.deactivated(): | |
53 | __import__(pdbmap[debugger]) |
|
56 | __import__(pdbmap[debugger]) | |
54 | except ImportError: |
|
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 | % (debugger, pdbmap[debugger])) |
|
59 | % (debugger, pdbmap[debugger])) | |
57 | debugger = 'pdb' |
|
60 | debugger = b'pdb' | |
58 |
|
61 | |||
59 | getattr(sys.modules[__name__], debugger)(ui, repo, bannermsg, **opts) |
|
62 | getattr(sys.modules[__name__], debugger)(ui, repo, bannermsg, **opts) |
General Comments 0
You need to be logged in to leave comments.
Login now