Mercurial > hgsubversion
diff tests/test_utility_commands.py @ 256:7932d098cb5f
Refactor commands to wrap their hg equivalent adding a --svn flag where sane.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Fri, 10 Apr 2009 18:47:18 -0500 |
parents | c3d5c4ae9c7c |
children | ffccf0080e54 |
line wrap: on
line diff
--- a/tests/test_utility_commands.py +++ b/tests/test_utility_commands.py @@ -65,18 +65,34 @@ class UtilityTests(test_util.TestBase): {'branch': 'localbranch', }) new = self.repo.commitctx(ctx) hg.update(self.repo, new) - utility_commands.parent(u, self.repo, self.wc_path) - self.assert_(node.hex(self.repo['the_branch'].node())[:8] in - u.stream.getvalue()) - self.assert_('the_branch' in u.stream.getvalue()) - self.assert_('r5' in u.stream.getvalue()) + utility_commands.parent(lambda x, y: None, u, self.repo, svn=True) + self.assertEqual(u.stream.getvalue(), + 'changeset: 3:4e256962fc5d\n' + 'branch: the_branch\n' + 'user: durin@df2126f7-00ab-4d49-b42c-7e981dde0bcf\n' + 'date: Wed Oct 08 01:39:05 2008 +0000\n' + 'summary: add delta on the branch\n\n') + hg.update(self.repo, 'default') + # Make sure styles work u = ui.ui() - utility_commands.parent(u, self.repo, self.wc_path) - self.assert_(node.hex(self.repo['default'].node())[:8] in - u.stream.getvalue()) - self.assert_('trunk' in u.stream.getvalue()) - self.assert_('r6' in u.stream.getvalue()) + utility_commands.parent(lambda x, y: None, u, self.repo, svn=True, style='compact') + self.assertEqual(u.stream.getvalue(), + '4:1 1083037b18d8 2008-10-08 01:39 +0000 durin\n' + ' Add gamma on trunk.\n\n') + # custom templates too + u = ui.ui() + utility_commands.parent(lambda x, y: None, u, self.repo, svn=True, template='{node}\n') + self.assertEqual(u.stream.getvalue(), '1083037b18d85cd84fa211c5adbaeff0fea2cd9f\n') + + u = ui.ui() + utility_commands.parent(lambda x, y: None, u, self.repo, svn=True) + self.assertEqual(u.stream.getvalue(), + 'changeset: 4:1083037b18d8\n' + 'parent: 1:c95251e0dd04\n' + 'user: durin@df2126f7-00ab-4d49-b42c-7e981dde0bcf\n' + 'date: Wed Oct 08 01:39:29 2008 +0000\n' + 'summary: Add gamma on trunk.\n\n') def test_outgoing_output(self): self._load_fixture_and_fetch('two_heads.svndump') @@ -98,14 +114,21 @@ class UtilityTests(test_util.TestBase): {'branch': 'localbranch', }) new = self.repo.commitctx(ctx) hg.update(self.repo, new) - utility_commands.outgoing(u, self.repo, self.wc_path) + utility_commands.outgoing(lambda x,y,z: None, u, self.repo, svn=True) self.assert_(node.hex(self.repo['localbranch'].node())[:8] in u.stream.getvalue()) - self.assert_('testy' in u.stream.getvalue()) + self.assertEqual(u.stream.getvalue(), ('changeset: 5:6de15430fa20\n' + 'branch: localbranch\n' + 'tag: tip\n' + 'parent: 3:4e256962fc5d\n' + 'user: testy\n' + 'date: Sun Dec 21 16:32:00 2008 -0500\n' + 'summary: automated test\n' + '\n')) hg.update(self.repo, 'default') u = ui.ui() - utility_commands.outgoing(u, self.repo, self.wc_path) - self.assertEqual(u.stream.getvalue(), 'No outgoing changes found.\n') + utility_commands.outgoing(lambda x,y,z: None, u, self.repo, svn=True) + self.assertEqual(u.stream.getvalue(), 'no changes found\n') def test_url_output(self): self._load_fixture_and_fetch('two_revs.svndump') @@ -185,7 +208,7 @@ class UtilityTests(test_util.TestBase): args=[test_util.fileurl(self.repo_path)], authors=author_path) self.assertEqual(open(author_path).read(), 'Augie=\nevil=\n') - + def suite(): all = [unittest.TestLoader().loadTestsFromTestCase(UtilityTests),