~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-03-03 06:02:49 UTC
  • mfrom: (5672.1.7 branch-revs-to-fetch)
  • Revision ID: pqm@pqm.ubuntu.com-20110303060249-l2zou9i59742nrqf
(spiv) Add Branch.heads_to_fetch API and HPSS request. (Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
467
467
        br.set_revision_history([])
468
468
        self.assertEquals(br.revision_history(), [])
469
469
 
 
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)
 
481
 
 
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)
 
489
 
470
490
 
471
491
class TestBranchFormat(per_branch.TestCaseWithBranch):
472
492