comparison tests/test_push_command.py @ 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 ffccf0080e54
children 75f082b5897e
comparison
equal deleted inserted replaced
276:b45bae16be32 277:3848a7f9b983
6 from mercurial import context 6 from mercurial import context
7 from mercurial import hg 7 from mercurial import hg
8 from mercurial import node 8 from mercurial import node
9 from mercurial import ui 9 from mercurial import ui
10 from mercurial import revlog 10 from mercurial import revlog
11 from mercurial import util as hgutil
11 12
12 import wrappers 13 import wrappers
13 import test_util 14 import test_util
14 import time 15 import time
15 16
402 self.assertNotEqual(tip.node(), new_hash) 403 self.assertNotEqual(tip.node(), new_hash)
403 self.assertEqual(tip['alpha'].data(), 'bar') 404 self.assertEqual(tip['alpha'].data(), 'bar')
404 self.assertEqual(tip.parents()[0]['alpha'].flags(), expected_flags) 405 self.assertEqual(tip.parents()[0]['alpha'].flags(), expected_flags)
405 self.assertEqual(tip['alpha'].flags(), '') 406 self.assertEqual(tip['alpha'].flags(), '')
406 407
408 def test_push_outdated_base_text(self):
409 self.test_push_two_revs()
410 changes = [('adding_file', 'adding_file', 'different_content', ),
411 ]
412 self.commitchanges(changes, parent='tip')
413 self.pushrevisions()
414 changes = [('adding_file', 'adding_file',
415 'even_more different_content', ),
416 ]
417 self.commitchanges(changes, parent=3)
418 try:
419 self.pushrevisions()
420 assert False, 'This should have aborted!'
421 except hgutil.Abort, e:
422 self.assertEqual(e.args[0],
423 'Base text was out of date, maybe rebase?')
424
407 425
408 def suite(): 426 def suite():
409 test_classes = [PushTests, PushOverSvnserveTests] 427 test_classes = [PushTests, PushOverSvnserveTests]
410 tests = [] 428 tests = []
411 # This is the quickest hack I could come up with to load all the tests from 429 # This is the quickest hack I could come up with to load all the tests from