~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testrevision.py

bugfix from Aaron Bentley - bzrlib.graph.max_distance had an off-by-1 error

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
from bzrlib.selftest import TestCaseInTempDir
18
 
 
 
18
from bzrlib.revision import is_ancestor, MultipleRevisionSources
 
19
from bzrlib.revision import combined_graph
19
20
 
20
21
def make_branches():
21
22
    from bzrlib.branch import Branch
48
49
class TestIsAncestor(TestCaseInTempDir):
49
50
    def test_is_ancestor(self):
50
51
        """Test checking whether a revision is an ancestor of another revision"""
51
 
        from bzrlib.revision import is_ancestor, MultipleRevisionSources
52
52
        from bzrlib.errors import NoSuchRevision
53
53
        br1, br2 = make_branches()
54
54
        revisions = br1.revision_history()
212
212
        self.assertEqual(common_ancestor(revisions_2[6], revisions[5], sources),
213
213
                          revisions[4])
214
214
 
 
215
    def test_combined(self):
 
216
        """combined_graph
 
217
        Ensure it's not order-sensitive
 
218
        """
 
219
        br1, br2 = make_branches()
 
220
        source = MultipleRevisionSources(br1, br2)
 
221
        combined_1 = combined_graph(br1.last_patch(), br2.last_patch(), source)
 
222
        combined_2 = combined_graph(br2.last_patch(), br1.last_patch(), source)
 
223
        assert combined_1[1] == combined_2[1]
 
224
        assert combined_1[2] == combined_2[2]
 
225
        assert combined_1[3] == combined_2[3]
 
226
        assert combined_1 == combined_2