1
# Copyright (C) 2020 Jelmer Vernooij
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
from . import TestCaseWithTransport
19
from ..memorybranch import MemoryBranch
22
class MemoryBranchTests(TestCaseWithTransport):
25
super(MemoryBranchTests, self).setUp()
26
self.tree = self.make_branch_and_tree('.')
27
self.revid1 = self.tree.commit('rev1')
28
self.revid2 = self.tree.commit('rev2')
29
self.branch = MemoryBranch(
30
self.tree.branch.repository, (2, self.revid2))
32
def test_last_revision_info(self):
33
self.assertEqual((2, self.revid2), self.branch.last_revision_info())
35
def test_last_revision(self):
36
self.assertEqual(self.revid2, self.branch.last_revision())
39
self.assertEqual(2, self.branch.revno())
41
def test_get_rev_id(self):
42
self.assertEqual(self.revid1, self.branch.get_rev_id(1))
44
def test_revision_id_to_revno(self):
45
self.assertEqual(2, self.branch.revision_id_to_revno(self.revid2))
46
self.assertEqual(1, self.branch.revision_id_to_revno(self.revid1))