Mercurial > hgsubversion
changeset 277:3848a7f9b983
push: Add a test that demonstrates base-text detection works
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Fri, 24 Apr 2009 20:31:17 -0500 |
parents | b45bae16be32 |
children | 60acc38eac96 |
files | tests/test_push_command.py tests/test_util.py |
diffstat | 2 files changed, 21 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test_push_command.py +++ b/tests/test_push_command.py @@ -8,6 +8,7 @@ from mercurial import hg from mercurial import node from mercurial import ui from mercurial import revlog +from mercurial import util as hgutil import wrappers import test_util @@ -404,6 +405,23 @@ class PushTests(test_util.TestBase): self.assertEqual(tip.parents()[0]['alpha'].flags(), expected_flags) self.assertEqual(tip['alpha'].flags(), '') + def test_push_outdated_base_text(self): + self.test_push_two_revs() + changes = [('adding_file', 'adding_file', 'different_content', ), + ] + self.commitchanges(changes, parent='tip') + self.pushrevisions() + changes = [('adding_file', 'adding_file', + 'even_more different_content', ), + ] + self.commitchanges(changes, parent=3) + try: + self.pushrevisions() + assert False, 'This should have aborted!' + except hgutil.Abort, e: + self.assertEqual(e.args[0], + 'Base text was out of date, maybe rebase?') + def suite(): test_classes = [PushTests, PushOverSvnserveTests]
--- a/tests/test_util.py +++ b/tests/test_util.py @@ -140,7 +140,7 @@ class TestBase(unittest.TestCase): entries.sort() return entries - def commitchanges(self, changes): + def commitchanges(self, changes, parent='tip'): """Commit changes to mercurial directory 'changes' is a sequence of tuples (source, dest, data). It can look @@ -153,7 +153,7 @@ class TestBase(unittest.TestCase): - (source, None, None) to remove source. """ repo = self.repo - parentctx = repo['tip'] + parentctx = repo[parent] changed, removed = [], [] for source, dest, newdata in changes: @@ -187,7 +187,7 @@ class TestBase(unittest.TestCase): '2008-10-07 20:59:48 -0500') nodeid = repo.commitctx(ctx) repo = self.repo - hg.update(repo, nodeid) + hg.clean(repo, nodeid) return nodeid def assertchanges(self, changes, ctx):