Mercurial > hgsubversion
diff tests/test_template_keywords.py @ 722:aa24148a7454
uisetup: add fromsvn() and svnrev() revsets.
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Tue, 05 Oct 2010 16:26:19 +0200 |
parents | af817963897e |
children | 4baa41e0f8ad |
line wrap: on
line diff
--- a/tests/test_template_keywords.py +++ b/tests/test_template_keywords.py @@ -3,6 +3,7 @@ import test_util import unittest from mercurial import commands +from mercurial import error from mercurial import ui try: from mercurial import templatekw @@ -10,6 +11,11 @@ try: except ImportError: templatekw = None +try: + from mercurial import revset + revset.methods +except ImportError: + revset = None class CapturingUI(ui.ui): @@ -43,6 +49,36 @@ class TestLogKeywords(test_util.TestBase '1:df2126f7-00ab-4d49-b42c-7e981dde0bcf ' '2: ')) + if templatekw and revset: + def test_svn_revsets(self): + repo = self._load_fixture_and_fetch('two_revs.svndump') + + # we want one commit that isn't from Subversion + self.commitchanges([('foo', 'foo', 'frobnicate\n')]) + + defaults = {'date': None, 'rev': ['fromsvn()'], 'user': None} + + ui = CapturingUI() + commands.log(ui, repo, template='{rev}:{svnrev} ', **defaults) + self.assertEqual(ui._output, '0:2 1:3 ') + + defaults = {'date': None, 'rev': ['svnrev(2)'], 'user': None} + + ui = CapturingUI() + commands.log(ui, repo, template='{rev}:{svnrev} ', **defaults) + self.assertEqual(ui._output, '0:2 ') + + defaults = {'date': None, 'rev': ['fromsvn(1)'], 'user': None} + + self.assertRaises(error.ParseError, + commands.log, self.ui(), repo, + template='{rev}:{svnrev} ', **defaults) + + defaults = {'date': None, 'rev': ['svnrev(1, 2)'], 'user': None} + + self.assertRaises(error.ParseError, + commands.log, self.ui(), repo, + template='{rev}:{svnrev} ', **defaults) def suite(): all = [unittest.TestLoader().loadTestsFromTestCase(TestLogKeywords),]