view contrib/debugshell.py @ 21099:12c7cea6235c

contrib: remove mergetools.hgrc premerge=False for Beyond Compare and Araxis There can be good reasons to disable premerge no matter which merge tool is used. Most tools will do just fine without premerge and handle the simple merges more or less automatic and silent. We _could_ thus disable premerge for most tools. But without premerge, the merge tool will be launched for each file - that makes it a slow and expensive process to perform big simple merges. It is thus better to consistently stick to the default premerge=True. The mergetools.hgrc configuration for most tools implicitly use the default premerge=True but Araxis and the Linux entry for Beyond Compare had premerge=False. These lines has been removed. These settings were introduced by 6b354a763617 without further explanation of why they should be good. (We have seen some crashes on Windows with Araxis where a merge failed after a lot of Araxis flashing. I haven't been able to reproduce it and do not know exactly what happened. Enabling premerge avoids the problems.)
author Mads Kiilerich <madski@unity3d.com>
date Thu, 17 Apr 2014 14:54:46 +0200
parents cccc44304b2c
children 8b5c039f2b4f
line wrap: on
line source

# debugshell extension
"""a python shell with repo, changelog & manifest objects"""

import sys
import mercurial
import code

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()

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)

cmdtable = {
    "debugshell|dbsh": (debugshell, [])
}