annotate tests/test_template_keywords.py @ 699:181ec1929b2a

tests_urls: activate a test that was previously overlooked
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Tue, 14 Sep 2010 19:24:55 +0200
parents d424bd1ac647
children cb32d90f915e
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
687
d424bd1ac647 templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents: 684
diff changeset
7 try:
d424bd1ac647 templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents: 684
diff changeset
8 from mercurial import templatekw
d424bd1ac647 templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents: 684
diff changeset
9 templatekw.keywords
d424bd1ac647 templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents: 684
diff changeset
10 except ImportError:
d424bd1ac647 templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents: 684
diff changeset
11 templatekw = None
684
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
12
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
13
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
14 class CapturingUI(ui.ui):
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
15
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
16 def __init__(self, *args, **kwds):
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
17 super(CapturingUI, self).__init__(*args, **kwds)
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
18 self._output = ""
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
19
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
20 def write(self, msg, *args, **kwds):
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
21 self._output += msg
8687c5aa4f35 Add svnrev, svnpath and svnuuid keyword.
Andi Albrecht <albrecht.andi@gmail.com>
parents:
diff changeset
22
687
d424bd1ac647 templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents: 684
diff changeset
23 if templatekw:
d424bd1ac647 templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents: 684
diff changeset
24 class TestLogKeywords(test_util.TestBase):
d424bd1ac647 templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents: 684
diff changeset
25
d424bd1ac647 templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents: 684
diff changeset
26 def test_svn_keywords(self):
d424bd1ac647 templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents: 684
diff changeset
27 defaults = {'date': None, 'rev': None, 'user': None}
d424bd1ac647 templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents: 684
diff changeset
28 repo = self._load_fixture_and_fetch('two_revs.svndump')
d424bd1ac647 templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents: 684
diff changeset
29 ui = CapturingUI()
d424bd1ac647 templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents: 684
diff changeset
30 commands.log(ui, repo, template='{rev}:{svnrev} ', **defaults)
d424bd1ac647 templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents: 684
diff changeset
31 self.assertEqual(ui._output, '0:2 1:3 ')
d424bd1ac647 templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents: 684
diff changeset
32 ui = CapturingUI()
d424bd1ac647 templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents: 684
diff changeset
33 commands.log(ui, repo, template='{rev}:{svnpath} ', **defaults)
d424bd1ac647 templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents: 684
diff changeset
34 self.assertEqual(ui._output, '0:/trunk 1:/trunk ')
d424bd1ac647 templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents: 684
diff changeset
35 ui = CapturingUI()
d424bd1ac647 templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents: 684
diff changeset
36 commands.log(ui, repo, template='{rev}:{svnuuid} ', **defaults)
d424bd1ac647 templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents: 684
diff changeset
37 self.assertEqual(ui._output,
d424bd1ac647 templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents: 684
diff changeset
38 ('0:df2126f7-00ab-4d49-b42c-7e981dde0bcf '
d424bd1ac647 templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents: 684
diff changeset
39 '1:df2126f7-00ab-4d49-b42c-7e981dde0bcf '))
d424bd1ac647 templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents: 684
diff changeset
40
d424bd1ac647 templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents: 684
diff changeset
41
d424bd1ac647 templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents: 684
diff changeset
42 def suite():
d424bd1ac647 templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents: 684
diff changeset
43 all = [unittest.TestLoader().loadTestsFromTestCase(TestLogKeywords),]
d424bd1ac647 templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents: 684
diff changeset
44 return unittest.TestSuite(all)
d424bd1ac647 templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents: 684
diff changeset
45 else:
d424bd1ac647 templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents: 684
diff changeset
46 def suite():
d424bd1ac647 templatekw: restore compatibility with hg < 1.5
Augie Fackler <durin42@gmail.com>
parents: 684
diff changeset
47 return unittest.TestSuite([])