Mercurial > hgsubversion
comparison tests/test_push_command.py @ 1048:903c9c9dfe6a
tests: count revisions explicitly
The assumption that len(repo) corresponds to the count of actual,
usable revision in the repository fails in presence of hidden
revisions. Instead, we use a dedicated method in test_util, and change
all tests to use this for obtaining repository length -- just to be
safe...
| author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
|---|---|
| date | Fri, 09 Aug 2013 11:22:50 -0400 |
| parents | d741f536f23a |
| children | 2d7398fffd0d |
comparison
equal
deleted
inserted
replaced
| 1047:3092b3c109a8 | 1048:903c9c9dfe6a |
|---|---|
| 576 ''' | 576 ''' |
| 577 Verify that a push of a nontip node, keeps the tip child | 577 Verify that a push of a nontip node, keeps the tip child |
| 578 on top of the pushed commit. | 578 on top of the pushed commit. |
| 579 ''' | 579 ''' |
| 580 | 580 |
| 581 oldlen = len(self.repo) | 581 oldlen = test_util.repolen(self.repo) |
| 582 oldtiphash = self.repo['default'].node() | 582 oldtiphash = self.repo['default'].node() |
| 583 | 583 |
| 584 changes = [('gamma', 'gamma', 'sometext')] | 584 changes = [('gamma', 'gamma', 'sometext')] |
| 585 newhash1 = self.commitchanges(changes) | 585 newhash1 = self.commitchanges(changes) |
| 586 | 586 |
| 589 | 589 |
| 590 # push only the first commit | 590 # push only the first commit |
| 591 repo = self.repo | 591 repo = self.repo |
| 592 hg.update(repo, newhash1) | 592 hg.update(repo, newhash1) |
| 593 commands.push(repo.ui, repo) | 593 commands.push(repo.ui, repo) |
| 594 self.assertEqual(len(self.repo), oldlen + 2) | 594 self.assertEqual(test_util.repolen(self.repo), oldlen + 2) |
| 595 | 595 |
| 596 # verify that the first commit is pushed, and the second is not | 596 # verify that the first commit is pushed, and the second is not |
| 597 commit2 = self.repo['tip'] | 597 commit2 = self.repo['tip'] |
| 598 self.assertEqual(commit2.files(), ['delta', ]) | 598 self.assertEqual(commit2.files(), ['delta', ]) |
| 599 self.assertEqual(util.getsvnrev(commit2), None) | 599 self.assertEqual(util.getsvnrev(commit2), None) |
| 607 ''' | 607 ''' |
| 608 Push performs a rebase if two commits touch the same file. | 608 Push performs a rebase if two commits touch the same file. |
| 609 This test verifies that code path works. | 609 This test verifies that code path works. |
| 610 ''' | 610 ''' |
| 611 | 611 |
| 612 oldlen = len(self.repo) | 612 oldlen = test_util.repolen(self.repo) |
| 613 oldtiphash = self.repo['default'].node() | 613 oldtiphash = self.repo['default'].node() |
| 614 | 614 |
| 615 changes = [('gamma', 'gamma', 'sometext')] | 615 changes = [('gamma', 'gamma', 'sometext')] |
| 616 newhash = self.commitchanges(changes) | 616 newhash = self.commitchanges(changes) |
| 617 changes = [('gamma', 'gamma', 'sometext\n moretext'), | 617 changes = [('gamma', 'gamma', 'sometext\n moretext'), |
| 620 newhash = self.commitchanges(changes) | 620 newhash = self.commitchanges(changes) |
| 621 | 621 |
| 622 repo = self.repo | 622 repo = self.repo |
| 623 hg.update(repo, newhash) | 623 hg.update(repo, newhash) |
| 624 commands.push(repo.ui, repo) | 624 commands.push(repo.ui, repo) |
| 625 self.assertEqual(len(self.repo), oldlen + 2) | 625 self.assertEqual(test_util.repolen(self.repo), oldlen + 2) |
| 626 | 626 |
| 627 # verify that both commits are pushed | 627 # verify that both commits are pushed |
| 628 commit1 = self.repo['tip'] | 628 commit1 = self.repo['tip'] |
| 629 self.assertEqual(commit1.files(), ['delta', 'gamma']) | 629 self.assertEqual(commit1.files(), ['delta', 'gamma']) |
| 630 | 630 |
