changeset 1177:8caf1226adec stable 1.6.1

test_template_keywords: handle changeset output ordering change in hg 3.0 hg change 69402eb72115 caused commands.log to produce a more sensible ordering for this log invocation (namely, it now matches the graphlog ordering). In order to portably test across hg versions, use graphlog output to test these keyword functions.
author Augie Fackler <raf@durin42.com>
date Fri, 02 May 2014 09:27:31 -0400
parents 97a064e2075d
children 41ff2014d125
files tests/test_template_keywords.py
diffstat 1 files changed, 15 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test_template_keywords.py
+++ b/tests/test_template_keywords.py
@@ -30,24 +30,27 @@ class CapturingUI(ui.ui):
 class TestLogKeywords(test_util.TestBase):
     @test_util.requiresmodule(templatekw)
     def test_svn_keywords(self):
-        defaults = {'date': None, 'rev': None, 'user': None}
+        defaults = {'date': None, 'rev': None, 'user': None, 'graph': True}
         repo = self._load_fixture_and_fetch('two_revs.svndump')
 
         # we want one commit that isn't from Subversion
         self.commitchanges([('foo', 'foo', 'frobnicate\n')])
 
         ui = CapturingUI()
-        commands.log(ui, repo, template='{rev}:{svnrev} ', **defaults)
-        self.assertEqual(ui._output, '0:2 1:3 2: ')
-        ui = CapturingUI()
-        commands.log(ui, repo, template='{rev}:{svnpath} ', **defaults)
-        self.assertEqual(ui._output, '0:/trunk 1:/trunk 2: ')
-        ui = CapturingUI()
-        commands.log(ui, repo, template='{rev}:{svnuuid} ', **defaults)
-        self.assertEqual(ui._output,
-                         ('0:df2126f7-00ab-4d49-b42c-7e981dde0bcf '
-                          '1:df2126f7-00ab-4d49-b42c-7e981dde0bcf '
-                          '2: '))
+        commands.log(ui, repo, template=('  rev: {rev} svnrev:{svnrev} '
+                                         'svnpath:{svnpath} svnuuid:{svnuuid}\n'),
+                     **defaults)
+        print ui._output
+        self.assertEqual(ui._output.strip(), '''
+  rev: 2 svnrev: svnpath: svnuuid:
+@
+|
+  rev: 1 svnrev:3 svnpath:/trunk svnuuid:df2126f7-00ab-4d49-b42c-7e981dde0bcf
+o
+|
+  rev: 0 svnrev:2 svnpath:/trunk svnuuid:df2126f7-00ab-4d49-b42c-7e981dde0bcf
+o
+'''.strip())
 
     @test_util.requiresmodule(revset)
     @test_util.requiresmodule(templatekw)