467
467
br.set_revision_history([])
468
468
self.assertEquals(br.revision_history(), [])
470
def test_heads_to_fetch(self):
471
# heads_to_fetch is a method that returns a collection of revids that
472
# need to be fetched to copy this branch into another repo. At a
473
# minimum this will include the tip.
474
# (In native formats, this is the tip + tags, but other formats may
475
# have other revs needed)
476
tree = self.make_branch_and_tree('a')
477
tree.commit('first commit', rev_id='rev1')
478
tree.commit('second commit', rev_id='rev2')
479
must_fetch, should_fetch = tree.branch.heads_to_fetch()
480
self.assertTrue('rev2' in must_fetch)
482
def test_heads_to_fetch_not_null_revision(self):
483
# NULL_REVISION does not appear in the result of heads_to_fetch, even
484
# for an empty branch.
485
tree = self.make_branch_and_tree('a')
486
must_fetch, should_fetch = tree.branch.heads_to_fetch()
487
self.assertFalse(revision.NULL_REVISION in must_fetch)
488
self.assertFalse(revision.NULL_REVISION in should_fetch)
471
491
class TestBranchFormat(per_branch.TestCaseWithBranch):