~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/branch_implementations/test_revision_history.py

  • Committer: Martin Pool
  • Date: 2007-08-20 05:48:40 UTC
  • mfrom: (2727 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2737.
  • Revision ID: mbp@sourcefrog.net-20070820054840-x2ugmd9dc4yodw9o
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
 
"""Tests for Branch.revision_history."""
 
17
"""Tests for Branch.revision_history and last_revision."""
18
18
 
19
 
from bzrlib import branch
 
19
from bzrlib import (
 
20
    branch,
 
21
    errors,
 
22
    )
20
23
from bzrlib.tests.branch_implementations.test_branch import TestCaseWithBranch
21
24
 
22
25
 
 
26
class TestLastRevision(TestCaseWithBranch):
 
27
    """Tests for the last_revision property of the branch.
 
28
    """
 
29
 
 
30
    def test_set_last_revision_info(self):
 
31
        # based on TestBranch.test_append_revisions, which uses the old
 
32
        # append_revision api
 
33
        wt = self.make_branch_and_tree('tree')
 
34
        wt.commit('f', rev_id='rev1')
 
35
        wt.commit('f', rev_id='rev2')
 
36
        wt.commit('f', rev_id='rev3')
 
37
        br = self.get_branch()
 
38
        br.fetch(wt.branch)
 
39
        br.set_last_revision_info(1, 'rev1')
 
40
        self.assertEquals(br.revision_history(), ["rev1",])
 
41
        br.set_last_revision_info(3, 'rev3')
 
42
        self.assertEquals(br.revision_history(), ["rev1", "rev2", "rev3"])
 
43
        # append_revision specifically prohibits some ids;
 
44
        # set_last_revision_info currently does not
 
45
        ## self.assertRaises(errors.ReservedId,
 
46
        ##         br.set_last_revision_info, 4, 'current:')
 
47
 
 
48
 
23
49
class TestRevisionHistoryCaching(TestCaseWithBranch):
24
50
    """Tests for the caching of branches' revision_history.
25
51