1
# Copyright (C) 2004, 2005 by Canonical Ltd
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
from bzrlib.tests import TestCaseInTempDir
19
from bzrlib.branch import Branch
20
from bzrlib.xml5 import serializer_v5
22
class TestBasisInventory(TestCaseInTempDir):
24
def test_create(self):
26
# Make sure the basis file is created by a commit
27
b = Branch.initialize(u'.')
29
open('a', 'wb').write('a\n')
31
t.commit('a', rev_id='r1')
33
self.failUnlessExists('.bzr/basis-inventory.r1')
35
basis_inv_txt = t.read_basis_inventory('r1')
36
basis_inv = serializer_v5.read_inventory_from_string(basis_inv_txt)
37
#self.assertEquals('r1', basis_inv.revision_id)
39
store_inv = b.get_inventory('r1')
40
self.assertEquals(store_inv._byid, basis_inv._byid)
42
open('b', 'wb').write('b\n')
44
t.commit('b', rev_id='r2')
46
self.failIfExists('.bzr/basis-inventory.r1')
47
self.failUnlessExists('.bzr/basis-inventory.r2')
49
basis_inv_txt = t.read_basis_inventory('r2')
50
basis_inv = serializer_v5.read_inventory_from_string(basis_inv_txt)
51
store_inv = b.get_inventory('r2')
53
self.assertEquals(store_inv._byid, basis_inv._byid)