[PATCH 2 of 2] dispatch: add ability to specify a custom pdb module as a debugger
sean.michael.farley at gmail.com
Wed Aug 7 15:45:54 CDT 2013
kbullock+mercurial at ringworld.org writes:
> On 13 Jul 2013, at 5:16 PM, Sean Farley wrote:
>> # HG changeset patch
>> # User Sean Farley <sean.michael.farley at gmail.com>
>> # Date 1373752000 18000
>> # Sat Jul 13 16:46:40 2013 -0500
>> # Node ID 42113a6e12bc864e044bacb57407a68a97d7f1da
>> # Parent 15a903bca551318cd0c3f42484374a8b8acd08e5
>> dispatch: add ability to specify a custom pdb module as a debugger
>> This adds the ability to specify a config option, ui.debugger, to a custom pdb
>> module, such as ipdb, and have mercurial use that as its debugger.
>> diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
>> --- a/mercurial/dispatch.py
>> +++ b/mercurial/dispatch.py
>> @@ -97,24 +97,49 @@
>> # copy configs that were passed on the cmdline (--config) to
>> # the repo ui
>> for cfg in cfgs:
>> + debugger = ui.config("ui", "debugger")
>> + if not debugger:
>> + debugger = 'pdb'
>> + try:
>> + ipdb = __import__(debugger)
>> + except ImportError:
>> + ipdb = pdb
> Can't you just:
> debugmod = __import__(debugger)
> except ImportError:
> debugmod = pdb
> and adjust your dispatch tables appropriately from there, so that they can use 'ipdb' as the key directly where appropriate?
I think I see what you're saying here but I didn't use 'ipdb' as a key
because I wanted the config option to remain flexible. The code, as I
have it written, will work with 'debugger = foo' as long as the foo
module has the same functions as pdb.
Anyways, I've already sent V2 so I guess I'll look there for feedback.
More information about the Mercurial-devel