~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_branch/test_reconcile.py

  • Committer: Patch Queue Manager
  • Date: 2016-01-15 09:21:49 UTC
  • mfrom: (6606.2.1 autodoc-unicode)
  • Revision ID: pqm@pqm.ubuntu.com-20160115092149-z5f4sfq3jvaz0enb
(vila) Fix autodoc runner when LANG=C. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Tests for branch implementations - test reconcile() functionality"""
18
18
 
19
19
from bzrlib import errors, reconcile
 
20
from bzrlib.branch import BzrBranch
 
21
from bzrlib.symbol_versioning import deprecated_in
20
22
from bzrlib.tests.per_branch import TestCaseWithBranch
 
23
from bzrlib.tests import TestNotApplicable
21
24
 
22
25
 
23
26
class TestBranchReconcile(TestCaseWithBranch):
24
27
 
25
28
    def test_reconcile_fixes_invalid_revhistory(self):
 
29
        if not isinstance(self.branch_format, BzrBranch):
 
30
            raise TestNotApplicable("test only applies to bzr formats")
26
31
        # Different formats have different ways of handling invalid revision
27
32
        # histories, so the setup portion is customized
28
33
        tree = self.make_branch_and_tree('test')
42
47
        r5 = tree.commit('five')
43
48
        # Now, try to set an invalid history
44
49
        try:
45
 
            tree.branch.set_revision_history([r1, r2b, r5])
 
50
            self.applyDeprecated(deprecated_in((2, 4, 0)),
 
51
                tree.branch.set_revision_history, [r1, r2b, r5])
46
52
            if tree.branch.last_revision_info() != (3, r5):
47
53
                # RemoteBranch silently corrects an impossible revision
48
54
                # history given to set_revision_history.  It can be tricked
73
79
 
74
80
    def test_reconcile_handles_ghosts_in_revhistory(self):
75
81
        tree = self.make_branch_and_tree('test')
 
82
        if not tree.branch.repository._format.supports_ghosts:
 
83
            raise TestNotApplicable("repository format does not support ghosts")
76
84
        tree.set_parent_ids(["spooky"], allow_leftmost_as_ghost=True)
77
85
        r1 = tree.commit('one')
78
86
        r2 = tree.commit('two')
79
87
        tree.branch.set_last_revision_info(2, r2)
80
88
 
81
89
        reconciler = tree.branch.reconcile()
82
 
        self.assertEquals([r1, r2], tree.branch.revision_history())
 
90
        self.assertEquals(r2, tree.branch.last_revision())