~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

(jelmer) Deprecate Branch.revision_history(). (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
        br = self.get_branch()
78
78
        br.fetch(wt.branch)
79
79
        br.generate_revision_history('rev3')
80
 
        rh = br.revision_history()
81
 
        self.assertEqual(['rev1', 'rev2', 'rev3'], rh)
82
 
        for revision_id in rh:
 
80
        for revision_id in ['rev3', 'rev2', 'rev1']:
83
81
            self.assertIsInstance(revision_id, str)
84
82
        last = br.last_revision()
85
83
        self.assertEqual('rev3', last)
399
397
        """Create a fake revision history easily."""
400
398
        tree = self.make_branch_and_tree('.')
401
399
        rev1 = tree.commit('foo')
402
 
        orig_history = tree.branch.revision_history()
 
400
        tree.lock_write()
 
401
        self.addCleanup(tree.unlock)
 
402
        graph = tree.branch.repository.get_graph()
 
403
        orig_history = list(
 
404
            graph.iter_lefthand_ancestry(
 
405
                tree.branch.last_revision(), [revision.NULL_REVISION]))
403
406
        rev2 = tree.commit('bar', allow_pointless=True)
404
407
        tree.branch.generate_revision_history(rev1)
405
 
        self.assertEqual(orig_history, tree.branch.revision_history())
 
408
        self.assertEqual(orig_history, list(
 
409
            graph.iter_lefthand_ancestry(
 
410
                tree.branch.last_revision(), [revision.NULL_REVISION])))
406
411
 
407
412
    def test_generate_revision_history_NULL_REVISION(self):
408
413
        tree = self.make_branch_and_tree('.')
409
414
        rev1 = tree.commit('foo')
 
415
        tree.lock_write()
 
416
        self.addCleanup(tree.unlock)
410
417
        tree.branch.generate_revision_history(revision.NULL_REVISION)
411
 
        self.assertEqual([], tree.branch.revision_history())
 
418
        self.assertEqual(revision.NULL_REVISION, tree.branch.last_revision())
412
419
 
413
420
    def test_create_checkout(self):
414
421
        tree_a = self.make_branch_and_tree('a')