/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
1185.50.22 by John Arbash Meinel
Forgot to add the test.
1
# Copyright (C) 2004, 2005 by Canonical Ltd
2
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.
7
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.
12
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
16
17
import os
1532 by Robert Collins
Merge in John Meinels integration branch.
18
1666.1.4 by Robert Collins
* 'Metadir' is now the default disk format. This improves behaviour in
19
from bzrlib.tests.workingtree_implementations import TestCaseWithWorkingTree
1185.50.22 by John Arbash Meinel
Forgot to add the test.
20
from bzrlib.branch import Branch
1732.1.26 by John Arbash Meinel
Switch to using bzrlib.xml5.serializer_v5 so that a plugin can override it if we want
21
import bzrlib.xml5
1185.50.22 by John Arbash Meinel
Forgot to add the test.
22
1532 by Robert Collins
Merge in John Meinels integration branch.
23
1666.1.4 by Robert Collins
* 'Metadir' is now the default disk format. This improves behaviour in
24
class TestBasisInventory(TestCaseWithWorkingTree):
1185.50.22 by John Arbash Meinel
Forgot to add the test.
25
26
    def test_create(self):
1638.1.2 by Robert Collins
Change the basis-inventory file to not have the revision-id in the file name.
27
        # TODO: jam 20051218 this probably should add more than just
28
        #                    a couple files to the inventory
29
1185.50.22 by John Arbash Meinel
Forgot to add the test.
30
        # Make sure the basis file is created by a commit
1534.4.26 by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create.
31
        t = self.make_branch_and_tree('.')
32
        b = t.branch
1185.50.22 by John Arbash Meinel
Forgot to add the test.
33
        open('a', 'wb').write('a\n')
34
        t.add('a')
35
        t.commit('a', rev_id='r1')
36
1666.1.4 by Robert Collins
* 'Metadir' is now the default disk format. This improves behaviour in
37
        t._control_files.get_utf8('basis-inventory')
1185.50.22 by John Arbash Meinel
Forgot to add the test.
38
1638.1.2 by Robert Collins
Change the basis-inventory file to not have the revision-id in the file name.
39
        basis_inv = t.basis_tree().inventory
40
        self.assertEquals('r1', basis_inv.revision_id)
1185.50.22 by John Arbash Meinel
Forgot to add the test.
41
        
1185.65.17 by Robert Collins
Merge from integration, mode-changes are broken.
42
        store_inv = b.repository.get_inventory('r1')
1185.50.22 by John Arbash Meinel
Forgot to add the test.
43
        self.assertEquals(store_inv._byid, basis_inv._byid)
44
45
        open('b', 'wb').write('b\n')
46
        t.add('b')
47
        t.commit('b', rev_id='r2')
48
1666.1.4 by Robert Collins
* 'Metadir' is now the default disk format. This improves behaviour in
49
        t._control_files.get_utf8('basis-inventory')
1185.50.22 by John Arbash Meinel
Forgot to add the test.
50
1638.1.2 by Robert Collins
Change the basis-inventory file to not have the revision-id in the file name.
51
        basis_inv_txt = t.read_basis_inventory()
1732.1.26 by John Arbash Meinel
Switch to using bzrlib.xml5.serializer_v5 so that a plugin can override it if we want
52
        basis_inv = bzrlib.xml5.serializer_v5.read_inventory_from_string(basis_inv_txt)
1638.1.2 by Robert Collins
Change the basis-inventory file to not have the revision-id in the file name.
53
        self.assertEquals('r2', basis_inv.revision_id)
1185.65.17 by Robert Collins
Merge from integration, mode-changes are broken.
54
        store_inv = b.repository.get_inventory('r2')
1185.50.22 by John Arbash Meinel
Forgot to add the test.
55
56
        self.assertEquals(store_inv._byid, basis_inv._byid)
57