Mercurial > hgsubversion
comparison tests/test_util.py @ 527:2be9f14bd23f
test_util: add helper to draw repo with graphlog extension
Priceless when debugging comprehensive tests
| author | Patrick Mezard <pmezard@gmail.com> |
|---|---|
| date | Fri, 29 Jan 2010 23:36:14 +0100 |
| parents | 60bf433647e7 |
| children | cf4fe45bf8fd |
comparison
equal
deleted
inserted
replaced
| 526:3c2f3444ffba | 527:2be9f14bd23f |
|---|---|
| 17 from mercurial import context | 17 from mercurial import context |
| 18 from mercurial import hg | 18 from mercurial import hg |
| 19 from mercurial import i18n | 19 from mercurial import i18n |
| 20 from mercurial import node | 20 from mercurial import node |
| 21 from mercurial import ui | 21 from mercurial import ui |
| 22 from mercurial import extensions | |
| 22 | 23 |
| 23 from hgsubversion import util | 24 from hgsubversion import util |
| 24 | 25 |
| 25 # Documentation for Subprocess.Popen() says: | 26 # Documentation for Subprocess.Popen() says: |
| 26 # "Note that on Windows, you cannot set close_fds to true and | 27 # "Note that on Windows, you cannot set close_fds to true and |
| 278 data = ctx.parents()[0][source].data() | 279 data = ctx.parents()[0][source].data() |
| 279 self.assertEqual(ctx[dest].data(), data) | 280 self.assertEqual(ctx[dest].data(), data) |
| 280 if dest != source: | 281 if dest != source: |
| 281 copy = ctx[dest].renamed() | 282 copy = ctx[dest].renamed() |
| 282 self.assertEqual(copy[0], source) | 283 self.assertEqual(copy[0], source) |
| 284 | |
| 285 def draw(self, repo): | |
| 286 """Helper function displaying a repository graph, especially | |
| 287 useful when debugging comprehensive tests. | |
| 288 """ | |
| 289 # Could be more elegant, but it works with stock hg | |
| 290 _ui = ui.ui() | |
| 291 _ui.setconfig('extensions', 'graphlog', '') | |
| 292 extensions.loadall(_ui) | |
| 293 graphlog = extensions.find('graphlog') | |
| 294 templ = """\ | |
| 295 changeset: {rev}:{node|short} | |
| 296 branch: {branches} | |
| 297 summary: {desc|firstline} | |
| 298 files: {files} | |
| 299 | |
| 300 """ | |
| 301 graphlog.graphlog(_ui, repo, rev=None, template=templ) |
