annotate tests/test_template_keywords.py @ 685:d4781cff2adc

subversion.rst: fix 'typo' in help for the hgsubversion.defaultauthors option.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Fri, 03 Sep 2010 00:35:47 +0200
parents 8687c5aa4f35
children d424bd1ac647
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
684
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
1 import test_util
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
2
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
3 import unittest
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
4
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
5 from mercurial import commands
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
6 from mercurial import ui
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
7
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
8
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
9 class CapturingUI(ui.ui):
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
10
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
11 def __init__(self, *args, **kwds):
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
12 super(CapturingUI, self).__init__(*args, **kwds)
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
13 self._output = ""
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
14
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
15 def write(self, msg, *args, **kwds):
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
16 self._output += msg
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
17
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
18
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
19 class TestLogKeywords(test_util.TestBase):
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
20
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
21 def test_svn_keywords(self):
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
22 defaults = {'date': None, 'rev': None, 'user': None}
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
23 repo = self._load_fixture_and_fetch('two_revs.svndump')
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
24 ui = CapturingUI()
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
25 commands.log(ui, repo, template='{rev}:{svnrev} ', **defaults)
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
26 self.assertEqual(ui._output, '0:2 1:3 ')
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
27 ui = CapturingUI()
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
28 commands.log(ui, repo, template='{rev}:{svnpath} ', **defaults)
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
29 self.assertEqual(ui._output, '0:/trunk 1:/trunk ')
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
30 ui = CapturingUI()
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
31 commands.log(ui, repo, template='{rev}:{svnuuid} ', **defaults)
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
32 self.assertEqual(ui._output,
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
33 ('0:df2126f7-00ab-4d49-b42c-7e981dde0bcf '
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
34 '1:df2126f7-00ab-4d49-b42c-7e981dde0bcf '))
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
35
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
36
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
37 def suite():
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
38 all = [unittest.TestLoader().loadTestsFromTestCase(TestLogKeywords),]
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
39 return unittest.TestSuite(all)