bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
3388.2.1
by Martin Pool
Deprecate LockableFiles.get_utf8 |
1 |
# Copyright (C) 2004, 2005, 2008 Canonical Ltd
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
2 |
#
|
|
1185.50.22
by John Arbash Meinel
Forgot to add the test. |
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.
|
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
7 |
#
|
|
1185.50.22
by John Arbash Meinel
Forgot to add the test. |
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.
|
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
12 |
#
|
|
1185.50.22
by John Arbash Meinel
Forgot to add the test. |
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 |
|
|
3388.2.1
by Martin Pool
Deprecate LockableFiles.get_utf8 |
19 |
from bzrlib.tests import TestNotApplicable |
|
1666.1.4
by Robert Collins
* 'Metadir' is now the default disk format. This improves behaviour in |
20 |
from bzrlib.tests.workingtree_implementations import TestCaseWithWorkingTree |
|
1185.50.22
by John Arbash Meinel
Forgot to add the test. |
21 |
from bzrlib.branch import Branch |
|
1910.2.31
by Aaron Bentley
Fix bugs in basis inventory handling, change filename |
22 |
from bzrlib import inventory |
|
1740.2.2
by Aaron Bentley
Add test for the basis inventory automatically adding the revision id. |
23 |
from bzrlib.revision import Revision |
|
1910.2.31
by Aaron Bentley
Fix bugs in basis inventory handling, change filename |
24 |
import bzrlib.xml6 |
|
1185.50.22
by John Arbash Meinel
Forgot to add the test. |
25 |
|
|
1532
by Robert Collins
Merge in John Meinels integration branch. |
26 |
|
|
1666.1.4
by Robert Collins
* 'Metadir' is now the default disk format. This improves behaviour in |
27 |
class TestBasisInventory(TestCaseWithWorkingTree): |
|
1185.50.22
by John Arbash Meinel
Forgot to add the test. |
28 |
|
29 |
def test_create(self): |
|
|
2255.2.20
by Robert Collins
Bypass irrelevant basis_inventory tests for dirstate. |
30 |
# This test is not applicable to DirState based trees: the basis is
|
31 |
# not separate is mandatory.
|
|
32 |
if isinstance(self.workingtree_format, |
|
33 |
bzrlib.workingtree_4.WorkingTreeFormat4): |
|
|
3388.2.1
by Martin Pool
Deprecate LockableFiles.get_utf8 |
34 |
raise TestNotApplicable("not applicable to %r" |
35 |
% (self.workingtree_format,)) |
|
|
1638.1.2
by Robert Collins
Change the basis-inventory file to not have the revision-id in the file name. |
36 |
# TODO: jam 20051218 this probably should add more than just
|
37 |
# a couple files to the inventory
|
|
38 |
||
|
1185.50.22
by John Arbash Meinel
Forgot to add the test. |
39 |
# 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. |
40 |
t = self.make_branch_and_tree('.') |
41 |
b = t.branch |
|
|
1185.50.22
by John Arbash Meinel
Forgot to add the test. |
42 |
open('a', 'wb').write('a\n') |
43 |
t.add('a') |
|
44 |
t.commit('a', rev_id='r1') |
|
45 |
||
|
3407.2.14
by Martin Pool
Remove more cases of getting transport via control_files |
46 |
self.assertTrue(t._transport.has('basis-inventory-cache')) |
|
1185.50.22
by John Arbash Meinel
Forgot to add the test. |
47 |
|
|
1638.1.2
by Robert Collins
Change the basis-inventory file to not have the revision-id in the file name. |
48 |
basis_inv = t.basis_tree().inventory |
49 |
self.assertEquals('r1', basis_inv.revision_id) |
|
|
1185.50.22
by John Arbash Meinel
Forgot to add the test. |
50 |
|
|
1185.65.17
by Robert Collins
Merge from integration, mode-changes are broken. |
51 |
store_inv = b.repository.get_inventory('r1') |
|
1185.50.22
by John Arbash Meinel
Forgot to add the test. |
52 |
self.assertEquals(store_inv._byid, basis_inv._byid) |
53 |
||
54 |
open('b', 'wb').write('b\n') |
|
55 |
t.add('b') |
|
56 |
t.commit('b', rev_id='r2') |
|
57 |
||
|
3407.2.14
by Martin Pool
Remove more cases of getting transport via control_files |
58 |
self.assertTrue(t._transport.has('basis-inventory-cache')) |
|
1185.50.22
by John Arbash Meinel
Forgot to add the test. |
59 |
|
|
1638.1.2
by Robert Collins
Change the basis-inventory file to not have the revision-id in the file name. |
60 |
basis_inv_txt = t.read_basis_inventory() |
|
2100.3.15
by Aaron Bentley
get test suite passing |
61 |
basis_inv = bzrlib.xml7.serializer_v7.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. |
62 |
self.assertEquals('r2', basis_inv.revision_id) |
|
1185.65.17
by Robert Collins
Merge from integration, mode-changes are broken. |
63 |
store_inv = b.repository.get_inventory('r2') |
|
1185.50.22
by John Arbash Meinel
Forgot to add the test. |
64 |
|
65 |
self.assertEquals(store_inv._byid, basis_inv._byid) |
|
66 |
||
|
1910.2.31
by Aaron Bentley
Fix bugs in basis inventory handling, change filename |
67 |
def test_wrong_format(self): |
68 |
"""WorkingTree.basis safely ignores junk basis inventories""" |
|
|
2255.2.20
by Robert Collins
Bypass irrelevant basis_inventory tests for dirstate. |
69 |
# This test is not applicable to DirState based trees: the basis is
|
70 |
# not separate and ignorable.
|
|
71 |
if isinstance(self.workingtree_format, |
|
72 |
bzrlib.workingtree_4.WorkingTreeFormat4): |
|
|
3388.2.1
by Martin Pool
Deprecate LockableFiles.get_utf8 |
73 |
raise TestNotApplicable("not applicable to %r" |
74 |
% (self.workingtree_format,)) |
|
|
1910.2.31
by Aaron Bentley
Fix bugs in basis inventory handling, change filename |
75 |
t = self.make_branch_and_tree('.') |
76 |
b = t.branch |
|
77 |
open('a', 'wb').write('a\n') |
|
78 |
t.add('a') |
|
79 |
t.commit('a', rev_id='r1') |
|
|
3407.2.5
by Martin Pool
Deprecate LockableFiles.put_utf8 |
80 |
t._transport.put_bytes('basis-inventory-cache', 'booga') |
81 |
t.basis_tree() |
|
82 |
t._transport.put_bytes('basis-inventory-cache', '<xml/>') |
|
83 |
t.basis_tree() |
|
84 |
t._transport.put_bytes('basis-inventory-cache', '<inventory />') |
|
85 |
t.basis_tree() |
|
86 |
t._transport.put_bytes('basis-inventory-cache', |
|
87 |
'<inventory format="pi"/>') |
|
|
1910.2.31
by Aaron Bentley
Fix bugs in basis inventory handling, change filename |
88 |
t.basis_tree() |