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
17
"""Tests for Branch.revision_history."""
17
"""Tests for Branch.revision_history and last_revision."""
19
from bzrlib import branch
20
23
from bzrlib.tests.branch_implementations.test_branch import TestCaseWithBranch
26
class TestLastRevision(TestCaseWithBranch):
27
"""Tests for the last_revision property of the branch.
30
def test_set_last_revision_info(self):
31
# based on TestBranch.test_append_revisions, which uses the old
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()
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:')
23
49
class TestRevisionHistoryCaching(TestCaseWithBranch):
24
50
"""Tests for the caching of branches' revision_history.