comparison tests/test_template_keywords.py @ 707:cb32d90f915e

templatekw: clean up implementation & test; add help. The core logic is cleaned up and moved to the wrappers module. The test made to test that it works with original Mercurial changesets, is cleaned up so that it can be more easily extended in the future. Finally, documentation is added for the feature.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Wed, 29 Sep 2010 18:04:26 +0200
parents d424bd1ac647
children af817963897e
comparison
equal deleted inserted replaced
706:1f1a3a6730c1 707:cb32d90f915e
18 self._output = "" 18 self._output = ""
19 19
20 def write(self, msg, *args, **kwds): 20 def write(self, msg, *args, **kwds):
21 self._output += msg 21 self._output += msg
22 22
23 if templatekw: 23 class TestLogKeywords(test_util.TestBase):
24 class TestLogKeywords(test_util.TestBase): 24 if templatekw:
25
26 def test_svn_keywords(self): 25 def test_svn_keywords(self):
27 defaults = {'date': None, 'rev': None, 'user': None} 26 defaults = {'date': None, 'rev': None, 'user': None}
28 repo = self._load_fixture_and_fetch('two_revs.svndump') 27 repo = self._load_fixture_and_fetch('two_revs.svndump')
28
29 # we want one commit that isn't from Subversion
30 self.commitchanges([('foo', 'foo', 'frobnicate\n')])
31
29 ui = CapturingUI() 32 ui = CapturingUI()
30 commands.log(ui, repo, template='{rev}:{svnrev} ', **defaults) 33 commands.log(ui, repo, template='{rev}:{svnrev} ', **defaults)
31 self.assertEqual(ui._output, '0:2 1:3 ') 34 self.assertEqual(ui._output, '0:2 1:3 2: ')
32 ui = CapturingUI() 35 ui = CapturingUI()
33 commands.log(ui, repo, template='{rev}:{svnpath} ', **defaults) 36 commands.log(ui, repo, template='{rev}:{svnpath} ', **defaults)
34 self.assertEqual(ui._output, '0:/trunk 1:/trunk ') 37 self.assertEqual(ui._output, '0:/trunk 1:/trunk 2: ')
35 ui = CapturingUI() 38 ui = CapturingUI()
36 commands.log(ui, repo, template='{rev}:{svnuuid} ', **defaults) 39 commands.log(ui, repo, template='{rev}:{svnuuid} ', **defaults)
37 self.assertEqual(ui._output, 40 self.assertEqual(ui._output,
38 ('0:df2126f7-00ab-4d49-b42c-7e981dde0bcf ' 41 ('0:df2126f7-00ab-4d49-b42c-7e981dde0bcf '
39 '1:df2126f7-00ab-4d49-b42c-7e981dde0bcf ')) 42 '1:df2126f7-00ab-4d49-b42c-7e981dde0bcf '
43 '2: '))
40 44
41 45
42 def suite(): 46 def suite():
43 all = [unittest.TestLoader().loadTestsFromTestCase(TestLogKeywords),] 47 all = [unittest.TestLoader().loadTestsFromTestCase(TestLogKeywords),]
44 return unittest.TestSuite(all) 48 return unittest.TestSuite(all)
45 else:
46 def suite():
47 return unittest.TestSuite([])