comparison tests/test_template_keywords.py @ 684:8687c5aa4f35

Add svnrev, svnpath and svnuuid keyword. Based on a patch by Wagner Bruna posted here: http://groups.google.com/group/hgsubversion/browse_thread/thread/b3913337e021ab18
author Andi Albrecht <albrecht.andi@gmail.com>
date Thu, 02 Sep 2010 21:30:17 +0200
parents
children d424bd1ac647
comparison
equal deleted inserted replaced
683:4589d48c9e1b 684:8687c5aa4f35
1 import test_util
2
3 import unittest
4
5 from mercurial import commands
6 from mercurial import ui
7
8
9 class CapturingUI(ui.ui):
10
11 def __init__(self, *args, **kwds):
12 super(CapturingUI, self).__init__(*args, **kwds)
13 self._output = ""
14
15 def write(self, msg, *args, **kwds):
16 self._output += msg
17
18
19 class TestLogKeywords(test_util.TestBase):
20
21 def test_svn_keywords(self):
22 defaults = {'date': None, 'rev': None, 'user': None}
23 repo = self._load_fixture_and_fetch('two_revs.svndump')
24 ui = CapturingUI()
25 commands.log(ui, repo, template='{rev}:{svnrev} ', **defaults)
26 self.assertEqual(ui._output, '0:2 1:3 ')
27 ui = CapturingUI()
28 commands.log(ui, repo, template='{rev}:{svnpath} ', **defaults)
29 self.assertEqual(ui._output, '0:/trunk 1:/trunk ')
30 ui = CapturingUI()
31 commands.log(ui, repo, template='{rev}:{svnuuid} ', **defaults)
32 self.assertEqual(ui._output,
33 ('0:df2126f7-00ab-4d49-b42c-7e981dde0bcf '
34 '1:df2126f7-00ab-4d49-b42c-7e981dde0bcf '))
35
36
37 def suite():
38 all = [unittest.TestLoader().loadTestsFromTestCase(TestLogKeywords),]
39 return unittest.TestSuite(all)