test_util: add helper to draw repo with graphlog extension

Priceless when debugging comprehensive tests
This commit is contained in:
Patrick Mezard 2010-01-29 23:36:14 +01:00
parent 514c41a837
commit e4a25fdc50

View File

@ -19,6 +19,7 @@ from mercurial import hg
from mercurial import i18n
from mercurial import node
from mercurial import ui
from mercurial import extensions
from hgsubversion import util
@ -280,3 +281,21 @@ class TestBase(unittest.TestCase):
if dest != source:
copy = ctx[dest].renamed()
self.assertEqual(copy[0], source)
def draw(self, repo):
"""Helper function displaying a repository graph, especially
useful when debugging comprehensive tests.
"""
# Could be more elegant, but it works with stock hg
_ui = ui.ui()
_ui.setconfig('extensions', 'graphlog', '')
extensions.loadall(_ui)
graphlog = extensions.find('graphlog')
templ = """\
changeset: {rev}:{node|short}
branch: {branches}
summary: {desc|firstline}
files: {files}
"""
graphlog.graphlog(_ui, repo, rev=None, template=templ)