~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testrevision.py

  • Committer: Aaron Bentley
  • Date: 2005-09-20 14:30:35 UTC
  • mto: (1185.1.37)
  • mto: This revision was merged to the branch mainline in revision 1390.
  • Revision ID: abentley@panoramicfeedback.com-20050920143035-01f15084129c2fb3
Ensured combined_graph is order-insensitive

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()
274
274
        self.assertEqual(common_ancestor(revisions_2[6], revisions[5], sources),
275
275
                          revisions[4])
276
276
 
 
277
    def test_combined(self):
 
278
        """combined_graph
 
279
        Ensure it's not order-sensitive
 
280
        """
 
281
        br1, br2 = make_branches()
 
282
        source = MultipleRevisionSources(br1, br2)
 
283
        combined_1 = combined_graph(br1.last_patch(), br2.last_patch(), source)
 
284
        combined_2 = combined_graph(br2.last_patch(), br1.last_patch(), source)
 
285
        assert combined_1[1] == combined_2[1]
 
286
        assert combined_1[2] == combined_2[2]
 
287
        assert combined_1[3] == combined_2[3]
 
288
        assert combined_1 == combined_2