Mercurial > hgsubversion
comparison 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 |
comparison
equal
deleted
inserted
replaced
255:246aaefb1cc0 | 256:7932d098cb5f |
---|---|
63 'testy', | 63 'testy', |
64 '2008-12-21 16:32:00 -0500', | 64 '2008-12-21 16:32:00 -0500', |
65 {'branch': 'localbranch', }) | 65 {'branch': 'localbranch', }) |
66 new = self.repo.commitctx(ctx) | 66 new = self.repo.commitctx(ctx) |
67 hg.update(self.repo, new) | 67 hg.update(self.repo, new) |
68 utility_commands.parent(u, self.repo, self.wc_path) | 68 utility_commands.parent(lambda x, y: None, u, self.repo, svn=True) |
69 self.assert_(node.hex(self.repo['the_branch'].node())[:8] in | 69 self.assertEqual(u.stream.getvalue(), |
70 u.stream.getvalue()) | 70 'changeset: 3:4e256962fc5d\n' |
71 self.assert_('the_branch' in u.stream.getvalue()) | 71 'branch: the_branch\n' |
72 self.assert_('r5' in u.stream.getvalue()) | 72 'user: durin@df2126f7-00ab-4d49-b42c-7e981dde0bcf\n' |
73 'date: Wed Oct 08 01:39:05 2008 +0000\n' | |
74 'summary: add delta on the branch\n\n') | |
75 | |
73 hg.update(self.repo, 'default') | 76 hg.update(self.repo, 'default') |
74 u = ui.ui() | 77 # Make sure styles work |
75 utility_commands.parent(u, self.repo, self.wc_path) | 78 u = ui.ui() |
76 self.assert_(node.hex(self.repo['default'].node())[:8] in | 79 utility_commands.parent(lambda x, y: None, u, self.repo, svn=True, style='compact') |
77 u.stream.getvalue()) | 80 self.assertEqual(u.stream.getvalue(), |
78 self.assert_('trunk' in u.stream.getvalue()) | 81 '4:1 1083037b18d8 2008-10-08 01:39 +0000 durin\n' |
79 self.assert_('r6' in u.stream.getvalue()) | 82 ' Add gamma on trunk.\n\n') |
83 # custom templates too | |
84 u = ui.ui() | |
85 utility_commands.parent(lambda x, y: None, u, self.repo, svn=True, template='{node}\n') | |
86 self.assertEqual(u.stream.getvalue(), '1083037b18d85cd84fa211c5adbaeff0fea2cd9f\n') | |
87 | |
88 u = ui.ui() | |
89 utility_commands.parent(lambda x, y: None, u, self.repo, svn=True) | |
90 self.assertEqual(u.stream.getvalue(), | |
91 'changeset: 4:1083037b18d8\n' | |
92 'parent: 1:c95251e0dd04\n' | |
93 'user: durin@df2126f7-00ab-4d49-b42c-7e981dde0bcf\n' | |
94 'date: Wed Oct 08 01:39:29 2008 +0000\n' | |
95 'summary: Add gamma on trunk.\n\n') | |
80 | 96 |
81 def test_outgoing_output(self): | 97 def test_outgoing_output(self): |
82 self._load_fixture_and_fetch('two_heads.svndump') | 98 self._load_fixture_and_fetch('two_heads.svndump') |
83 u = ui.ui() | 99 u = ui.ui() |
84 parents = (self.repo['the_branch'].node(), revlog.nullid, ) | 100 parents = (self.repo['the_branch'].node(), revlog.nullid, ) |
96 'testy', | 112 'testy', |
97 '2008-12-21 16:32:00 -0500', | 113 '2008-12-21 16:32:00 -0500', |
98 {'branch': 'localbranch', }) | 114 {'branch': 'localbranch', }) |
99 new = self.repo.commitctx(ctx) | 115 new = self.repo.commitctx(ctx) |
100 hg.update(self.repo, new) | 116 hg.update(self.repo, new) |
101 utility_commands.outgoing(u, self.repo, self.wc_path) | 117 utility_commands.outgoing(lambda x,y,z: None, u, self.repo, svn=True) |
102 self.assert_(node.hex(self.repo['localbranch'].node())[:8] in | 118 self.assert_(node.hex(self.repo['localbranch'].node())[:8] in |
103 u.stream.getvalue()) | 119 u.stream.getvalue()) |
104 self.assert_('testy' in u.stream.getvalue()) | 120 self.assertEqual(u.stream.getvalue(), ('changeset: 5:6de15430fa20\n' |
121 'branch: localbranch\n' | |
122 'tag: tip\n' | |
123 'parent: 3:4e256962fc5d\n' | |
124 'user: testy\n' | |
125 'date: Sun Dec 21 16:32:00 2008 -0500\n' | |
126 'summary: automated test\n' | |
127 '\n')) | |
105 hg.update(self.repo, 'default') | 128 hg.update(self.repo, 'default') |
106 u = ui.ui() | 129 u = ui.ui() |
107 utility_commands.outgoing(u, self.repo, self.wc_path) | 130 utility_commands.outgoing(lambda x,y,z: None, u, self.repo, svn=True) |
108 self.assertEqual(u.stream.getvalue(), 'No outgoing changes found.\n') | 131 self.assertEqual(u.stream.getvalue(), 'no changes found\n') |
109 | 132 |
110 def test_url_output(self): | 133 def test_url_output(self): |
111 self._load_fixture_and_fetch('two_revs.svndump') | 134 self._load_fixture_and_fetch('two_revs.svndump') |
112 hg.update(self.repo, 'tip') | 135 hg.update(self.repo, 'tip') |
113 u = ui.ui() | 136 u = ui.ui() |
183 author_path = os.path.join(self.repo_path, 'authors') | 206 author_path = os.path.join(self.repo_path, 'authors') |
184 utility_commands.listauthors(ui.ui(), | 207 utility_commands.listauthors(ui.ui(), |
185 args=[test_util.fileurl(self.repo_path)], | 208 args=[test_util.fileurl(self.repo_path)], |
186 authors=author_path) | 209 authors=author_path) |
187 self.assertEqual(open(author_path).read(), 'Augie=\nevil=\n') | 210 self.assertEqual(open(author_path).read(), 'Augie=\nevil=\n') |
188 | 211 |
189 | 212 |
190 def suite(): | 213 def suite(): |
191 all = [unittest.TestLoader().loadTestsFromTestCase(UtilityTests), | 214 all = [unittest.TestLoader().loadTestsFromTestCase(UtilityTests), |
192 ] | 215 ] |
193 return unittest.TestSuite(all) | 216 return unittest.TestSuite(all) |