bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
6614.1.1
by Vincent Ladeuil
Fix assert_ being deprecated by using assertTrue. |
1 |
# Copyright (C) 2005-2013, 2016 Canonical Ltd
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
2 |
#
|
|
1185.82.7
by John Arbash Meinel
Adding patches.py into bzrlib, including the tests into the test suite. |
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.82.7
by John Arbash Meinel
Adding patches.py into bzrlib, including the tests into the test suite. |
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.82.7
by John Arbash Meinel
Adding patches.py into bzrlib, including the tests into the test suite. |
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
|
|
|
4183.7.1
by Sabin Iacob
update FSF mailing address |
15 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
16 |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
17 |
import bz2 |
18 |
from io import BytesIO |
|
|
1711.7.27
by John Arbash Meinel
Investigating why test_bundle fails, something isn't transmitting properly. |
19 |
import os |
|
1711.7.34
by John Arbash Meinel
Include a test to ensure bundles handle trailing whitespace. |
20 |
import sys |
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
21 |
|
|
6624
by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes') |
22 |
from .. import ( |
|
4241.14.13
by Vincent Ladeuil
Some more cleanup. |
23 |
diff, |
|
1996.3.20
by John Arbash Meinel
[merge] bzr.dev 2063 |
24 |
errors, |
|
4241.14.13
by Vincent Ladeuil
Some more cleanup. |
25 |
merge, |
|
3638.3.2
by Vincent Ladeuil
Fix all calls to tempfile.mkdtemp to osutils.mkdtemp. |
26 |
osutils, |
|
2598.5.3
by Aaron Bentley
Push NULL_REVISION deeper |
27 |
revision as _mod_revision, |
|
4241.14.13
by Vincent Ladeuil
Some more cleanup. |
28 |
tests, |
|
1910.2.64
by Aaron Bentley
Changes from review |
29 |
treebuilder, |
30 |
)
|
|
|
6670.4.1
by Jelmer Vernooij
Update imports. |
31 |
from ..bzr import ( |
32 |
bzrdir, |
|
33 |
inventory, |
|
34 |
)
|
|
|
7358.12.1
by Jelmer Vernooij
Move bundle code to breezy.bzr. |
35 |
from ..bzr.bundle.apply_bundle import install_bundle, merge_bundle |
36 |
from ..bzr.bundle.bundle_data import BundleTree |
|
37 |
from ..bzr.bundle.serializer import write_bundle, read_bundle, v09, v4 |
|
38 |
from ..bzr.bundle.serializer.v08 import BundleSerializerV08 |
|
39 |
from ..bzr.bundle.serializer.v09 import BundleSerializerV09 |
|
40 |
from ..bzr.bundle.serializer.v4 import BundleSerializerV4 |
|
|
6670.4.5
by Jelmer Vernooij
Move breezy.repofmt contents to breezy.bzr. |
41 |
from ..bzr import knitrepo |
|
6624
by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes') |
42 |
from . import ( |
|
6206.1.9
by Vincent Ladeuil
Simpler fix for test_smart_server_connection_reset re-using more of the existing test server infrastructure. |
43 |
features, |
44 |
test_commit, |
|
|
2949.5.1
by Alexander Belchenko
selftest: use SymlinkFeature instead of TestSkipped where appropriate |
45 |
)
|
|
7325.1.2
by Jelmer Vernooij
Fix import. |
46 |
from ..tree import find_previous_path |
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
47 |
|
|
1185.82.90
by Aaron Bentley
Reorganized test suite |
48 |
|
|
4543.2.9
by John Arbash Meinel
Down to 2 failing tests. |
49 |
def get_text(vf, key): |
50 |
"""Get the fulltext for a given revision id that is present in the vf""" |
|
51 |
stream = vf.get_record_stream([key], 'unordered', True) |
|
|
6634.2.1
by Martin
Apply 2to3 next fixer and make compatible |
52 |
record = next(stream) |
|
4543.2.9
by John Arbash Meinel
Down to 2 failing tests. |
53 |
return record.get_bytes_as('fulltext') |
54 |
||
55 |
||
56 |
def get_inventory_text(repo, revision_id): |
|
57 |
"""Get the fulltext for the inventory at revision id""" |
|
|
7141.7.3
by Jelmer Vernooij
Fix some bundle tests. |
58 |
with repo.lock_read(): |
|
4543.2.9
by John Arbash Meinel
Down to 2 failing tests. |
59 |
return get_text(repo.inventories, (revision_id,)) |
60 |
||
61 |
||
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
62 |
class MockTree(object): |
|
5837.2.5
by Jelmer Vernooij
Fix two warnings. |
63 |
|
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
64 |
def __init__(self): |
|
6670.4.3
by Jelmer Vernooij
Fix more imports. |
65 |
from ..bzr.inventory import InventoryDirectory, ROOT_ID |
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
66 |
object.__init__(self) |
|
0.6.1
by Aaron Bentley
Fleshed out MockTree, fixed all test failures |
67 |
self.paths = {ROOT_ID: ""} |
68 |
self.ids = {"": ROOT_ID} |
|
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
69 |
self.contents = {} |
|
1731.1.4
by Aaron Bentley
merge from bzr.dev |
70 |
self.root = InventoryDirectory(ROOT_ID, '', None) |
|
0.6.1
by Aaron Bentley
Fleshed out MockTree, fixed all test failures |
71 |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
72 |
inventory = property(lambda x: x) |
73 |
root_inventory = property(lambda x: x) |
|
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
74 |
|
|
6405.2.10
by Jelmer Vernooij
Fix more tests. |
75 |
def get_root_id(self): |
76 |
return self.root.file_id |
|
77 |
||
|
5837.2.5
by Jelmer Vernooij
Fix two warnings. |
78 |
def all_file_ids(self): |
79 |
return set(self.paths.keys()) |
|
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
80 |
|
|
6825.5.1
by Jelmer Vernooij
Implement Tree.all_versioned_paths. |
81 |
def all_versioned_paths(self): |
82 |
return set(self.paths.values()) |
|
83 |
||
|
7141.7.1
by Jelmer Vernooij
Get rid of file_ids in most of Tree. |
84 |
def is_executable(self, path): |
|
6445.2.6
by Jelmer Vernooij
Review feedback. |
85 |
# Not all the files are executable.
|
|
6405.2.9
by Jelmer Vernooij
More test fixes. |
86 |
return False |
87 |
||
|
0.6.1
by Aaron Bentley
Fleshed out MockTree, fixed all test failures |
88 |
def __getitem__(self, file_id): |
89 |
if file_id == self.root.file_id: |
|
90 |
return self.root |
|
91 |
else: |
|
92 |
return self.make_entry(file_id, self.paths[file_id]) |
|
93 |
||
|
7141.7.3
by Jelmer Vernooij
Fix some bundle tests. |
94 |
def get_entry_by_path(self, path): |
95 |
return self[self.path2id(path)] |
|
96 |
||
|
0.6.1
by Aaron Bentley
Fleshed out MockTree, fixed all test failures |
97 |
def parent_id(self, file_id): |
|
1711.7.27
by John Arbash Meinel
Investigating why test_bundle fails, something isn't transmitting properly. |
98 |
parent_dir = os.path.dirname(self.paths[file_id]) |
|
0.6.1
by Aaron Bentley
Fleshed out MockTree, fixed all test failures |
99 |
if parent_dir == "": |
100 |
return None |
|
101 |
return self.ids[parent_dir] |
|
102 |
||
103 |
def iter_entries(self): |
|
|
6656.1.1
by Martin
Apply 2to3 dict fixer and clean up resulting mess using view helpers |
104 |
for path, file_id in self.ids.items(): |
|
0.6.1
by Aaron Bentley
Fleshed out MockTree, fixed all test failures |
105 |
yield path, self[file_id] |
106 |
||
|
7141.7.1
by Jelmer Vernooij
Get rid of file_ids in most of Tree. |
107 |
def kind(self, path): |
108 |
if path in self.contents: |
|
|
0.6.1
by Aaron Bentley
Fleshed out MockTree, fixed all test failures |
109 |
kind = 'file' |
110 |
else: |
|
111 |
kind = 'directory' |
|
112 |
return kind |
|
113 |
||
114 |
def make_entry(self, file_id, path): |
|
|
6809.1.1
by Martin
Apply 2to3 ws_comma fixer |
115 |
from ..bzr.inventory import (InventoryFile, InventoryDirectory, |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
116 |
InventoryLink) |
|
7065.3.11
by Jelmer Vernooij
Fix bundle tests. |
117 |
if not isinstance(file_id, bytes): |
118 |
raise TypeError(file_id) |
|
|
1711.7.27
by John Arbash Meinel
Investigating why test_bundle fails, something isn't transmitting properly. |
119 |
name = os.path.basename(path) |
|
7141.7.3
by Jelmer Vernooij
Fix some bundle tests. |
120 |
kind = self.kind(path) |
|
0.6.1
by Aaron Bentley
Fleshed out MockTree, fixed all test failures |
121 |
parent_id = self.parent_id(file_id) |
|
7141.7.3
by Jelmer Vernooij
Fix some bundle tests. |
122 |
text_sha_1, text_size = self.contents_stats(path) |
|
0.5.119
by John Arbash Meinel
Recreated the factory. We really need InventoryEntry.create() |
123 |
if kind == 'directory': |
124 |
ie = InventoryDirectory(file_id, name, parent_id) |
|
125 |
elif kind == 'file': |
|
126 |
ie = InventoryFile(file_id, name, parent_id) |
|
|
5365.2.2
by Andrew Bennetts
Fix test failures for bundles and upgrades. |
127 |
ie.text_sha1 = text_sha_1 |
128 |
ie.text_size = text_size |
|
|
0.5.119
by John Arbash Meinel
Recreated the factory. We really need InventoryEntry.create() |
129 |
elif kind == 'symlink': |
130 |
ie = InventoryLink(file_id, name, parent_id) |
|
131 |
else: |
|
|
3638.3.16
by Vincent Ladeuil
Remove XFAIL from test_unicode_bundle. |
132 |
raise errors.BzrError('unknown kind %r' % kind) |
|
0.6.1
by Aaron Bentley
Fleshed out MockTree, fixed all test failures |
133 |
return ie |
134 |
||
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
135 |
def add_dir(self, file_id, path): |
|
7065.3.11
by Jelmer Vernooij
Fix bundle tests. |
136 |
if not isinstance(file_id, bytes): |
137 |
raise TypeError(file_id) |
|
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
138 |
self.paths[file_id] = path |
139 |
self.ids[path] = file_id |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
140 |
|
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
141 |
def add_file(self, file_id, path, contents): |
|
7065.3.11
by Jelmer Vernooij
Fix bundle tests. |
142 |
if not isinstance(file_id, bytes): |
143 |
raise TypeError(file_id) |
|
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
144 |
self.add_dir(file_id, path) |
|
7141.7.1
by Jelmer Vernooij
Get rid of file_ids in most of Tree. |
145 |
self.contents[path] = contents |
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
146 |
|
147 |
def path2id(self, path): |
|
148 |
return self.ids.get(path) |
|
149 |
||
150 |
def id2path(self, file_id): |
|
|
7397.4.6
by Jelmer Vernooij
Simplify id2path lookups. |
151 |
try: |
152 |
return self.paths[file_id] |
|
153 |
except KeyError: |
|
154 |
raise errors.NoSuchId(file_id, self) |
|
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
155 |
|
|
7141.7.1
by Jelmer Vernooij
Get rid of file_ids in most of Tree. |
156 |
def get_file(self, path): |
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
157 |
result = BytesIO() |
|
6809.4.9
by Jelmer Vernooij
Fix some more tests. |
158 |
try: |
|
7141.7.1
by Jelmer Vernooij
Get rid of file_ids in most of Tree. |
159 |
result.write(self.contents[path]) |
|
6809.4.9
by Jelmer Vernooij
Fix some more tests. |
160 |
except KeyError: |
161 |
raise errors.NoSuchFile(path) |
|
|
6809.1.1
by Martin
Apply 2to3 ws_comma fixer |
162 |
result.seek(0, 0) |
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
163 |
return result |
164 |
||
|
7141.7.1
by Jelmer Vernooij
Get rid of file_ids in most of Tree. |
165 |
def get_file_revision(self, path): |
166 |
return self.inventory.get_entry_by_path(path).revision |
|
|
5793.2.6
by Jelmer Vernooij
Add MockTree.get_file_revision. |
167 |
|
|
7141.7.1
by Jelmer Vernooij
Get rid of file_ids in most of Tree. |
168 |
def get_file_size(self, path): |
|
7141.7.2
by Jelmer Vernooij
Fix more tests. |
169 |
return self.inventory.get_entry_by_path(path).text_size |
|
6468.2.8
by Jelmer Vernooij
Fix remaining test. |
170 |
|
|
6809.4.5
by Jelmer Vernooij
Swap arguments for get_file_*. |
171 |
def get_file_sha1(self, path, file_id=None): |
|
7141.7.1
by Jelmer Vernooij
Get rid of file_ids in most of Tree. |
172 |
return self.inventory.get_entry_by_path(path).text_sha1 |
|
6468.2.8
by Jelmer Vernooij
Fix remaining test. |
173 |
|
|
7141.7.1
by Jelmer Vernooij
Get rid of file_ids in most of Tree. |
174 |
def contents_stats(self, path): |
175 |
if path not in self.contents: |
|
|
0.6.1
by Aaron Bentley
Fleshed out MockTree, fixed all test failures |
176 |
return None, None |
|
7141.7.1
by Jelmer Vernooij
Get rid of file_ids in most of Tree. |
177 |
text_sha1 = osutils.sha_file(self.get_file(path)) |
178 |
return text_sha1, len(self.contents[path]) |
|
|
0.6.1
by Aaron Bentley
Fleshed out MockTree, fixed all test failures |
179 |
|
180 |
||
|
4241.14.13
by Vincent Ladeuil
Some more cleanup. |
181 |
class BTreeTester(tests.TestCase): |
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
182 |
"""A simple unittest tester for the BundleTree class.""" |
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
183 |
|
184 |
def make_tree_1(self): |
|
185 |
mtree = MockTree() |
|
|
6855.4.5
by Jelmer Vernooij
Fix more bees, use with rather than try/finally for some files. |
186 |
mtree.add_dir(b"a", "grandparent") |
187 |
mtree.add_dir(b"b", "grandparent/parent") |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
188 |
mtree.add_file(b"c", "grandparent/parent/file", b"Hello\n") |
|
6855.4.5
by Jelmer Vernooij
Fix more bees, use with rather than try/finally for some files. |
189 |
mtree.add_dir(b"d", "grandparent/alt_parent") |
|
7141.7.5
by Jelmer Vernooij
Fix test. |
190 |
return BundleTree(mtree, b''), mtree |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
191 |
|
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
192 |
def test_renames(self): |
193 |
"""Ensure that file renames have the proper effect on children""" |
|
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
194 |
btree = self.make_tree_1()[0] |
195 |
self.assertEqual(btree.old_path("grandparent"), "grandparent") |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
196 |
self.assertEqual(btree.old_path("grandparent/parent"), |
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
197 |
"grandparent/parent") |
198 |
self.assertEqual(btree.old_path("grandparent/parent/file"), |
|
199 |
"grandparent/parent/file") |
|
200 |
||
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
201 |
self.assertEqual(btree.id2path(b"a"), "grandparent") |
202 |
self.assertEqual(btree.id2path(b"b"), "grandparent/parent") |
|
203 |
self.assertEqual(btree.id2path(b"c"), "grandparent/parent/file") |
|
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
204 |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
205 |
self.assertEqual(btree.path2id("grandparent"), b"a") |
206 |
self.assertEqual(btree.path2id("grandparent/parent"), b"b") |
|
207 |
self.assertEqual(btree.path2id("grandparent/parent/file"), b"c") |
|
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
208 |
|
|
6852.3.1
by Jelmer Vernooij
add Tree.is_versioned. |
209 |
self.assertIs(btree.path2id("grandparent2"), None) |
210 |
self.assertIs(btree.path2id("grandparent2/parent"), None) |
|
211 |
self.assertIs(btree.path2id("grandparent2/parent/file"), None) |
|
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
212 |
|
213 |
btree.note_rename("grandparent", "grandparent2") |
|
|
6852.3.1
by Jelmer Vernooij
add Tree.is_versioned. |
214 |
self.assertIs(btree.old_path("grandparent"), None) |
215 |
self.assertIs(btree.old_path("grandparent/parent"), None) |
|
216 |
self.assertIs(btree.old_path("grandparent/parent/file"), None) |
|
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
217 |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
218 |
self.assertEqual(btree.id2path(b"a"), "grandparent2") |
219 |
self.assertEqual(btree.id2path(b"b"), "grandparent2/parent") |
|
220 |
self.assertEqual(btree.id2path(b"c"), "grandparent2/parent/file") |
|
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
221 |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
222 |
self.assertEqual(btree.path2id("grandparent2"), b"a") |
223 |
self.assertEqual(btree.path2id("grandparent2/parent"), b"b") |
|
224 |
self.assertEqual(btree.path2id("grandparent2/parent/file"), b"c") |
|
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
225 |
|
|
3376.2.4
by Martin Pool
Remove every assert statement from bzrlib! |
226 |
self.assertTrue(btree.path2id("grandparent") is None) |
227 |
self.assertTrue(btree.path2id("grandparent/parent") is None) |
|
228 |
self.assertTrue(btree.path2id("grandparent/parent/file") is None) |
|
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
229 |
|
230 |
btree.note_rename("grandparent/parent", "grandparent2/parent2") |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
231 |
self.assertEqual(btree.id2path(b"a"), "grandparent2") |
232 |
self.assertEqual(btree.id2path(b"b"), "grandparent2/parent2") |
|
233 |
self.assertEqual(btree.id2path(b"c"), "grandparent2/parent2/file") |
|
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
234 |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
235 |
self.assertEqual(btree.path2id("grandparent2"), b"a") |
236 |
self.assertEqual(btree.path2id("grandparent2/parent2"), b"b") |
|
237 |
self.assertEqual(btree.path2id("grandparent2/parent2/file"), b"c") |
|
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
238 |
|
|
3376.2.4
by Martin Pool
Remove every assert statement from bzrlib! |
239 |
self.assertTrue(btree.path2id("grandparent2/parent") is None) |
240 |
self.assertTrue(btree.path2id("grandparent2/parent/file") is None) |
|
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
241 |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
242 |
btree.note_rename("grandparent/parent/file", |
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
243 |
"grandparent2/parent2/file2") |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
244 |
self.assertEqual(btree.id2path(b"a"), "grandparent2") |
245 |
self.assertEqual(btree.id2path(b"b"), "grandparent2/parent2") |
|
246 |
self.assertEqual(btree.id2path(b"c"), "grandparent2/parent2/file2") |
|
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
247 |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
248 |
self.assertEqual(btree.path2id("grandparent2"), b"a") |
249 |
self.assertEqual(btree.path2id("grandparent2/parent2"), b"b") |
|
250 |
self.assertEqual(btree.path2id("grandparent2/parent2/file2"), b"c") |
|
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
251 |
|
|
3376.2.4
by Martin Pool
Remove every assert statement from bzrlib! |
252 |
self.assertTrue(btree.path2id("grandparent2/parent2/file") is None) |
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
253 |
|
254 |
def test_moves(self): |
|
255 |
"""Ensure that file moves have the proper effect on children""" |
|
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
256 |
btree = self.make_tree_1()[0] |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
257 |
btree.note_rename("grandparent/parent/file", |
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
258 |
"grandparent/alt_parent/file") |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
259 |
self.assertEqual(btree.id2path(b"c"), "grandparent/alt_parent/file") |
260 |
self.assertEqual(btree.path2id("grandparent/alt_parent/file"), b"c") |
|
|
3376.2.4
by Martin Pool
Remove every assert statement from bzrlib! |
261 |
self.assertTrue(btree.path2id("grandparent/parent/file") is None) |
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
262 |
|
263 |
def unified_diff(self, old, new): |
|
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
264 |
out = BytesIO() |
|
7045.2.14
by Jelmer Vernooij
Fix some bundle tests.: |
265 |
diff.internal_diff("old", old, "new", new, out) |
|
6809.1.1
by Martin
Apply 2to3 ws_comma fixer |
266 |
out.seek(0, 0) |
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
267 |
return out.read() |
268 |
||
269 |
def make_tree_2(self): |
|
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
270 |
btree = self.make_tree_1()[0] |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
271 |
btree.note_rename("grandparent/parent/file", |
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
272 |
"grandparent/alt_parent/file") |
|
7397.4.6
by Jelmer Vernooij
Simplify id2path lookups. |
273 |
self.assertRaises(errors.NoSuchId, btree.id2path, b"e") |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
274 |
self.assertFalse(btree.is_versioned("grandparent/parent/file")) |
275 |
btree.note_id(b"e", "grandparent/parent/file") |
|
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
276 |
return btree |
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
277 |
|
278 |
def test_adds(self): |
|
279 |
"""File/inventory adds""" |
|
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
280 |
btree = self.make_tree_2() |
|
7031.1.1
by Jelmer Vernooij
Fix breezy.tests.test_diff. |
281 |
add_patch = self.unified_diff([], [b"Extra cheese\n"]) |
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
282 |
btree.note_patch("grandparent/parent/file", add_patch) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
283 |
btree.note_id(b'f', 'grandparent/parent/symlink', kind='symlink') |
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
284 |
btree.note_target('grandparent/parent/symlink', 'venus') |
285 |
self.adds_test(btree) |
|
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
286 |
|
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
287 |
def adds_test(self, btree): |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
288 |
self.assertEqual(btree.id2path(b"e"), "grandparent/parent/file") |
289 |
self.assertEqual(btree.path2id("grandparent/parent/file"), b"e") |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
290 |
with btree.get_file("grandparent/parent/file") as f: |
291 |
self.assertEqual(f.read(), b"Extra cheese\n") |
|
|
6809.4.7
by Jelmer Vernooij
Swap arguments for get_symlink_target and kind/stored_kind. |
292 |
self.assertEqual( |
293 |
btree.get_symlink_target('grandparent/parent/symlink'), 'venus') |
|
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
294 |
|
295 |
def make_tree_3(self): |
|
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
296 |
btree, mtree = self.make_tree_1() |
|
7065.3.11
by Jelmer Vernooij
Fix bundle tests. |
297 |
mtree.add_file(b"e", "grandparent/parent/topping", b"Anchovies\n") |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
298 |
btree.note_rename("grandparent/parent/file", |
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
299 |
"grandparent/alt_parent/file") |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
300 |
btree.note_rename("grandparent/parent/topping", |
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
301 |
"grandparent/alt_parent/stopping") |
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
302 |
return btree |
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
303 |
|
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
304 |
def get_file_test(self, btree): |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
305 |
with btree.get_file(btree.id2path(b"e")) as f: |
306 |
self.assertEqual(f.read(), b"Lemon\n") |
|
307 |
with btree.get_file(btree.id2path(b"c")) as f: |
|
308 |
self.assertEqual(f.read(), b"Hello\n") |
|
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
309 |
|
310 |
def test_get_file(self): |
|
311 |
"""Get file contents""" |
|
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
312 |
btree = self.make_tree_3() |
|
7031.1.1
by Jelmer Vernooij
Fix breezy.tests.test_diff. |
313 |
mod_patch = self.unified_diff([b"Anchovies\n"], [b"Lemon\n"]) |
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
314 |
btree.note_patch("grandparent/alt_parent/stopping", mod_patch) |
315 |
self.get_file_test(btree) |
|
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
316 |
|
317 |
def test_delete(self): |
|
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
318 |
"Deletion by bundle"
|
319 |
btree = self.make_tree_1()[0] |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
320 |
with btree.get_file(btree.id2path(b"c")) as f: |
321 |
self.assertEqual(f.read(), b"Hello\n") |
|
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
322 |
btree.note_deletion("grandparent/parent/file") |
|
7397.4.6
by Jelmer Vernooij
Simplify id2path lookups. |
323 |
self.assertRaises(errors.NoSuchId, btree.id2path, b"c") |
|
6852.3.1
by Jelmer Vernooij
add Tree.is_versioned. |
324 |
self.assertFalse(btree.is_versioned("grandparent/parent/file")) |
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
325 |
|
326 |
def sorted_ids(self, tree): |
|
|
6619.3.18
by Jelmer Vernooij
Run 2to3 idioms fixer. |
327 |
ids = sorted(tree.all_file_ids()) |
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
328 |
return ids |
329 |
||
330 |
def test_iteration(self): |
|
331 |
"""Ensure that iteration through ids works properly""" |
|
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
332 |
btree = self.make_tree_1()[0] |
|
1852.6.3
by Robert Collins
Make iter(Tree) consistent for all tree types. |
333 |
self.assertEqual(self.sorted_ids(btree), |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
334 |
[inventory.ROOT_ID, b'a', b'b', b'c', b'd']) |
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
335 |
btree.note_deletion("grandparent/parent/file") |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
336 |
btree.note_id(b"e", "grandparent/alt_parent/fool", kind="directory") |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
337 |
btree.note_last_changed("grandparent/alt_parent/fool", |
|
1185.82.95
by Aaron Bentley
Restore path-orientation of ChangesetTree |
338 |
"revisionidiguess") |
|
1852.6.3
by Robert Collins
Make iter(Tree) consistent for all tree types. |
339 |
self.assertEqual(self.sorted_ids(btree), |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
340 |
[inventory.ROOT_ID, b'a', b'b', b'd', b'e']) |
|
0.5.66
by John Arbash Meinel
Refactoring, moving test code into test (switching back to assert is None) |
341 |
|
|
1185.82.7
by John Arbash Meinel
Adding patches.py into bzrlib, including the tests into the test suite. |
342 |
|
|
4241.14.13
by Vincent Ladeuil
Some more cleanup. |
343 |
class BundleTester1(tests.TestCaseWithTransport): |
|
1910.2.49
by Aaron Bentley
Ensure that 0.8 bundles aren't used with KnitRepository2 |
344 |
|
345 |
def test_mismatched_bundle(self): |
|
346 |
format = bzrdir.BzrDirMetaFormat1() |
|
|
2255.2.211
by Robert Collins
Remove knit2 repository format- it has never been supported. |
347 |
format.repository_format = knitrepo.RepositoryFormatKnit3() |
|
1910.2.49
by Aaron Bentley
Ensure that 0.8 bundles aren't used with KnitRepository2 |
348 |
serializer = BundleSerializerV08('0.8') |
349 |
b = self.make_branch('.', format=format) |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
350 |
self.assertRaises(errors.IncompatibleBundleFormat, serializer.write, |
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
351 |
b.repository, [], {}, BytesIO()) |
|
1910.2.49
by Aaron Bentley
Ensure that 0.8 bundles aren't used with KnitRepository2 |
352 |
|
|
1910.2.51
by Aaron Bentley
Bundles now corrupt repositories |
353 |
def test_matched_bundle(self): |
|
2067.3.1
by Martin Pool
Clean up BzrNewError, other exception classes and users. |
354 |
"""Don't raise IncompatibleBundleFormat for knit2 and bundle0.9""" |
|
1910.2.51
by Aaron Bentley
Bundles now corrupt repositories |
355 |
format = bzrdir.BzrDirMetaFormat1() |
|
2255.2.211
by Robert Collins
Remove knit2 repository format- it has never been supported. |
356 |
format.repository_format = knitrepo.RepositoryFormatKnit3() |
|
1910.2.51
by Aaron Bentley
Bundles now corrupt repositories |
357 |
serializer = BundleSerializerV09('0.9') |
358 |
b = self.make_branch('.', format=format) |
|
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
359 |
serializer.write(b.repository, [], {}, BytesIO()) |
|
1910.2.51
by Aaron Bentley
Bundles now corrupt repositories |
360 |
|
|
1910.2.60
by Aaron Bentley
Ensure that new-model revisions aren't installed into old-model repos |
361 |
def test_mismatched_model(self): |
362 |
"""Try copying a bundle from knit2 to knit1""" |
|
363 |
format = bzrdir.BzrDirMetaFormat1() |
|
|
2255.2.211
by Robert Collins
Remove knit2 repository format- it has never been supported. |
364 |
format.repository_format = knitrepo.RepositoryFormatKnit3() |
|
1910.2.60
by Aaron Bentley
Ensure that new-model revisions aren't installed into old-model repos |
365 |
source = self.make_branch_and_tree('source', format=format) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
366 |
source.commit('one', rev_id=b'one-id') |
367 |
source.commit('two', rev_id=b'two-id') |
|
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
368 |
text = BytesIO() |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
369 |
write_bundle(source.branch.repository, b'two-id', b'null:', text, |
|
1910.2.60
by Aaron Bentley
Ensure that new-model revisions aren't installed into old-model repos |
370 |
format='0.9') |
371 |
text.seek(0) |
|
372 |
||
373 |
format = bzrdir.BzrDirMetaFormat1() |
|
|
2241.1.6
by Martin Pool
Move Knit repositories into the submodule bzrlib.repofmt.knitrepo and |
374 |
format.repository_format = knitrepo.RepositoryFormatKnit1() |
|
1910.2.60
by Aaron Bentley
Ensure that new-model revisions aren't installed into old-model repos |
375 |
target = self.make_branch('target', format=format) |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
376 |
self.assertRaises(errors.IncompatibleRevision, install_bundle, |
|
1910.2.60
by Aaron Bentley
Ensure that new-model revisions aren't installed into old-model repos |
377 |
target.repository, read_bundle(text)) |
378 |
||
|
1910.2.51
by Aaron Bentley
Bundles now corrupt repositories |
379 |
|
|
2520.4.43
by Aaron Bentley
Fix test suite |
380 |
class BundleTester(object): |
|
1910.2.50
by Aaron Bentley
start work on format 0.9 serializer |
381 |
|
382 |
def bzrdir_format(self): |
|
383 |
format = bzrdir.BzrDirMetaFormat1() |
|
|
2241.1.6
by Martin Pool
Move Knit repositories into the submodule bzrlib.repofmt.knitrepo and |
384 |
format.repository_format = knitrepo.RepositoryFormatKnit1() |
|
1910.2.50
by Aaron Bentley
start work on format 0.9 serializer |
385 |
return format |
386 |
||
387 |
def make_branch_and_tree(self, path, format=None): |
|
388 |
if format is None: |
|
389 |
format = self.bzrdir_format() |
|
|
4241.14.13
by Vincent Ladeuil
Some more cleanup. |
390 |
return tests.TestCaseWithTransport.make_branch_and_tree( |
391 |
self, path, format) |
|
|
1910.2.50
by Aaron Bentley
start work on format 0.9 serializer |
392 |
|
393 |
def make_branch(self, path, format=None): |
|
394 |
if format is None: |
|
395 |
format = self.bzrdir_format() |
|
|
4241.14.13
by Vincent Ladeuil
Some more cleanup. |
396 |
return tests.TestCaseWithTransport.make_branch(self, path, format) |
|
0.5.80
by John Arbash Meinel
Starting to write tests for changeset, discovering some errors as I go. |
397 |
|
|
1793.3.1
by John Arbash Meinel
Clean up the bundle tests a little bit. |
398 |
def create_bundle_text(self, base_rev_id, rev_id): |
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
399 |
bundle_txt = BytesIO() |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
400 |
rev_ids = write_bundle(self.b1.repository, rev_id, base_rev_id, |
|
1910.2.50
by Aaron Bentley
start work on format 0.9 serializer |
401 |
bundle_txt, format=self.format) |
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
402 |
bundle_txt.seek(0) |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
403 |
self.assertEqual(bundle_txt.readline(), |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
404 |
b'# Bazaar revision bundle v%s\n' % self.format.encode('ascii')) |
405 |
self.assertEqual(bundle_txt.readline(), b'#\n') |
|
|
0.5.80
by John Arbash Meinel
Starting to write tests for changeset, discovering some errors as I go. |
406 |
|
|
1185.82.14
by Aaron Bentley
API updates |
407 |
rev = self.b1.repository.get_revision(rev_id) |
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
408 |
self.assertEqual(bundle_txt.readline().decode('utf-8'), |
409 |
u'# message:\n') |
|
410 |
bundle_txt.seek(0) |
|
|
1793.3.1
by John Arbash Meinel
Clean up the bundle tests a little bit. |
411 |
return bundle_txt, rev_ids |
412 |
||
413 |
def get_valid_bundle(self, base_rev_id, rev_id, checkout_dir=None): |
|
414 |
"""Create a bundle from base_rev_id -> rev_id in built-in branch. |
|
415 |
Make sure that the text generated is valid, and that it
|
|
416 |
can be applied against the base, and generate the same information.
|
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
417 |
|
418 |
:return: The in-memory bundle
|
|
|
1793.3.1
by John Arbash Meinel
Clean up the bundle tests a little bit. |
419 |
"""
|
420 |
bundle_txt, rev_ids = self.create_bundle_text(base_rev_id, rev_id) |
|
421 |
||
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
422 |
# This should also validate the generated bundle
|
|
1793.2.2
by Aaron Bentley
Move BundleReader into v07 serializer |
423 |
bundle = read_bundle(bundle_txt) |
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
424 |
repository = self.b1.repository |
|
1793.2.2
by Aaron Bentley
Move BundleReader into v07 serializer |
425 |
for bundle_rev in bundle.real_revisions: |
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
426 |
# These really should have already been checked when we read the
|
427 |
# bundle, since it computes the sha1 hash for the revision, which
|
|
428 |
# only will match if everything is okay, but lets be explicit about
|
|
429 |
# it
|
|
430 |
branch_rev = repository.get_revision(bundle_rev.revision_id) |
|
|
1185.82.33
by Aaron Bentley
Strengthen tests |
431 |
for a in ('inventory_sha1', 'revision_id', 'parent_ids', |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
432 |
'timestamp', 'timezone', 'message', 'committer', |
|
1185.82.33
by Aaron Bentley
Strengthen tests |
433 |
'parent_ids', 'properties'): |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
434 |
self.assertEqual(getattr(branch_rev, a), |
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
435 |
getattr(bundle_rev, a)) |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
436 |
self.assertEqual(len(branch_rev.parent_ids), |
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
437 |
len(bundle_rev.parent_ids)) |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
438 |
self.assertEqual(rev_ids, |
|
1793.2.2
by Aaron Bentley
Move BundleReader into v07 serializer |
439 |
[r.revision_id for r in bundle.real_revisions]) |
|
7029.2.1
by Jelmer Vernooij
don't make assumptions about the order in which revision ids are returned by write_bundle. |
440 |
self.valid_apply_bundle(base_rev_id, bundle, checkout_dir=checkout_dir) |
|
0.5.80
by John Arbash Meinel
Starting to write tests for changeset, discovering some errors as I go. |
441 |
|
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
442 |
return bundle |
|
0.5.80
by John Arbash Meinel
Starting to write tests for changeset, discovering some errors as I go. |
443 |
|
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
444 |
def get_invalid_bundle(self, base_rev_id, rev_id): |
445 |
"""Create a bundle from base_rev_id -> rev_id in built-in branch. |
|
|
1185.82.118
by Aaron Bentley
Ensure that StrictTestament handles execute bit differences |
446 |
Munge the text so that it's invalid.
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
447 |
|
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
448 |
:return: The in-memory bundle
|
|
1185.82.118
by Aaron Bentley
Ensure that StrictTestament handles execute bit differences |
449 |
"""
|
|
1793.3.1
by John Arbash Meinel
Clean up the bundle tests a little bit. |
450 |
bundle_txt, rev_ids = self.create_bundle_text(base_rev_id, rev_id) |
|
7065.3.11
by Jelmer Vernooij
Fix bundle tests. |
451 |
new_text = bundle_txt.getvalue().replace(b'executable:no', |
452 |
b'executable:yes') |
|
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
453 |
bundle_txt = BytesIO(new_text) |
|
1793.2.2
by Aaron Bentley
Move BundleReader into v07 serializer |
454 |
bundle = read_bundle(bundle_txt) |
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
455 |
self.valid_apply_bundle(base_rev_id, bundle) |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
456 |
return bundle |
|
1185.82.118
by Aaron Bentley
Ensure that StrictTestament handles execute bit differences |
457 |
|
|
1185.82.139
by Aaron Bentley
Raise NotABundle when a non-bundle is supplied |
458 |
def test_non_bundle(self): |
|
3638.3.16
by Vincent Ladeuil
Remove XFAIL from test_unicode_bundle. |
459 |
self.assertRaises(errors.NotABundle, |
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
460 |
read_bundle, BytesIO(b'#!/bin/sh\n')) |
|
1185.82.139
by Aaron Bentley
Raise NotABundle when a non-bundle is supplied |
461 |
|
|
1793.2.7
by Aaron Bentley
Fix reporting of malformed, (especially, crlf) bundles |
462 |
def test_malformed(self): |
|
3638.3.16
by Vincent Ladeuil
Remove XFAIL from test_unicode_bundle. |
463 |
self.assertRaises(errors.BadBundle, read_bundle, |
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
464 |
BytesIO(b'# Bazaar revision bundle v')) |
|
1793.2.7
by Aaron Bentley
Fix reporting of malformed, (especially, crlf) bundles |
465 |
|
466 |
def test_crlf_bundle(self): |
|
|
1793.2.9
by Aaron Bentley
Don't use assertNotRaises-- instead, catch BadBundle and pass |
467 |
try: |
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
468 |
read_bundle(BytesIO(b'# Bazaar revision bundle v0.8\r\n')) |
|
3638.3.16
by Vincent Ladeuil
Remove XFAIL from test_unicode_bundle. |
469 |
except errors.BadBundle: |
|
1793.2.9
by Aaron Bentley
Don't use assertNotRaises-- instead, catch BadBundle and pass |
470 |
# It is currently permitted for bundles with crlf line endings to
|
471 |
# make read_bundle raise a BadBundle, but this should be fixed.
|
|
|
1793.2.10
by Aaron Bentley
Whitespace/comment fix |
472 |
# Anything else, especially NotABundle, is an error.
|
|
1793.2.9
by Aaron Bentley
Don't use assertNotRaises-- instead, catch BadBundle and pass |
473 |
pass
|
474 |
||
|
0.5.88
by John Arbash Meinel
Fixed a bug in the rename code, added more tests. |
475 |
def get_checkout(self, rev_id, checkout_dir=None): |
|
0.5.80
by John Arbash Meinel
Starting to write tests for changeset, discovering some errors as I go. |
476 |
"""Get a new tree, with the specified revision in it. |
477 |
"""
|
|
478 |
||
|
0.5.88
by John Arbash Meinel
Fixed a bug in the rename code, added more tests. |
479 |
if checkout_dir is None: |
|
3638.3.2
by Vincent Ladeuil
Fix all calls to tempfile.mkdtemp to osutils.mkdtemp. |
480 |
checkout_dir = osutils.mkdtemp(prefix='test-branch-', dir='.') |
|
0.5.89
by John Arbash Meinel
Updating for explicitly defined directories. |
481 |
else: |
482 |
if not os.path.exists(checkout_dir): |
|
483 |
os.mkdir(checkout_dir) |
|
|
1910.2.50
by Aaron Bentley
start work on format 0.9 serializer |
484 |
tree = self.make_branch_and_tree(checkout_dir) |
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
485 |
s = BytesIO() |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
486 |
ancestors = write_bundle(self.b1.repository, rev_id, b'null:', s, |
|
1910.2.50
by Aaron Bentley
start work on format 0.9 serializer |
487 |
format=self.format) |
|
1185.82.40
by Aaron Bentley
Started work on testing install_revisions/handling empty changesets |
488 |
s.seek(0) |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
489 |
self.assertIsInstance(s.getvalue(), bytes) |
|
1793.2.2
by Aaron Bentley
Move BundleReader into v07 serializer |
490 |
install_bundle(tree.branch.repository, read_bundle(s)) |
|
1185.82.41
by Aaron Bentley
More work on installing changesets |
491 |
for ancestor in ancestors: |
492 |
old = self.b1.repository.revision_tree(ancestor) |
|
493 |
new = tree.branch.repository.revision_tree(ancestor) |
|
|
7358.11.3
by Jelmer Vernooij
TreeDelta holds TreeChange objects rather than tuples of various sizes. |
494 |
with old.lock_read(), new.lock_read(): |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
495 |
# Check that there aren't any inventory level changes
|
496 |
delta = new.changes_from(old) |
|
497 |
self.assertFalse(delta.has_changed(), |
|
498 |
'Revision %s not copied correctly.' |
|
499 |
% (ancestor,)) |
|
500 |
||
501 |
# Now check that the file contents are all correct
|
|
|
6825.5.1
by Jelmer Vernooij
Implement Tree.all_versioned_paths. |
502 |
for path in old.all_versioned_paths(): |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
503 |
try: |
|
6825.5.1
by Jelmer Vernooij
Implement Tree.all_versioned_paths. |
504 |
old_file = old.get_file(path) |
|
3638.3.16
by Vincent Ladeuil
Remove XFAIL from test_unicode_bundle. |
505 |
except errors.NoSuchFile: |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
506 |
continue
|
|
6809.4.21
by Jelmer Vernooij
Fix long lines. |
507 |
self.assertEqual( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
508 |
old_file.read(), new.get_file(path).read()) |
|
2598.5.3
by Aaron Bentley
Push NULL_REVISION deeper |
509 |
if not _mod_revision.is_null(rev_id): |
|
6165.4.19
by Jelmer Vernooij
Avoid all iter_reverse_revision_history calls. |
510 |
tree.branch.generate_revision_history(rev_id) |
|
1185.82.44
by Aaron Bentley
Switch to merge_changeset in test suite |
511 |
tree.update() |
|
1852.10.3
by Robert Collins
Remove all uses of compare_trees and replace with Tree.changes_from throughout bzrlib. |
512 |
delta = tree.changes_from(self.b1.repository.revision_tree(rev_id)) |
|
1711.7.32
by John Arbash Meinel
Switch from a trailing space to a beginning space, which is supported everywhere. |
513 |
self.assertFalse(delta.has_changed(), |
|
2255.10.5
by John Arbash Meinel
Fix a small bug when we have a symlink that does not need to be re-read. |
514 |
'Working tree has modifications: %s' % delta) |
|
1185.82.40
by Aaron Bentley
Started work on testing install_revisions/handling empty changesets |
515 |
return tree |
|
0.5.80
by John Arbash Meinel
Starting to write tests for changeset, discovering some errors as I go. |
516 |
|
|
1793.2.2
by Aaron Bentley
Move BundleReader into v07 serializer |
517 |
def valid_apply_bundle(self, base_rev_id, info, checkout_dir=None): |
|
0.5.80
by John Arbash Meinel
Starting to write tests for changeset, discovering some errors as I go. |
518 |
"""Get the base revision, apply the changes, and make |
519 |
sure everything matches the builtin branch.
|
|
520 |
"""
|
|
|
1185.82.17
by Aaron Bentley
More API updates |
521 |
to_tree = self.get_checkout(base_rev_id, checkout_dir=checkout_dir) |
|
3146.4.11
by Aaron Bentley
Fix lock errors in bundle tests |
522 |
to_tree.lock_write() |
523 |
try: |
|
524 |
self._valid_apply_bundle(base_rev_id, info, to_tree) |
|
525 |
finally: |
|
526 |
to_tree.unlock() |
|
527 |
||
528 |
def _valid_apply_bundle(self, base_rev_id, info, to_tree): |
|
|
1908.6.4
by Robert Collins
Update to replaced parent checking api bzrlib/merge.py |
529 |
original_parents = to_tree.get_parent_ids() |
|
1185.82.40
by Aaron Bentley
Started work on testing install_revisions/handling empty changesets |
530 |
repository = to_tree.branch.repository |
|
1927.2.1
by Robert Collins
Alter set_pending_merges to shove the left most merge into the trees last-revision if that is not set. Related bugfixes include basis_tree handling ghosts, de-duping the merges with the last-revision and update changing where and how it adds its pending merge. |
531 |
original_parents = to_tree.get_parent_ids() |
|
1185.82.41
by Aaron Bentley
More work on installing changesets |
532 |
self.assertIs(repository.has_revision(base_rev_id), True) |
|
1185.82.40
by Aaron Bentley
Started work on testing install_revisions/handling empty changesets |
533 |
for rev in info.real_revisions: |
|
6614.1.1
by Vincent Ladeuil
Fix assert_ being deprecated by using assertTrue. |
534 |
self.assertTrue(not repository.has_revision(rev.revision_id), |
535 |
'Revision {%s} present before applying bundle' |
|
536 |
% rev.revision_id) |
|
|
4241.14.13
by Vincent Ladeuil
Some more cleanup. |
537 |
merge_bundle(info, to_tree, True, merge.Merge3Merger, False, False) |
|
0.5.80
by John Arbash Meinel
Starting to write tests for changeset, discovering some errors as I go. |
538 |
|
539 |
for rev in info.real_revisions: |
|
|
6614.1.1
by Vincent Ladeuil
Fix assert_ being deprecated by using assertTrue. |
540 |
self.assertTrue(repository.has_revision(rev.revision_id), |
541 |
'Missing revision {%s} after applying bundle' |
|
542 |
% rev.revision_id) |
|
|
0.5.80
by John Arbash Meinel
Starting to write tests for changeset, discovering some errors as I go. |
543 |
|
|
6614.1.1
by Vincent Ladeuil
Fix assert_ being deprecated by using assertTrue. |
544 |
self.assertTrue(to_tree.branch.repository.has_revision(info.target)) |
|
0.5.117
by John Arbash Meinel
Almost there. Just need to track down a few remaining bugs. |
545 |
# Do we also want to verify that all the texts have been added?
|
|
0.5.86
by John Arbash Meinel
Updated the auto-commit functionality, and adding to pending-merges, more testing. |
546 |
|
|
1908.6.4
by Robert Collins
Update to replaced parent checking api bzrlib/merge.py |
547 |
self.assertEqual(original_parents + [info.target], |
|
6614.1.1
by Vincent Ladeuil
Fix assert_ being deprecated by using assertTrue. |
548 |
to_tree.get_parent_ids()) |
|
0.5.86
by John Arbash Meinel
Updated the auto-commit functionality, and adding to pending-merges, more testing. |
549 |
|
|
0.5.80
by John Arbash Meinel
Starting to write tests for changeset, discovering some errors as I go. |
550 |
rev = info.real_revisions[-1] |
|
1185.82.17
by Aaron Bentley
More API updates |
551 |
base_tree = self.b1.repository.revision_tree(rev.revision_id) |
552 |
to_tree = to_tree.branch.repository.revision_tree(rev.revision_id) |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
553 |
|
|
0.5.80
by John Arbash Meinel
Starting to write tests for changeset, discovering some errors as I go. |
554 |
# TODO: make sure the target tree is identical to base tree
|
|
0.5.86
by John Arbash Meinel
Updated the auto-commit functionality, and adding to pending-merges, more testing. |
555 |
# we might also check the working tree.
|
556 |
||
557 |
base_files = list(base_tree.list_files()) |
|
558 |
to_files = list(to_tree.list_files()) |
|
559 |
self.assertEqual(len(base_files), len(to_files)) |
|
|
1185.82.66
by Aaron Bentley
Handle new executable files |
560 |
for base_file, to_file in zip(base_files, to_files): |
561 |
self.assertEqual(base_file, to_file) |
|
|
0.5.86
by John Arbash Meinel
Updated the auto-commit functionality, and adding to pending-merges, more testing. |
562 |
|
|
7143.19.5
by Jelmer Vernooij
Undo removal of kind. |
563 |
for path, status, kind, entry in base_files: |
|
0.5.86
by John Arbash Meinel
Updated the auto-commit functionality, and adding to pending-merges, more testing. |
564 |
# Check that the meta information is the same
|
|
7325.1.1
by Jelmer Vernooij
Get rid of file_id arguments to get_file_sha1. |
565 |
to_path = find_previous_path(base_tree, to_tree, path) |
|
7143.16.21
by Jelmer Vernooij
Fix regressions. |
566 |
self.assertEqual( |
567 |
base_tree.get_file_size(path), |
|
|
7325.1.1
by Jelmer Vernooij
Get rid of file_id arguments to get_file_sha1. |
568 |
to_tree.get_file_size(to_path)) |
|
7143.16.21
by Jelmer Vernooij
Fix regressions. |
569 |
self.assertEqual( |
|
7325.1.1
by Jelmer Vernooij
Get rid of file_id arguments to get_file_sha1. |
570 |
base_tree.get_file_sha1(path), |
571 |
to_tree.get_file_sha1(to_path)) |
|
|
0.5.86
by John Arbash Meinel
Updated the auto-commit functionality, and adding to pending-merges, more testing. |
572 |
# Check that the contents are the same
|
573 |
# This is pretty expensive
|
|
574 |
# self.assertEqual(base_tree.get_file(fileid).read(),
|
|
575 |
# to_tree.get_file(fileid).read())
|
|
|
0.5.80
by John Arbash Meinel
Starting to write tests for changeset, discovering some errors as I go. |
576 |
|
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
577 |
def test_bundle(self): |
|
1711.7.34
by John Arbash Meinel
Include a test to ensure bundles handle trailing whitespace. |
578 |
self.tree1 = self.make_branch_and_tree('b1') |
|
1185.82.14
by Aaron Bentley
API updates |
579 |
self.b1 = self.tree1.branch |
|
0.5.78
by John Arbash Meinel
Working on test cases, starting with the empty project issues. |
580 |
|
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
581 |
self.build_tree_contents([('b1/one', b'one\n')]) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
582 |
self.tree1.add('one', b'one-id') |
583 |
self.tree1.set_root_id(b'root-id') |
|
584 |
self.tree1.commit('add one', rev_id=b'a@cset-0-1') |
|
|
0.5.78
by John Arbash Meinel
Working on test cases, starting with the empty project issues. |
585 |
|
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
586 |
bundle = self.get_valid_bundle(b'null:', b'a@cset-0-1') |
|
0.5.80
by John Arbash Meinel
Starting to write tests for changeset, discovering some errors as I go. |
587 |
|
588 |
# Make sure we can handle files with spaces, tabs, other
|
|
589 |
# bogus characters
|
|
|
0.5.82
by John Arbash Meinel
Lots of changes, changing separators, updating tests, updated ChangesetTree to include text_ids |
590 |
self.build_tree([ |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
591 |
'b1/with space.txt', 'b1/dir/', 'b1/dir/filein subdir.c', 'b1/dir/WithCaps.txt', 'b1/dir/ pre space', 'b1/sub/', 'b1/sub/sub/', 'b1/sub/sub/nonempty.txt' |
592 |
])
|
|
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
593 |
self.build_tree_contents([('b1/sub/sub/emptyfile.txt', b''), |
594 |
('b1/dir/nolastnewline.txt', b'bloop')]) |
|
|
7350.3.2
by Jelmer Vernooij
Use Tree.get_transform. |
595 |
tt = self.tree1.get_transform() |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
596 |
tt.new_file('executable', tt.root, [b'#!/bin/sh\n'], b'exe-1', True) |
|
1185.82.66
by Aaron Bentley
Handle new executable files |
597 |
tt.apply() |
|
2520.4.84
by Aaron Bentley
Fix heisenbug record-rewriting test |
598 |
# have to fix length of file-id so that we can predictably rewrite
|
599 |
# a (length-prefixed) record containing it later.
|
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
600 |
self.tree1.add('with space.txt', b'withspace-id') |
|
1185.82.14
by Aaron Bentley
API updates |
601 |
self.tree1.add([ |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
602 |
'dir', 'dir/filein subdir.c', 'dir/WithCaps.txt', 'dir/ pre space', 'dir/nolastnewline.txt', 'sub', 'sub/sub', 'sub/sub/nonempty.txt', 'sub/sub/emptyfile.txt' |
603 |
])
|
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
604 |
self.tree1.commit('add whitespace', rev_id=b'a@cset-0-2') |
|
0.5.80
by John Arbash Meinel
Starting to write tests for changeset, discovering some errors as I go. |
605 |
|
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
606 |
bundle = self.get_valid_bundle(b'a@cset-0-1', b'a@cset-0-2') |
|
0.5.117
by John Arbash Meinel
Almost there. Just need to track down a few remaining bugs. |
607 |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
608 |
# Check a rollup bundle
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
609 |
bundle = self.get_valid_bundle(b'null:', b'a@cset-0-2') |
|
0.5.84
by John Arbash Meinel
(broken) problem with removes. |
610 |
|
611 |
# Now delete entries
|
|
|
1185.82.21
by Aaron Bentley
Stop using deprecated function |
612 |
self.tree1.remove( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
613 |
['sub/sub/nonempty.txt', 'sub/sub/emptyfile.txt', 'sub/sub' |
614 |
])
|
|
|
7350.3.2
by Jelmer Vernooij
Use Tree.get_transform. |
615 |
tt = self.tree1.get_transform() |
|
6885.1.1
by Jelmer Vernooij
Get rid of TreeTransform.trans_id_tree_file_id. |
616 |
trans_id = tt.trans_id_tree_path('executable') |
|
1185.82.68
by Aaron Bentley
Handle execute bit on modified files |
617 |
tt.set_executability(False, trans_id) |
618 |
tt.apply() |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
619 |
self.tree1.commit('removed', rev_id=b'a@cset-0-3') |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
620 |
|
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
621 |
bundle = self.get_valid_bundle(b'a@cset-0-2', b'a@cset-0-3') |
|
3638.3.16
by Vincent Ladeuil
Remove XFAIL from test_unicode_bundle. |
622 |
self.assertRaises((errors.TestamentMismatch, |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
623 |
errors.VersionedFileInvalidChecksum, |
624 |
errors.BadBundle), self.get_invalid_bundle, |
|
625 |
b'a@cset-0-2', b'a@cset-0-3') |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
626 |
# Check a rollup bundle
|
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
627 |
bundle = self.get_valid_bundle(b'null:', b'a@cset-0-3') |
|
0.5.84
by John Arbash Meinel
(broken) problem with removes. |
628 |
|
629 |
# Now move the directory
|
|
|
1185.82.19
by Aaron Bentley
More API updates |
630 |
self.tree1.rename_one('dir', 'sub/dir') |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
631 |
self.tree1.commit('rename dir', rev_id=b'a@cset-0-4') |
|
0.5.84
by John Arbash Meinel
(broken) problem with removes. |
632 |
|
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
633 |
bundle = self.get_valid_bundle(b'a@cset-0-3', b'a@cset-0-4') |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
634 |
# Check a rollup bundle
|
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
635 |
bundle = self.get_valid_bundle(b'null:', b'a@cset-0-4') |
|
0.5.84
by John Arbash Meinel
(broken) problem with removes. |
636 |
|
|
0.5.87
by John Arbash Meinel
Handling international characters, added more test cases. |
637 |
# Modified files
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
638 |
with open('b1/sub/dir/WithCaps.txt', 'ab') as f: |
639 |
f.write(b'\nAdding some text\n') |
|
640 |
with open('b1/sub/dir/ pre space', 'ab') as f: |
|
641 |
f.write( |
|
642 |
b'\r\nAdding some\r\nDOS format lines\r\n') |
|
643 |
with open('b1/sub/dir/nolastnewline.txt', 'ab') as f: |
|
644 |
f.write(b'\n') |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
645 |
self.tree1.rename_one('sub/dir/ pre space', |
|
1711.7.32
by John Arbash Meinel
Switch from a trailing space to a beginning space, which is supported everywhere. |
646 |
'sub/ start space') |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
647 |
self.tree1.commit('Modified files', rev_id=b'a@cset-0-5') |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
648 |
bundle = self.get_valid_bundle(b'a@cset-0-4', b'a@cset-0-5') |
|
0.5.87
by John Arbash Meinel
Handling international characters, added more test cases. |
649 |
|
|
1185.82.70
by Aaron Bentley
Handle renamed files better |
650 |
self.tree1.rename_one('sub/dir/WithCaps.txt', 'temp') |
651 |
self.tree1.rename_one('with space.txt', 'WithCaps.txt') |
|
652 |
self.tree1.rename_one('temp', 'with space.txt') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
653 |
self.tree1.commit(u'swap filenames', rev_id=b'a@cset-0-6', |
|
1711.7.35
by John Arbash Meinel
Factor out i18n bundle tests, so we don't always skip. |
654 |
verbose=False) |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
655 |
bundle = self.get_valid_bundle(b'a@cset-0-5', b'a@cset-0-6') |
656 |
other = self.get_checkout(b'a@cset-0-5') |
|
|
4543.2.9
by John Arbash Meinel
Down to 2 failing tests. |
657 |
tree1_inv = get_inventory_text(self.tree1.branch.repository, |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
658 |
b'a@cset-0-5') |
|
4543.2.9
by John Arbash Meinel
Down to 2 failing tests. |
659 |
tree2_inv = get_inventory_text(other.branch.repository, |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
660 |
b'a@cset-0-5') |
|
1910.2.54
by Aaron Bentley
Implement testament format 3 strict |
661 |
self.assertEqualDiff(tree1_inv, tree2_inv) |
|
1711.7.35
by John Arbash Meinel
Factor out i18n bundle tests, so we don't always skip. |
662 |
other.rename_one('sub/dir/nolastnewline.txt', 'sub/nolastnewline.txt') |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
663 |
other.commit('rename file', rev_id=b'a@cset-0-6b') |
|
1551.15.72
by Aaron Bentley
remove builtins._merge_helper |
664 |
self.tree1.merge_from_branch(other.branch) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
665 |
self.tree1.commit(u'Merge', rev_id=b'a@cset-0-7', |
|
1185.82.70
by Aaron Bentley
Handle renamed files better |
666 |
verbose=False) |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
667 |
bundle = self.get_valid_bundle(b'a@cset-0-6', b'a@cset-0-7') |
|
1185.82.72
by Aaron Bentley
Always use leftmost base for changesets |
668 |
|
|
4241.14.12
by Vincent Ladeuil
Far too many modifications for a single commit, need to restart. |
669 |
def _test_symlink_bundle(self, link_name, link_target, new_link_target): |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
670 |
link_id = b'link-1' |
|
4241.14.12
by Vincent Ladeuil
Far too many modifications for a single commit, need to restart. |
671 |
|
|
5967.12.1
by Martin Pool
Move all test features into bzrlib.tests.features |
672 |
self.requireFeature(features.SymlinkFeature) |
|
1910.2.50
by Aaron Bentley
start work on format 0.9 serializer |
673 |
self.tree1 = self.make_branch_and_tree('b1') |
|
1185.82.87
by Aaron Bentley
Got symlink adding working |
674 |
self.b1 = self.tree1.branch |
|
4241.14.12
by Vincent Ladeuil
Far too many modifications for a single commit, need to restart. |
675 |
|
|
7350.3.2
by Jelmer Vernooij
Use Tree.get_transform. |
676 |
tt = self.tree1.get_transform() |
|
4241.14.12
by Vincent Ladeuil
Far too many modifications for a single commit, need to restart. |
677 |
tt.new_symlink(link_name, tt.root, link_target, link_id) |
|
1185.82.87
by Aaron Bentley
Got symlink adding working |
678 |
tt.apply() |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
679 |
self.tree1.commit('add symlink', rev_id=b'l@cset-0-1') |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
680 |
bundle = self.get_valid_bundle(b'null:', b'l@cset-0-1') |
|
6809.1.1
by Martin
Apply 2to3 ws_comma fixer |
681 |
if getattr(bundle, 'revision_tree', None) is not None: |
|
4241.14.12
by Vincent Ladeuil
Far too many modifications for a single commit, need to restart. |
682 |
# Not all bundle formats supports revision_tree
|
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
683 |
bund_tree = bundle.revision_tree(self.b1.repository, b'l@cset-0-1') |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
684 |
self.assertEqual( |
685 |
link_target, bund_tree.get_symlink_target(link_name)) |
|
|
4241.14.12
by Vincent Ladeuil
Far too many modifications for a single commit, need to restart. |
686 |
|
|
7350.3.2
by Jelmer Vernooij
Use Tree.get_transform. |
687 |
tt = self.tree1.get_transform() |
|
6885.1.1
by Jelmer Vernooij
Get rid of TreeTransform.trans_id_tree_file_id. |
688 |
trans_id = tt.trans_id_tree_path(link_name) |
|
1185.82.88
by Aaron Bentley
Get symlink modification, renames and deletion under test |
689 |
tt.adjust_path('link2', tt.root, trans_id) |
690 |
tt.delete_contents(trans_id) |
|
|
4241.14.12
by Vincent Ladeuil
Far too many modifications for a single commit, need to restart. |
691 |
tt.create_symlink(new_link_target, trans_id) |
|
1185.82.88
by Aaron Bentley
Get symlink modification, renames and deletion under test |
692 |
tt.apply() |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
693 |
self.tree1.commit('rename and change symlink', rev_id=b'l@cset-0-2') |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
694 |
bundle = self.get_valid_bundle(b'l@cset-0-1', b'l@cset-0-2') |
|
6809.1.1
by Martin
Apply 2to3 ws_comma fixer |
695 |
if getattr(bundle, 'revision_tree', None) is not None: |
|
4241.14.12
by Vincent Ladeuil
Far too many modifications for a single commit, need to restart. |
696 |
# Not all bundle formats supports revision_tree
|
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
697 |
bund_tree = bundle.revision_tree(self.b1.repository, b'l@cset-0-2') |
|
4241.14.12
by Vincent Ladeuil
Far too many modifications for a single commit, need to restart. |
698 |
self.assertEqual(new_link_target, |
|
6809.4.7
by Jelmer Vernooij
Swap arguments for get_symlink_target and kind/stored_kind. |
699 |
bund_tree.get_symlink_target('link2')) |
|
4241.14.12
by Vincent Ladeuil
Far too many modifications for a single commit, need to restart. |
700 |
|
|
7350.3.2
by Jelmer Vernooij
Use Tree.get_transform. |
701 |
tt = self.tree1.get_transform() |
|
6885.1.1
by Jelmer Vernooij
Get rid of TreeTransform.trans_id_tree_file_id. |
702 |
trans_id = tt.trans_id_tree_path('link2') |
|
1185.82.88
by Aaron Bentley
Get symlink modification, renames and deletion under test |
703 |
tt.delete_contents(trans_id) |
704 |
tt.create_symlink('jupiter', trans_id) |
|
705 |
tt.apply() |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
706 |
self.tree1.commit('just change symlink target', rev_id=b'l@cset-0-3') |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
707 |
bundle = self.get_valid_bundle(b'l@cset-0-2', b'l@cset-0-3') |
|
4241.14.12
by Vincent Ladeuil
Far too many modifications for a single commit, need to restart. |
708 |
|
|
7350.3.2
by Jelmer Vernooij
Use Tree.get_transform. |
709 |
tt = self.tree1.get_transform() |
|
6885.1.1
by Jelmer Vernooij
Get rid of TreeTransform.trans_id_tree_file_id. |
710 |
trans_id = tt.trans_id_tree_path('link2') |
|
1185.82.88
by Aaron Bentley
Get symlink modification, renames and deletion under test |
711 |
tt.delete_contents(trans_id) |
712 |
tt.apply() |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
713 |
self.tree1.commit('Delete symlink', rev_id=b'l@cset-0-4') |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
714 |
bundle = self.get_valid_bundle(b'l@cset-0-3', b'l@cset-0-4') |
|
4241.14.12
by Vincent Ladeuil
Far too many modifications for a single commit, need to restart. |
715 |
|
716 |
def test_symlink_bundle(self): |
|
717 |
self._test_symlink_bundle('link', 'bar/foo', 'mars') |
|
718 |
||
719 |
def test_unicode_symlink_bundle(self): |
|
|
5967.12.1
by Martin Pool
Move all test features into bzrlib.tests.features |
720 |
self.requireFeature(features.UnicodeFilenameFeature) |
|
4241.14.12
by Vincent Ladeuil
Far too many modifications for a single commit, need to restart. |
721 |
self._test_symlink_bundle(u'\N{Euro Sign}link', |
722 |
u'bar/\N{Euro Sign}foo', |
|
723 |
u'mars\N{Euro Sign}') |
|
|
1185.82.96
by Aaron Bentley
Got first binary test passing |
724 |
|
|
1185.82.130
by Aaron Bentley
Rename changesets to revision bundles |
725 |
def test_binary_bundle(self): |
|
1910.2.50
by Aaron Bentley
start work on format 0.9 serializer |
726 |
self.tree1 = self.make_branch_and_tree('b1') |
|
1185.82.96
by Aaron Bentley
Got first binary test passing |
727 |
self.b1 = self.tree1.branch |
|
7350.3.2
by Jelmer Vernooij
Use Tree.get_transform. |
728 |
tt = self.tree1.get_transform() |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
729 |
|
|
1848.1.1
by John Arbash Meinel
fix bug in bundle handling of binary files with just '\r' in them. |
730 |
# Add
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
731 |
tt.new_file('file', tt.root, [ |
732 |
b'\x00\n\x00\r\x01\n\x02\r\xff'], b'binary-1') |
|
|
6963.2.18
by Jelmer Vernooij
Add bees to some of bp.weave_fmt. |
733 |
tt.new_file('file2', tt.root, [b'\x01\n\x02\r\x03\n\x04\r\xff'], |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
734 |
b'binary-2') |
|
1185.82.96
by Aaron Bentley
Got first binary test passing |
735 |
tt.apply() |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
736 |
self.tree1.commit('add binary', rev_id=b'b@cset-0-1') |
|
6963.2.18
by Jelmer Vernooij
Add bees to some of bp.weave_fmt. |
737 |
self.get_valid_bundle(b'null:', b'b@cset-0-1') |
|
1848.1.1
by John Arbash Meinel
fix bug in bundle handling of binary files with just '\r' in them. |
738 |
|
739 |
# Delete
|
|
|
7350.3.2
by Jelmer Vernooij
Use Tree.get_transform. |
740 |
tt = self.tree1.get_transform() |
|
6885.1.1
by Jelmer Vernooij
Get rid of TreeTransform.trans_id_tree_file_id. |
741 |
trans_id = tt.trans_id_tree_path('file') |
|
1185.82.97
by Aaron Bentley
Got binary files working for adds, renames, modifications |
742 |
tt.delete_contents(trans_id) |
743 |
tt.apply() |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
744 |
self.tree1.commit('delete binary', rev_id=b'b@cset-0-2') |
|
6963.2.18
by Jelmer Vernooij
Add bees to some of bp.weave_fmt. |
745 |
self.get_valid_bundle(b'b@cset-0-1', b'b@cset-0-2') |
|
1848.1.1
by John Arbash Meinel
fix bug in bundle handling of binary files with just '\r' in them. |
746 |
|
747 |
# Rename & modify
|
|
|
7350.3.2
by Jelmer Vernooij
Use Tree.get_transform. |
748 |
tt = self.tree1.get_transform() |
|
6885.1.1
by Jelmer Vernooij
Get rid of TreeTransform.trans_id_tree_file_id. |
749 |
trans_id = tt.trans_id_tree_path('file2') |
|
1185.82.97
by Aaron Bentley
Got binary files working for adds, renames, modifications |
750 |
tt.adjust_path('file3', tt.root, trans_id) |
751 |
tt.delete_contents(trans_id) |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
752 |
tt.create_file([b'file\rcontents\x00\n\x00'], trans_id) |
|
1185.82.97
by Aaron Bentley
Got binary files working for adds, renames, modifications |
753 |
tt.apply() |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
754 |
self.tree1.commit('rename and modify binary', rev_id=b'b@cset-0-3') |
|
6963.2.18
by Jelmer Vernooij
Add bees to some of bp.weave_fmt. |
755 |
self.get_valid_bundle(b'b@cset-0-2', b'b@cset-0-3') |
|
1848.1.1
by John Arbash Meinel
fix bug in bundle handling of binary files with just '\r' in them. |
756 |
|
757 |
# Modify
|
|
|
7350.3.2
by Jelmer Vernooij
Use Tree.get_transform. |
758 |
tt = self.tree1.get_transform() |
|
6885.1.1
by Jelmer Vernooij
Get rid of TreeTransform.trans_id_tree_file_id. |
759 |
trans_id = tt.trans_id_tree_path('file3') |
|
1185.82.97
by Aaron Bentley
Got binary files working for adds, renames, modifications |
760 |
tt.delete_contents(trans_id) |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
761 |
tt.create_file([b'\x00file\rcontents'], trans_id) |
|
1185.82.97
by Aaron Bentley
Got binary files working for adds, renames, modifications |
762 |
tt.apply() |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
763 |
self.tree1.commit('just modify binary', rev_id=b'b@cset-0-4') |
|
6963.2.18
by Jelmer Vernooij
Add bees to some of bp.weave_fmt. |
764 |
self.get_valid_bundle(b'b@cset-0-3', b'b@cset-0-4') |
|
1185.82.115
by Aaron Bentley
Add test for last-changed special cases |
765 |
|
|
1848.1.1
by John Arbash Meinel
fix bug in bundle handling of binary files with just '\r' in them. |
766 |
# Rollup
|
|
6963.2.18
by Jelmer Vernooij
Add bees to some of bp.weave_fmt. |
767 |
self.get_valid_bundle(b'null:', b'b@cset-0-4') |
|
1848.1.1
by John Arbash Meinel
fix bug in bundle handling of binary files with just '\r' in them. |
768 |
|
|
1185.82.115
by Aaron Bentley
Add test for last-changed special cases |
769 |
def test_last_modified(self): |
|
1910.2.50
by Aaron Bentley
start work on format 0.9 serializer |
770 |
self.tree1 = self.make_branch_and_tree('b1') |
|
1185.82.115
by Aaron Bentley
Add test for last-changed special cases |
771 |
self.b1 = self.tree1.branch |
|
7350.3.2
by Jelmer Vernooij
Use Tree.get_transform. |
772 |
tt = self.tree1.get_transform() |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
773 |
tt.new_file('file', tt.root, [b'file'], b'file') |
|
1185.82.115
by Aaron Bentley
Add test for last-changed special cases |
774 |
tt.apply() |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
775 |
self.tree1.commit('create file', rev_id=b'a@lmod-0-1') |
|
1185.82.115
by Aaron Bentley
Add test for last-changed special cases |
776 |
|
|
7350.3.2
by Jelmer Vernooij
Use Tree.get_transform. |
777 |
tt = self.tree1.get_transform() |
|
6885.1.1
by Jelmer Vernooij
Get rid of TreeTransform.trans_id_tree_file_id. |
778 |
trans_id = tt.trans_id_tree_path('file') |
|
1185.82.115
by Aaron Bentley
Add test for last-changed special cases |
779 |
tt.delete_contents(trans_id) |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
780 |
tt.create_file([b'file2'], trans_id) |
|
1185.82.115
by Aaron Bentley
Add test for last-changed special cases |
781 |
tt.apply() |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
782 |
self.tree1.commit('modify text', rev_id=b'a@lmod-0-2a') |
|
1185.82.115
by Aaron Bentley
Add test for last-changed special cases |
783 |
|
|
6963.2.18
by Jelmer Vernooij
Add bees to some of bp.weave_fmt. |
784 |
other = self.get_checkout(b'a@lmod-0-1') |
|
7350.3.2
by Jelmer Vernooij
Use Tree.get_transform. |
785 |
tt = other.get_transform() |
|
6885.1.1
by Jelmer Vernooij
Get rid of TreeTransform.trans_id_tree_file_id. |
786 |
trans_id = tt.trans_id_tree_path('file2') |
|
1185.82.115
by Aaron Bentley
Add test for last-changed special cases |
787 |
tt.delete_contents(trans_id) |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
788 |
tt.create_file([b'file2'], trans_id) |
|
1185.82.115
by Aaron Bentley
Add test for last-changed special cases |
789 |
tt.apply() |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
790 |
other.commit('modify text in another tree', rev_id=b'a@lmod-0-2b') |
|
1551.15.72
by Aaron Bentley
remove builtins._merge_helper |
791 |
self.tree1.merge_from_branch(other.branch) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
792 |
self.tree1.commit(u'Merge', rev_id=b'a@lmod-0-3', |
|
1185.82.115
by Aaron Bentley
Add test for last-changed special cases |
793 |
verbose=False) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
794 |
self.tree1.commit(u'Merge', rev_id=b'a@lmod-0-4') |
|
6963.2.18
by Jelmer Vernooij
Add bees to some of bp.weave_fmt. |
795 |
bundle = self.get_valid_bundle(b'a@lmod-0-2a', b'a@lmod-0-4') |
|
1185.84.3
by Aaron Bentley
Hide diffs for old revisions in bundles |
796 |
|
797 |
def test_hide_history(self): |
|
|
1910.2.50
by Aaron Bentley
start work on format 0.9 serializer |
798 |
self.tree1 = self.make_branch_and_tree('b1') |
|
1185.84.3
by Aaron Bentley
Hide diffs for old revisions in bundles |
799 |
self.b1 = self.tree1.branch |
800 |
||
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
801 |
with open('b1/one', 'wb') as f: |
802 |
f.write(b'one\n') |
|
|
1185.84.3
by Aaron Bentley
Hide diffs for old revisions in bundles |
803 |
self.tree1.add('one') |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
804 |
self.tree1.commit('add file', rev_id=b'a@cset-0-1') |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
805 |
with open('b1/one', 'wb') as f: |
806 |
f.write(b'two\n') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
807 |
self.tree1.commit('modify', rev_id=b'a@cset-0-2') |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
808 |
with open('b1/one', 'wb') as f: |
809 |
f.write(b'three\n') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
810 |
self.tree1.commit('modify', rev_id=b'a@cset-0-3') |
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
811 |
bundle_file = BytesIO() |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
812 |
rev_ids = write_bundle(self.tree1.branch.repository, b'a@cset-0-3', |
813 |
b'a@cset-0-1', bundle_file, format=self.format) |
|
814 |
self.assertNotContainsRe(bundle_file.getvalue(), b'\btwo\b') |
|
815 |
self.assertContainsRe(self.get_raw(bundle_file), b'one') |
|
816 |
self.assertContainsRe(self.get_raw(bundle_file), b'three') |
|
|
2520.4.32
by Aaron Bentley
Fix test case |
817 |
|
|
2520.4.75
by Aaron Bentley
Fix traceback on empty bundles. |
818 |
def test_bundle_same_basis(self): |
819 |
"""Ensure using the basis as the target doesn't cause an error""" |
|
820 |
self.tree1 = self.make_branch_and_tree('b1') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
821 |
self.tree1.commit('add file', rev_id=b'a@cset-0-1') |
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
822 |
bundle_file = BytesIO() |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
823 |
rev_ids = write_bundle(self.tree1.branch.repository, b'a@cset-0-1', |
824 |
b'a@cset-0-1', bundle_file) |
|
|
2520.4.75
by Aaron Bentley
Fix traceback on empty bundles. |
825 |
|
|
2520.4.32
by Aaron Bentley
Fix test case |
826 |
@staticmethod
|
827 |
def get_raw(bundle_file): |
|
828 |
return bundle_file.getvalue() |
|
|
1793.3.2
by John Arbash Meinel
(failing) add some tests which munge trailing whitespace |
829 |
|
|
1711.7.35
by John Arbash Meinel
Factor out i18n bundle tests, so we don't always skip. |
830 |
def test_unicode_bundle(self): |
|
5967.12.1
by Martin Pool
Move all test features into bzrlib.tests.features |
831 |
self.requireFeature(features.UnicodeFilenameFeature) |
|
1711.7.35
by John Arbash Meinel
Factor out i18n bundle tests, so we don't always skip. |
832 |
# Handle international characters
|
833 |
os.mkdir('b1') |
|
|
4241.14.13
by Vincent Ladeuil
Some more cleanup. |
834 |
f = open(u'b1/with Dod\N{Euro Sign}', 'wb') |
|
1711.7.35
by John Arbash Meinel
Factor out i18n bundle tests, so we don't always skip. |
835 |
|
836 |
self.tree1 = self.make_branch_and_tree('b1') |
|
837 |
self.b1 = self.tree1.branch |
|
838 |
||
839 |
f.write((u'A file\n' |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
840 |
u'With international man of mystery\n' |
841 |
u'William Dod\xe9\n').encode('utf-8')) |
|
|
1711.7.35
by John Arbash Meinel
Factor out i18n bundle tests, so we don't always skip. |
842 |
f.close() |
843 |
||
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
844 |
self.tree1.add([u'with Dod\N{Euro Sign}'], [b'withdod-id']) |
|
2386.1.1
by John Arbash Meinel
Update test_unicode_bundle, since we know how it fails on Mac OSX |
845 |
self.tree1.commit(u'i18n commit from William Dod\xe9', |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
846 |
rev_id=b'i18n-1', committer=u'William Dod\xe9') |
|
1711.7.35
by John Arbash Meinel
Factor out i18n bundle tests, so we don't always skip. |
847 |
|
848 |
# Add
|
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
849 |
bundle = self.get_valid_bundle(b'null:', b'i18n-1') |
|
1711.7.35
by John Arbash Meinel
Factor out i18n bundle tests, so we don't always skip. |
850 |
|
851 |
# Modified
|
|
|
3638.3.18
by Vincent Ladeuil
Fixed as per jam's review. |
852 |
f = open(u'b1/with Dod\N{Euro Sign}', 'wb') |
|
1711.7.35
by John Arbash Meinel
Factor out i18n bundle tests, so we don't always skip. |
853 |
f.write(u'Modified \xb5\n'.encode('utf8')) |
854 |
f.close() |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
855 |
self.tree1.commit(u'modified', rev_id=b'i18n-2') |
|
1711.7.35
by John Arbash Meinel
Factor out i18n bundle tests, so we don't always skip. |
856 |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
857 |
bundle = self.get_valid_bundle(b'i18n-1', b'i18n-2') |
|
3638.3.16
by Vincent Ladeuil
Remove XFAIL from test_unicode_bundle. |
858 |
|
|
1711.7.35
by John Arbash Meinel
Factor out i18n bundle tests, so we don't always skip. |
859 |
# Renamed
|
|
3638.3.18
by Vincent Ladeuil
Fixed as per jam's review. |
860 |
self.tree1.rename_one(u'with Dod\N{Euro Sign}', u'B\N{Euro Sign}gfors') |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
861 |
self.tree1.commit(u'renamed, the new i18n man', rev_id=b'i18n-3', |
|
1711.7.35
by John Arbash Meinel
Factor out i18n bundle tests, so we don't always skip. |
862 |
committer=u'Erik B\xe5gfors') |
863 |
||
|
6973.7.10
by Jelmer Vernooij
More fixes. |
864 |
bundle = self.get_valid_bundle(b'i18n-2', b'i18n-3') |
|
1711.7.35
by John Arbash Meinel
Factor out i18n bundle tests, so we don't always skip. |
865 |
|
866 |
# Removed
|
|
|
3638.3.18
by Vincent Ladeuil
Fixed as per jam's review. |
867 |
self.tree1.remove([u'B\N{Euro Sign}gfors']) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
868 |
self.tree1.commit(u'removed', rev_id=b'i18n-4') |
|
1711.7.35
by John Arbash Meinel
Factor out i18n bundle tests, so we don't always skip. |
869 |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
870 |
bundle = self.get_valid_bundle(b'i18n-3', b'i18n-4') |
|
1711.7.35
by John Arbash Meinel
Factor out i18n bundle tests, so we don't always skip. |
871 |
|
872 |
# Rollup
|
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
873 |
bundle = self.get_valid_bundle(b'null:', b'i18n-4') |
|
1711.7.35
by John Arbash Meinel
Factor out i18n bundle tests, so we don't always skip. |
874 |
|
|
1711.7.34
by John Arbash Meinel
Include a test to ensure bundles handle trailing whitespace. |
875 |
def test_whitespace_bundle(self): |
876 |
if sys.platform in ('win32', 'cygwin'): |
|
|
4241.14.13
by Vincent Ladeuil
Some more cleanup. |
877 |
raise tests.TestSkipped('Windows doesn\'t support filenames' |
878 |
' with tabs or trailing spaces') |
|
|
1711.7.34
by John Arbash Meinel
Include a test to ensure bundles handle trailing whitespace. |
879 |
self.tree1 = self.make_branch_and_tree('b1') |
880 |
self.b1 = self.tree1.branch |
|
881 |
||
882 |
self.build_tree(['b1/trailing space ']) |
|
883 |
self.tree1.add(['trailing space ']) |
|
884 |
# TODO: jam 20060701 Check for handling files with '\t' characters
|
|
885 |
# once we actually support them
|
|
886 |
||
887 |
# Added
|
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
888 |
self.tree1.commit('funky whitespace', rev_id=b'white-1') |
|
1711.7.34
by John Arbash Meinel
Include a test to ensure bundles handle trailing whitespace. |
889 |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
890 |
bundle = self.get_valid_bundle(b'null:', b'white-1') |
|
1711.7.34
by John Arbash Meinel
Include a test to ensure bundles handle trailing whitespace. |
891 |
|
892 |
# Modified
|
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
893 |
with open('b1/trailing space ', 'ab') as f: |
894 |
f.write(b'add some text\n') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
895 |
self.tree1.commit('add text', rev_id=b'white-2') |
|
1711.7.34
by John Arbash Meinel
Include a test to ensure bundles handle trailing whitespace. |
896 |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
897 |
bundle = self.get_valid_bundle(b'white-1', b'white-2') |
|
1711.7.34
by John Arbash Meinel
Include a test to ensure bundles handle trailing whitespace. |
898 |
|
899 |
# Renamed
|
|
900 |
self.tree1.rename_one('trailing space ', ' start and end space ') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
901 |
self.tree1.commit('rename', rev_id=b'white-3') |
|
1711.7.34
by John Arbash Meinel
Include a test to ensure bundles handle trailing whitespace. |
902 |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
903 |
bundle = self.get_valid_bundle(b'white-2', b'white-3') |
|
1711.7.34
by John Arbash Meinel
Include a test to ensure bundles handle trailing whitespace. |
904 |
|
905 |
# Removed
|
|
906 |
self.tree1.remove([' start and end space ']) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
907 |
self.tree1.commit('removed', rev_id=b'white-4') |
|
1711.7.34
by John Arbash Meinel
Include a test to ensure bundles handle trailing whitespace. |
908 |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
909 |
bundle = self.get_valid_bundle(b'white-3', b'white-4') |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
910 |
|
|
1711.7.34
by John Arbash Meinel
Include a test to ensure bundles handle trailing whitespace. |
911 |
# Now test a complet roll-up
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
912 |
bundle = self.get_valid_bundle(b'null:', b'white-4') |
|
1711.7.34
by John Arbash Meinel
Include a test to ensure bundles handle trailing whitespace. |
913 |
|
|
1793.3.9
by John Arbash Meinel
Add a test to timezone for non integer tz offsets |
914 |
def test_alt_timezone_bundle(self): |
|
1986.1.2
by Robert Collins
Various changes to allow non-workingtree specific tests to run entirely |
915 |
self.tree1 = self.make_branch_and_memory_tree('b1') |
|
1793.3.9
by John Arbash Meinel
Add a test to timezone for non integer tz offsets |
916 |
self.b1 = self.tree1.branch |
|
1986.1.2
by Robert Collins
Various changes to allow non-workingtree specific tests to run entirely |
917 |
builder = treebuilder.TreeBuilder() |
|
1793.3.9
by John Arbash Meinel
Add a test to timezone for non integer tz offsets |
918 |
|
|
1986.1.2
by Robert Collins
Various changes to allow non-workingtree specific tests to run entirely |
919 |
self.tree1.lock_write() |
920 |
builder.start_tree(self.tree1) |
|
921 |
builder.build(['newfile']) |
|
922 |
builder.finish_tree() |
|
|
1793.3.9
by John Arbash Meinel
Add a test to timezone for non integer tz offsets |
923 |
|
924 |
# Asia/Colombo offset = 5 hours 30 minutes
|
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
925 |
self.tree1.commit('non-hour offset timezone', rev_id=b'tz-1', |
|
1793.3.9
by John Arbash Meinel
Add a test to timezone for non integer tz offsets |
926 |
timezone=19800, timestamp=1152544886.0) |
927 |
||
|
6973.7.10
by Jelmer Vernooij
More fixes. |
928 |
bundle = self.get_valid_bundle(b'null:', b'tz-1') |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
929 |
|
|
1793.3.9
by John Arbash Meinel
Add a test to timezone for non integer tz offsets |
930 |
rev = bundle.revisions[0] |
931 |
self.assertEqual('Mon 2006-07-10 20:51:26.000000000 +0530', rev.date) |
|
932 |
self.assertEqual(19800, rev.timezone) |
|
933 |
self.assertEqual(1152544886.0, rev.timestamp) |
|
|
1986.1.2
by Robert Collins
Various changes to allow non-workingtree specific tests to run entirely |
934 |
self.tree1.unlock() |
|
1793.3.9
by John Arbash Meinel
Add a test to timezone for non integer tz offsets |
935 |
|
|
1910.2.1
by Aaron Bentley
Ensure root entry always has a revision |
936 |
def test_bundle_root_id(self): |
937 |
self.tree1 = self.make_branch_and_tree('b1') |
|
938 |
self.b1 = self.tree1.branch |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
939 |
self.tree1.commit('message', rev_id=b'revid1') |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
940 |
bundle = self.get_valid_bundle(b'null:', b'revid1') |
941 |
tree = self.get_bundle_tree(bundle, b'revid1') |
|
|
7141.7.1
by Jelmer Vernooij
Get rid of file_ids in most of Tree. |
942 |
root_revision = tree.get_file_revision(u'') |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
943 |
self.assertEqual(b'revid1', root_revision) |
|
1910.2.1
by Aaron Bentley
Ensure root entry always has a revision |
944 |
|
|
1551.14.9
by Aaron Bentley
rename get_target_revision to install_revisions |
945 |
def test_install_revisions(self): |
|
1551.14.4
by Aaron Bentley
Change bundle reader and merge directive to both be 'mergeables' |
946 |
self.tree1 = self.make_branch_and_tree('b1') |
947 |
self.b1 = self.tree1.branch |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
948 |
self.tree1.commit('message', rev_id=b'rev2a') |
|
6973.5.2
by Jelmer Vernooij
Add more bees. |
949 |
bundle = self.get_valid_bundle(b'null:', b'rev2a') |
|
1551.14.4
by Aaron Bentley
Change bundle reader and merge directive to both be 'mergeables' |
950 |
branch2 = self.make_branch('b2') |
|
6973.5.2
by Jelmer Vernooij
Add more bees. |
951 |
self.assertFalse(branch2.repository.has_revision(b'rev2a')) |
|
1551.14.9
by Aaron Bentley
rename get_target_revision to install_revisions |
952 |
target_revision = bundle.install_revisions(branch2.repository) |
|
6973.5.2
by Jelmer Vernooij
Add more bees. |
953 |
self.assertTrue(branch2.repository.has_revision(b'rev2a')) |
954 |
self.assertEqual(b'rev2a', target_revision) |
|
|
1551.14.4
by Aaron Bentley
Change bundle reader and merge directive to both be 'mergeables' |
955 |
|
|
2447.1.2
by John Arbash Meinel
Add tests that we handle empty values whether they end in ': \n' or ':\n'. |
956 |
def test_bundle_empty_property(self): |
957 |
"""Test serializing revision properties with an empty value.""" |
|
958 |
tree = self.make_branch_and_memory_tree('tree') |
|
959 |
tree.lock_write() |
|
960 |
self.addCleanup(tree.unlock) |
|
|
6973.5.2
by Jelmer Vernooij
Add more bees. |
961 |
tree.add([''], [b'TREE_ROOT']) |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
962 |
tree.commit('One', revprops={u'one': 'two', |
963 |
u'empty': ''}, rev_id=b'rev1') |
|
|
2447.1.2
by John Arbash Meinel
Add tests that we handle empty values whether they end in ': \n' or ':\n'. |
964 |
self.b1 = tree.branch |
|
6973.5.2
by Jelmer Vernooij
Add more bees. |
965 |
bundle_sio, revision_ids = self.create_bundle_text(b'null:', b'rev1') |
|
2520.4.33
by Aaron Bentley
remove test dependencies on serialization minutia |
966 |
bundle = read_bundle(bundle_sio) |
967 |
revision_info = bundle.revisions[0] |
|
|
6973.5.2
by Jelmer Vernooij
Add more bees. |
968 |
self.assertEqual(b'rev1', revision_info.revision_id) |
|
2520.4.33
by Aaron Bentley
remove test dependencies on serialization minutia |
969 |
rev = revision_info.as_revision() |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
970 |
self.assertEqual({'branch-nick': 'tree', 'empty': '', 'one': 'two'}, |
|
2520.4.33
by Aaron Bentley
remove test dependencies on serialization minutia |
971 |
rev.properties) |
972 |
||
973 |
def test_bundle_sorted_properties(self): |
|
974 |
"""For stability the writer should write properties in sorted order.""" |
|
975 |
tree = self.make_branch_and_memory_tree('tree') |
|
976 |
tree.lock_write() |
|
977 |
self.addCleanup(tree.unlock) |
|
978 |
||
|
6963.2.18
by Jelmer Vernooij
Add bees to some of bp.weave_fmt. |
979 |
tree.add([''], [b'TREE_ROOT']) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
980 |
tree.commit('One', rev_id=b'rev1', |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
981 |
revprops={u'a': '4', u'b': '3', u'c': '2', u'd': '1'}) |
|
2520.4.33
by Aaron Bentley
remove test dependencies on serialization minutia |
982 |
self.b1 = tree.branch |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
983 |
bundle_sio, revision_ids = self.create_bundle_text(b'null:', b'rev1') |
|
2520.4.33
by Aaron Bentley
remove test dependencies on serialization minutia |
984 |
bundle = read_bundle(bundle_sio) |
985 |
revision_info = bundle.revisions[0] |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
986 |
self.assertEqual(b'rev1', revision_info.revision_id) |
|
2520.4.33
by Aaron Bentley
remove test dependencies on serialization minutia |
987 |
rev = revision_info.as_revision() |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
988 |
self.assertEqual({'branch-nick': 'tree', 'a': '4', 'b': '3', 'c': '2', |
989 |
'd': '1'}, rev.properties) |
|
|
2520.4.33
by Aaron Bentley
remove test dependencies on serialization minutia |
990 |
|
991 |
def test_bundle_unicode_properties(self): |
|
992 |
"""We should be able to round trip a non-ascii property.""" |
|
993 |
tree = self.make_branch_and_memory_tree('tree') |
|
994 |
tree.lock_write() |
|
995 |
self.addCleanup(tree.unlock) |
|
996 |
||
|
6963.2.18
by Jelmer Vernooij
Add bees to some of bp.weave_fmt. |
997 |
tree.add([''], [b'TREE_ROOT']) |
|
2520.4.33
by Aaron Bentley
remove test dependencies on serialization minutia |
998 |
# Revisions themselves do not require anything about revision property
|
999 |
# keys, other than that they are a basestring, and do not contain
|
|
1000 |
# whitespace.
|
|
1001 |
# However, Testaments assert than they are str(), and thus should not
|
|
1002 |
# be Unicode.
|
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1003 |
tree.commit('One', rev_id=b'rev1', |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1004 |
revprops={u'omega': u'\u03a9', u'alpha': u'\u03b1'}) |
|
2520.4.33
by Aaron Bentley
remove test dependencies on serialization minutia |
1005 |
self.b1 = tree.branch |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
1006 |
bundle_sio, revision_ids = self.create_bundle_text(b'null:', b'rev1') |
|
2520.4.33
by Aaron Bentley
remove test dependencies on serialization minutia |
1007 |
bundle = read_bundle(bundle_sio) |
1008 |
revision_info = bundle.revisions[0] |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1009 |
self.assertEqual(b'rev1', revision_info.revision_id) |
|
2520.4.33
by Aaron Bentley
remove test dependencies on serialization minutia |
1010 |
rev = revision_info.as_revision() |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1011 |
self.assertEqual({'branch-nick': 'tree', 'omega': u'\u03a9', |
1012 |
'alpha': u'\u03b1'}, rev.properties) |
|
|
2520.4.33
by Aaron Bentley
remove test dependencies on serialization minutia |
1013 |
|
|
2520.4.43
by Aaron Bentley
Fix test suite |
1014 |
def test_bundle_with_ghosts(self): |
1015 |
tree = self.make_branch_and_tree('tree') |
|
1016 |
self.b1 = tree.branch |
|
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
1017 |
self.build_tree_contents([('tree/file', b'content1')]) |
|
2520.4.43
by Aaron Bentley
Fix test suite |
1018 |
tree.add(['file']) |
1019 |
tree.commit('rev1') |
|
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
1020 |
self.build_tree_contents([('tree/file', b'content2')]) |
1021 |
tree.add_parent_tree_id(b'ghost') |
|
1022 |
tree.commit('rev2', rev_id=b'rev2') |
|
1023 |
bundle = self.get_valid_bundle(b'null:', b'rev2') |
|
|
2520.4.43
by Aaron Bentley
Fix test suite |
1024 |
|
|
2520.4.97
by Aaron Bentley
Hack in support for inventory conversion |
1025 |
def make_simple_tree(self, format=None): |
1026 |
tree = self.make_branch_and_tree('b1', format=format) |
|
1027 |
self.b1 = tree.branch |
|
1028 |
self.build_tree(['b1/file']) |
|
1029 |
tree.add('file') |
|
1030 |
return tree |
|
1031 |
||
1032 |
def test_across_serializers(self): |
|
1033 |
tree = self.make_simple_tree('knit') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1034 |
tree.commit('hello', rev_id=b'rev1') |
1035 |
tree.commit('hello', rev_id=b'rev2') |
|
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
1036 |
bundle = read_bundle(self.create_bundle_text(b'null:', b'rev2')[0]) |
|
2520.4.97
by Aaron Bentley
Hack in support for inventory conversion |
1037 |
repo = self.make_repository('repo', format='dirstate-with-subtree') |
1038 |
bundle.install_revisions(repo) |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1039 |
inv_text = repo._get_inventory_xml(b'rev2') |
1040 |
self.assertNotContainsRe(inv_text, b'format="5"') |
|
1041 |
self.assertContainsRe(inv_text, b'format="7"') |
|
|
2520.4.99
by Aaron Bentley
Test conversion across models |
1042 |
|
|
3380.1.8
by Aaron Bentley
Test that the stored inventory hash is correct when bundles are used |
1043 |
def make_repo_with_installed_revisions(self): |
1044 |
tree = self.make_simple_tree('knit') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1045 |
tree.commit('hello', rev_id=b'rev1') |
1046 |
tree.commit('hello', rev_id=b'rev2') |
|
|
6973.5.2
by Jelmer Vernooij
Add more bees. |
1047 |
bundle = read_bundle(self.create_bundle_text(b'null:', b'rev2')[0]) |
|
3380.1.8
by Aaron Bentley
Test that the stored inventory hash is correct when bundles are used |
1048 |
repo = self.make_repository('repo', format='dirstate-with-subtree') |
1049 |
bundle.install_revisions(repo) |
|
1050 |
return repo |
|
1051 |
||
|
2520.4.99
by Aaron Bentley
Test conversion across models |
1052 |
def test_across_models(self): |
|
3380.1.8
by Aaron Bentley
Test that the stored inventory hash is correct when bundles are used |
1053 |
repo = self.make_repo_with_installed_revisions() |
|
6973.5.2
by Jelmer Vernooij
Add more bees. |
1054 |
inv = repo.get_inventory(b'rev2') |
1055 |
self.assertEqual(b'rev2', inv.root.revision) |
|
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
1056 |
root_id = inv.root.file_id |
1057 |
repo.lock_read() |
|
1058 |
self.addCleanup(repo.unlock) |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1059 |
self.assertEqual({(root_id, b'rev1'): (), |
1060 |
(root_id, b'rev2'): ((root_id, b'rev1'),)}, |
|
1061 |
repo.texts.get_parent_map([(root_id, b'rev1'), (root_id, b'rev2')])) |
|
|
2520.4.99
by Aaron Bentley
Test conversion across models |
1062 |
|
|
3380.1.8
by Aaron Bentley
Test that the stored inventory hash is correct when bundles are used |
1063 |
def test_inv_hash_across_serializers(self): |
1064 |
repo = self.make_repo_with_installed_revisions() |
|
|
6973.5.2
by Jelmer Vernooij
Add more bees. |
1065 |
recorded_inv_sha1 = repo.get_revision(b'rev2').inventory_sha1 |
1066 |
xml = repo._get_inventory_xml(b'rev2') |
|
|
4241.14.13
by Vincent Ladeuil
Some more cleanup. |
1067 |
self.assertEqual(osutils.sha_string(xml), recorded_inv_sha1) |
|
3380.1.8
by Aaron Bentley
Test that the stored inventory hash is correct when bundles are used |
1068 |
|
|
2520.4.99
by Aaron Bentley
Test conversion across models |
1069 |
def test_across_models_incompatible(self): |
1070 |
tree = self.make_simple_tree('dirstate-with-subtree') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1071 |
tree.commit('hello', rev_id=b'rev1') |
1072 |
tree.commit('hello', rev_id=b'rev2') |
|
|
2520.4.99
by Aaron Bentley
Test conversion across models |
1073 |
try: |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
1074 |
bundle = read_bundle(self.create_bundle_text(b'null:', b'rev1')[0]) |
|
2520.4.99
by Aaron Bentley
Test conversion across models |
1075 |
except errors.IncompatibleBundleFormat: |
|
4241.14.13
by Vincent Ladeuil
Some more cleanup. |
1076 |
raise tests.TestSkipped("Format 0.8 doesn't work with knit3") |
|
2520.4.99
by Aaron Bentley
Test conversion across models |
1077 |
repo = self.make_repository('repo', format='knit') |
1078 |
bundle.install_revisions(repo) |
|
1079 |
||
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
1080 |
bundle = read_bundle(self.create_bundle_text(b'null:', b'rev2')[0]) |
|
2520.4.99
by Aaron Bentley
Test conversion across models |
1081 |
self.assertRaises(errors.IncompatibleRevision, |
1082 |
bundle.install_revisions, repo) |
|
|
2520.4.97
by Aaron Bentley
Hack in support for inventory conversion |
1083 |
|
|
2520.4.109
by Aaron Bentley
start work on directive cherry-picking |
1084 |
def test_get_merge_request(self): |
1085 |
tree = self.make_simple_tree() |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1086 |
tree.commit('hello', rev_id=b'rev1') |
1087 |
tree.commit('hello', rev_id=b'rev2') |
|
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
1088 |
bundle = read_bundle(self.create_bundle_text(b'null:', b'rev1')[0]) |
|
2520.4.109
by Aaron Bentley
start work on directive cherry-picking |
1089 |
result = bundle.get_merge_request(tree.branch.repository) |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
1090 |
self.assertEqual((None, b'rev1', 'inapplicable'), result) |
|
2520.4.109
by Aaron Bentley
start work on directive cherry-picking |
1091 |
|
|
2520.5.1
by Aaron Bentley
Test installing revisions with subtrees |
1092 |
def test_with_subtree(self): |
1093 |
tree = self.make_branch_and_tree('tree', |
|
1094 |
format='dirstate-with-subtree') |
|
1095 |
self.b1 = tree.branch |
|
1096 |
subtree = self.make_branch_and_tree('tree/subtree', |
|
1097 |
format='dirstate-with-subtree') |
|
1098 |
tree.add('subtree') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1099 |
tree.commit('hello', rev_id=b'rev1') |
|
2520.5.1
by Aaron Bentley
Test installing revisions with subtrees |
1100 |
try: |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
1101 |
bundle = read_bundle(self.create_bundle_text(b'null:', b'rev1')[0]) |
|
2520.5.1
by Aaron Bentley
Test installing revisions with subtrees |
1102 |
except errors.IncompatibleBundleFormat: |
|
4241.14.13
by Vincent Ladeuil
Some more cleanup. |
1103 |
raise tests.TestSkipped("Format 0.8 doesn't work with knit3") |
|
2520.5.1
by Aaron Bentley
Test installing revisions with subtrees |
1104 |
if isinstance(bundle, v09.BundleInfo09): |
|
4241.14.13
by Vincent Ladeuil
Some more cleanup. |
1105 |
raise tests.TestSkipped("Format 0.9 doesn't work with subtrees") |
|
2520.5.1
by Aaron Bentley
Test installing revisions with subtrees |
1106 |
repo = self.make_repository('repo', format='knit') |
1107 |
self.assertRaises(errors.IncompatibleRevision, |
|
1108 |
bundle.install_revisions, repo) |
|
1109 |
repo2 = self.make_repository('repo2', format='dirstate-with-subtree') |
|
1110 |
bundle.install_revisions(repo2) |
|
1111 |
||
|
2520.4.127
by Aaron Bentley
Fix up name encoding to handle revision-ids with slashes |
1112 |
def test_revision_id_with_slash(self): |
1113 |
self.tree1 = self.make_branch_and_tree('tree') |
|
1114 |
self.b1 = self.tree1.branch |
|
1115 |
try: |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1116 |
self.tree1.commit('Revision/id/with/slashes', rev_id=b'rev/id') |
|
2520.4.127
by Aaron Bentley
Fix up name encoding to handle revision-ids with slashes |
1117 |
except ValueError: |
|
4241.14.13
by Vincent Ladeuil
Some more cleanup. |
1118 |
raise tests.TestSkipped( |
1119 |
"Repository doesn't support revision ids with slashes") |
|
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
1120 |
bundle = self.get_valid_bundle(b'null:', b'rev/id') |
|
2520.4.127
by Aaron Bentley
Fix up name encoding to handle revision-ids with slashes |
1121 |
|
|
2520.6.2
by Aaron Bentley
Fix bundle installation wrong-versionedfile bug |
1122 |
def test_skip_file(self): |
1123 |
"""Make sure we don't accidentally write to the wrong versionedfile""" |
|
1124 |
self.tree1 = self.make_branch_and_tree('tree') |
|
1125 |
self.b1 = self.tree1.branch |
|
1126 |
# rev1 is not present in bundle, done by fetch
|
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1127 |
self.build_tree_contents([('tree/file2', b'contents1')]) |
1128 |
self.tree1.add('file2', b'file2-id') |
|
1129 |
self.tree1.commit('rev1', rev_id=b'reva') |
|
1130 |
self.build_tree_contents([('tree/file3', b'contents2')]) |
|
|
2520.6.2
by Aaron Bentley
Fix bundle installation wrong-versionedfile bug |
1131 |
# rev2 is present in bundle, and done by fetch
|
1132 |
# having file1 in the bunle causes file1's versionedfile to be opened.
|
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1133 |
self.tree1.add('file3', b'file3-id') |
|
7058.3.5
by Jelmer Vernooij
Fix flappy skip_file test. |
1134 |
rev2 = self.tree1.commit('rev2') |
|
2520.6.2
by Aaron Bentley
Fix bundle installation wrong-versionedfile bug |
1135 |
# Updating file2 should not cause an attempt to add to file1's vf
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
1136 |
target = self.tree1.controldir.sprout('target').open_workingtree() |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1137 |
self.build_tree_contents([('tree/file2', b'contents3')]) |
1138 |
self.tree1.commit('rev3', rev_id=b'rev3') |
|
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
1139 |
bundle = self.get_valid_bundle(b'reva', b'rev3') |
|
2520.6.5
by Aaron Bentley
Skip for bundle formats that don't provide get_bundle_reader |
1140 |
if getattr(bundle, 'get_bundle_reader', None) is None: |
|
4241.14.13
by Vincent Ladeuil
Some more cleanup. |
1141 |
raise tests.TestSkipped('Bundle format cannot provide reader') |
|
7058.3.5
by Jelmer Vernooij
Fix flappy skip_file test. |
1142 |
file_ids = set( |
1143 |
(f, r) for b, m, k, r, f in bundle.get_bundle_reader().iter_records() |
|
1144 |
if f is not None) |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1145 |
self.assertEqual( |
1146 |
{(b'file2-id', b'rev3'), (b'file3-id', rev2)}, file_ids) |
|
|
2520.6.2
by Aaron Bentley
Fix bundle installation wrong-versionedfile bug |
1147 |
bundle.install_revisions(target.branch.repository) |
1148 |
||
|
2520.4.43
by Aaron Bentley
Fix test suite |
1149 |
|
|
4241.14.13
by Vincent Ladeuil
Some more cleanup. |
1150 |
class V08BundleTester(BundleTester, tests.TestCaseWithTransport): |
|
2520.4.33
by Aaron Bentley
remove test dependencies on serialization minutia |
1151 |
|
1152 |
format = '0.8' |
|
1153 |
||
1154 |
def test_bundle_empty_property(self): |
|
1155 |
"""Test serializing revision properties with an empty value.""" |
|
1156 |
tree = self.make_branch_and_memory_tree('tree') |
|
1157 |
tree.lock_write() |
|
1158 |
self.addCleanup(tree.unlock) |
|
|
6963.2.18
by Jelmer Vernooij
Add bees to some of bp.weave_fmt. |
1159 |
tree.add([''], [b'TREE_ROOT']) |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1160 |
tree.commit('One', revprops={u'one': 'two', |
1161 |
u'empty': ''}, rev_id=b'rev1') |
|
|
2520.4.33
by Aaron Bentley
remove test dependencies on serialization minutia |
1162 |
self.b1 = tree.branch |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
1163 |
bundle_sio, revision_ids = self.create_bundle_text(b'null:', b'rev1') |
|
2447.1.2
by John Arbash Meinel
Add tests that we handle empty values whether they end in ': \n' or ':\n'. |
1164 |
self.assertContainsRe(bundle_sio.getvalue(), |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1165 |
b'# properties:\n' |
1166 |
b'# branch-nick: tree\n' |
|
1167 |
b'# empty: \n' |
|
1168 |
b'# one: two\n' |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1169 |
)
|
|
2447.1.2
by John Arbash Meinel
Add tests that we handle empty values whether they end in ': \n' or ':\n'. |
1170 |
bundle = read_bundle(bundle_sio) |
1171 |
revision_info = bundle.revisions[0] |
|
|
7045.2.14
by Jelmer Vernooij
Fix some bundle tests.: |
1172 |
self.assertEqual(b'rev1', revision_info.revision_id) |
|
2447.1.2
by John Arbash Meinel
Add tests that we handle empty values whether they end in ': \n' or ':\n'. |
1173 |
rev = revision_info.as_revision() |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1174 |
self.assertEqual({'branch-nick': 'tree', 'empty': '', 'one': 'two'}, |
|
2447.1.2
by John Arbash Meinel
Add tests that we handle empty values whether they end in ': \n' or ':\n'. |
1175 |
rev.properties) |
1176 |
||
|
2520.4.79
by Aaron Bentley
Fixed up not-really-relevant munging tests |
1177 |
def get_bundle_tree(self, bundle, revision_id): |
1178 |
repository = self.make_repository('repo') |
|
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
1179 |
return bundle.revision_tree(repository, b'revid1') |
|
2520.4.79
by Aaron Bentley
Fixed up not-really-relevant munging tests |
1180 |
|
|
2447.1.2
by John Arbash Meinel
Add tests that we handle empty values whether they end in ': \n' or ':\n'. |
1181 |
def test_bundle_empty_property_alt(self): |
|
2447.1.3
by John Arbash Meinel
Change the default serializer to include a trailing whitespace for empty properties. |
1182 |
"""Test serializing revision properties with an empty value. |
1183 |
||
1184 |
Older readers had a bug when reading an empty property.
|
|
1185 |
They assumed that all keys ended in ': \n'. However they would write an
|
|
1186 |
empty value as ':\n'. This tests make sure that all newer bzr versions
|
|
1187 |
can handle th second form.
|
|
1188 |
"""
|
|
|
2447.1.2
by John Arbash Meinel
Add tests that we handle empty values whether they end in ': \n' or ':\n'. |
1189 |
tree = self.make_branch_and_memory_tree('tree') |
1190 |
tree.lock_write() |
|
1191 |
self.addCleanup(tree.unlock) |
|
|
6963.2.18
by Jelmer Vernooij
Add bees to some of bp.weave_fmt. |
1192 |
tree.add([''], [b'TREE_ROOT']) |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1193 |
tree.commit('One', revprops={u'one': 'two', |
1194 |
u'empty': ''}, rev_id=b'rev1') |
|
|
2447.1.2
by John Arbash Meinel
Add tests that we handle empty values whether they end in ': \n' or ':\n'. |
1195 |
self.b1 = tree.branch |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
1196 |
bundle_sio, revision_ids = self.create_bundle_text(b'null:', b'rev1') |
|
2447.1.2
by John Arbash Meinel
Add tests that we handle empty values whether they end in ': \n' or ':\n'. |
1197 |
txt = bundle_sio.getvalue() |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1198 |
loc = txt.find(b'# empty: ') + len(b'# empty:') |
|
2447.1.3
by John Arbash Meinel
Change the default serializer to include a trailing whitespace for empty properties. |
1199 |
# Create a new bundle, which strips the trailing space after empty
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1200 |
bundle_sio = BytesIO(txt[:loc] + txt[loc + 1:]) |
|
2447.1.2
by John Arbash Meinel
Add tests that we handle empty values whether they end in ': \n' or ':\n'. |
1201 |
|
1202 |
self.assertContainsRe(bundle_sio.getvalue(), |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1203 |
b'# properties:\n' |
1204 |
b'# branch-nick: tree\n' |
|
1205 |
b'# empty:\n' |
|
1206 |
b'# one: two\n' |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1207 |
)
|
|
2447.1.2
by John Arbash Meinel
Add tests that we handle empty values whether they end in ': \n' or ':\n'. |
1208 |
bundle = read_bundle(bundle_sio) |
1209 |
revision_info = bundle.revisions[0] |
|
|
7031.1.1
by Jelmer Vernooij
Fix breezy.tests.test_diff. |
1210 |
self.assertEqual(b'rev1', revision_info.revision_id) |
|
2447.1.2
by John Arbash Meinel
Add tests that we handle empty values whether they end in ': \n' or ':\n'. |
1211 |
rev = revision_info.as_revision() |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1212 |
self.assertEqual({'branch-nick': 'tree', 'empty': '', 'one': 'two'}, |
|
2447.1.2
by John Arbash Meinel
Add tests that we handle empty values whether they end in ': \n' or ':\n'. |
1213 |
rev.properties) |
1214 |
||
|
2447.1.1
by John Arbash Meinel
For stability and ease of testing, write properties in sorted order. |
1215 |
def test_bundle_sorted_properties(self): |
1216 |
"""For stability the writer should write properties in sorted order.""" |
|
1217 |
tree = self.make_branch_and_memory_tree('tree') |
|
1218 |
tree.lock_write() |
|
1219 |
self.addCleanup(tree.unlock) |
|
1220 |
||
|
6963.2.18
by Jelmer Vernooij
Add bees to some of bp.weave_fmt. |
1221 |
tree.add([''], [b'TREE_ROOT']) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1222 |
tree.commit('One', rev_id=b'rev1', |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1223 |
revprops={u'a': '4', u'b': '3', u'c': '2', u'd': '1'}) |
|
2447.1.1
by John Arbash Meinel
For stability and ease of testing, write properties in sorted order. |
1224 |
self.b1 = tree.branch |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
1225 |
bundle_sio, revision_ids = self.create_bundle_text(b'null:', b'rev1') |
|
2447.1.1
by John Arbash Meinel
For stability and ease of testing, write properties in sorted order. |
1226 |
self.assertContainsRe(bundle_sio.getvalue(), |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1227 |
b'# properties:\n' |
1228 |
b'# a: 4\n' |
|
1229 |
b'# b: 3\n' |
|
1230 |
b'# branch-nick: tree\n' |
|
1231 |
b'# c: 2\n' |
|
1232 |
b'# d: 1\n' |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1233 |
)
|
|
2447.1.4
by John Arbash Meinel
Add a test that we properly round-trip unicode properties. |
1234 |
bundle = read_bundle(bundle_sio) |
1235 |
revision_info = bundle.revisions[0] |
|
|
7031.1.1
by Jelmer Vernooij
Fix breezy.tests.test_diff. |
1236 |
self.assertEqual(b'rev1', revision_info.revision_id) |
|
2447.1.4
by John Arbash Meinel
Add a test that we properly round-trip unicode properties. |
1237 |
rev = revision_info.as_revision() |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1238 |
self.assertEqual({'branch-nick': 'tree', 'a': '4', 'b': '3', 'c': '2', |
1239 |
'd': '1'}, rev.properties) |
|
|
2447.1.4
by John Arbash Meinel
Add a test that we properly round-trip unicode properties. |
1240 |
|
1241 |
def test_bundle_unicode_properties(self): |
|
1242 |
"""We should be able to round trip a non-ascii property.""" |
|
1243 |
tree = self.make_branch_and_memory_tree('tree') |
|
1244 |
tree.lock_write() |
|
1245 |
self.addCleanup(tree.unlock) |
|
1246 |
||
|
6963.2.18
by Jelmer Vernooij
Add bees to some of bp.weave_fmt. |
1247 |
tree.add([''], [b'TREE_ROOT']) |
|
2447.1.4
by John Arbash Meinel
Add a test that we properly round-trip unicode properties. |
1248 |
# Revisions themselves do not require anything about revision property
|
1249 |
# keys, other than that they are a basestring, and do not contain
|
|
1250 |
# whitespace.
|
|
1251 |
# However, Testaments assert than they are str(), and thus should not
|
|
1252 |
# be Unicode.
|
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1253 |
tree.commit('One', rev_id=b'rev1', |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1254 |
revprops={u'omega': u'\u03a9', u'alpha': u'\u03b1'}) |
|
2447.1.4
by John Arbash Meinel
Add a test that we properly round-trip unicode properties. |
1255 |
self.b1 = tree.branch |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
1256 |
bundle_sio, revision_ids = self.create_bundle_text(b'null:', b'rev1') |
|
2447.1.4
by John Arbash Meinel
Add a test that we properly round-trip unicode properties. |
1257 |
self.assertContainsRe(bundle_sio.getvalue(), |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1258 |
b'# properties:\n' |
1259 |
b'# alpha: \xce\xb1\n' |
|
1260 |
b'# branch-nick: tree\n' |
|
1261 |
b'# omega: \xce\xa9\n' |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1262 |
)
|
|
2447.1.4
by John Arbash Meinel
Add a test that we properly round-trip unicode properties. |
1263 |
bundle = read_bundle(bundle_sio) |
1264 |
revision_info = bundle.revisions[0] |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1265 |
self.assertEqual(b'rev1', revision_info.revision_id) |
|
2447.1.4
by John Arbash Meinel
Add a test that we properly round-trip unicode properties. |
1266 |
rev = revision_info.as_revision() |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1267 |
self.assertEqual({'branch-nick': 'tree', 'omega': u'\u03a9', |
1268 |
'alpha': u'\u03b1'}, rev.properties) |
|
|
2447.1.1
by John Arbash Meinel
For stability and ease of testing, write properties in sorted order. |
1269 |
|
|
1793.3.2
by John Arbash Meinel
(failing) add some tests which munge trailing whitespace |
1270 |
|
|
1910.2.59
by Aaron Bentley
Test 0.9 bundles for knit format1 and knit format2 |
1271 |
class V09BundleKnit2Tester(V08BundleTester): |
|
1910.2.50
by Aaron Bentley
start work on format 0.9 serializer |
1272 |
|
1273 |
format = '0.9' |
|
1274 |
||
1275 |
def bzrdir_format(self): |
|
1276 |
format = bzrdir.BzrDirMetaFormat1() |
|
|
2255.2.211
by Robert Collins
Remove knit2 repository format- it has never been supported. |
1277 |
format.repository_format = knitrepo.RepositoryFormatKnit3() |
|
1910.2.50
by Aaron Bentley
start work on format 0.9 serializer |
1278 |
return format |
1279 |
||
1280 |
||
|
1910.2.59
by Aaron Bentley
Test 0.9 bundles for knit format1 and knit format2 |
1281 |
class V09BundleKnit1Tester(V08BundleTester): |
1282 |
||
1283 |
format = '0.9' |
|
1284 |
||
1285 |
def bzrdir_format(self): |
|
1286 |
format = bzrdir.BzrDirMetaFormat1() |
|
|
2241.1.6
by Martin Pool
Move Knit repositories into the submodule bzrlib.repofmt.knitrepo and |
1287 |
format.repository_format = knitrepo.RepositoryFormatKnit1() |
|
1910.2.59
by Aaron Bentley
Test 0.9 bundles for knit format1 and knit format2 |
1288 |
return format |
1289 |
||
1290 |
||
|
4241.14.13
by Vincent Ladeuil
Some more cleanup. |
1291 |
class V4BundleTester(BundleTester, tests.TestCaseWithTransport): |
|
2520.4.14
by Aaron Bentley
Get most tests passing, use format header |
1292 |
|
|
2520.4.136
by Aaron Bentley
Fix format strings |
1293 |
format = '4' |
|
2520.4.14
by Aaron Bentley
Get most tests passing, use format header |
1294 |
|
1295 |
def get_valid_bundle(self, base_rev_id, rev_id, checkout_dir=None): |
|
1296 |
"""Create a bundle from base_rev_id -> rev_id in built-in branch. |
|
1297 |
Make sure that the text generated is valid, and that it
|
|
1298 |
can be applied against the base, and generate the same information.
|
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
1299 |
|
1300 |
:return: The in-memory bundle
|
|
|
2520.4.14
by Aaron Bentley
Get most tests passing, use format header |
1301 |
"""
|
1302 |
bundle_txt, rev_ids = self.create_bundle_text(base_rev_id, rev_id) |
|
1303 |
||
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
1304 |
# This should also validate the generated bundle
|
|
2520.4.14
by Aaron Bentley
Get most tests passing, use format header |
1305 |
bundle = read_bundle(bundle_txt) |
1306 |
repository = self.b1.repository |
|
1307 |
for bundle_rev in bundle.real_revisions: |
|
1308 |
# These really should have already been checked when we read the
|
|
1309 |
# bundle, since it computes the sha1 hash for the revision, which
|
|
1310 |
# only will match if everything is okay, but lets be explicit about
|
|
1311 |
# it
|
|
1312 |
branch_rev = repository.get_revision(bundle_rev.revision_id) |
|
1313 |
for a in ('inventory_sha1', 'revision_id', 'parent_ids', |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
1314 |
'timestamp', 'timezone', 'message', 'committer', |
|
2520.4.14
by Aaron Bentley
Get most tests passing, use format header |
1315 |
'parent_ids', 'properties'): |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
1316 |
self.assertEqual(getattr(branch_rev, a), |
|
2520.4.14
by Aaron Bentley
Get most tests passing, use format header |
1317 |
getattr(bundle_rev, a)) |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
1318 |
self.assertEqual(len(branch_rev.parent_ids), |
|
2520.4.14
by Aaron Bentley
Get most tests passing, use format header |
1319 |
len(bundle_rev.parent_ids)) |
|
2520.4.29
by Aaron Bentley
Reactivate some testing, fix topo_iter |
1320 |
self.assertEqual(set(rev_ids), |
|
6619.3.12
by Jelmer Vernooij
Use 2to3 set_literal fixer. |
1321 |
{r.revision_id for r in bundle.real_revisions}) |
|
2520.4.14
by Aaron Bentley
Get most tests passing, use format header |
1322 |
self.valid_apply_bundle(base_rev_id, bundle, |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1323 |
checkout_dir=checkout_dir) |
|
2520.4.14
by Aaron Bentley
Get most tests passing, use format header |
1324 |
|
1325 |
return bundle |
|
1326 |
||
|
2520.4.34
by Aaron Bentley
Add signature support |
1327 |
def get_invalid_bundle(self, base_rev_id, rev_id): |
1328 |
"""Create a bundle from base_rev_id -> rev_id in built-in branch. |
|
1329 |
Munge the text so that it's invalid.
|
|
1330 |
||
1331 |
:return: The in-memory bundle
|
|
1332 |
"""
|
|
|
7358.12.1
by Jelmer Vernooij
Move bundle code to breezy.bzr. |
1333 |
from ..bzr.bundle import serializer |
|
2520.4.34
by Aaron Bentley
Add signature support |
1334 |
bundle_txt, rev_ids = self.create_bundle_text(base_rev_id, rev_id) |
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
1335 |
new_text = self.get_raw(BytesIO(b''.join(bundle_txt))) |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1336 |
new_text = new_text.replace(b'<file file_id="exe-1"', |
1337 |
b'<file executable="y" file_id="exe-1"') |
|
1338 |
new_text = new_text.replace(b'B260', b'B275') |
|
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
1339 |
bundle_txt = BytesIO() |
|
2520.4.136
by Aaron Bentley
Fix format strings |
1340 |
bundle_txt.write(serializer._get_bundle_header('4')) |
|
6973.7.5
by Jelmer Vernooij
s/file/open. |
1341 |
bundle_txt.write(b'\n') |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1342 |
bundle_txt.write(bz2.compress(new_text)) |
|
2520.4.34
by Aaron Bentley
Add signature support |
1343 |
bundle_txt.seek(0) |
1344 |
bundle = read_bundle(bundle_txt) |
|
1345 |
self.valid_apply_bundle(base_rev_id, bundle) |
|
1346 |
return bundle |
|
1347 |
||
|
2520.4.14
by Aaron Bentley
Get most tests passing, use format header |
1348 |
def create_bundle_text(self, base_rev_id, rev_id): |
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
1349 |
bundle_txt = BytesIO() |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
1350 |
rev_ids = write_bundle(self.b1.repository, rev_id, base_rev_id, |
|
2520.4.14
by Aaron Bentley
Get most tests passing, use format header |
1351 |
bundle_txt, format=self.format) |
1352 |
bundle_txt.seek(0) |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
1353 |
self.assertEqual(bundle_txt.readline(), |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
1354 |
b'# Bazaar revision bundle v%s\n' % self.format.encode('ascii')) |
1355 |
self.assertEqual(bundle_txt.readline(), b'#\n') |
|
|
2520.4.14
by Aaron Bentley
Get most tests passing, use format header |
1356 |
rev = self.b1.repository.get_revision(rev_id) |
1357 |
bundle_txt.seek(0) |
|
1358 |
return bundle_txt, rev_ids |
|
|
2520.4.4
by Aaron Bentley
Get basis support for a new bundle format in place |
1359 |
|
|
2520.4.79
by Aaron Bentley
Fixed up not-really-relevant munging tests |
1360 |
def get_bundle_tree(self, bundle, revision_id): |
1361 |
repository = self.make_repository('repo') |
|
1362 |
bundle.install_revisions(repository) |
|
1363 |
return repository.revision_tree(revision_id) |
|
1364 |
||
|
2520.4.4
by Aaron Bentley
Get basis support for a new bundle format in place |
1365 |
def test_creation(self): |
1366 |
tree = self.make_branch_and_tree('tree') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1367 |
self.build_tree_contents([('tree/file', b'contents1\nstatic\n')]) |
|
6973.5.2
by Jelmer Vernooij
Add more bees. |
1368 |
tree.add('file', b'fileid-2') |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1369 |
tree.commit('added file', rev_id=b'rev1') |
1370 |
self.build_tree_contents([('tree/file', b'contents2\nstatic\n')]) |
|
1371 |
tree.commit('changed file', rev_id=b'rev2') |
|
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
1372 |
s = BytesIO() |
|
2520.4.72
by Aaron Bentley
Rename format to 4alpha |
1373 |
serializer = BundleSerializerV4('1.0') |
|
7029.2.2
by Jelmer Vernooij
Fix two tests. |
1374 |
with tree.lock_read(): |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1375 |
serializer.write_bundle( |
1376 |
tree.branch.repository, b'rev2', b'null:', s) |
|
|
2520.4.5
by Aaron Bentley
Start work on reading mpbundles |
1377 |
s.seek(0) |
|
2520.4.6
by Aaron Bentley
Get installation started |
1378 |
tree2 = self.make_branch_and_tree('target') |
1379 |
target_repo = tree2.branch.repository |
|
1380 |
install_bundle(target_repo, serializer.read(s)) |
|
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
1381 |
target_repo.lock_read() |
1382 |
self.addCleanup(target_repo.unlock) |
|
|
4202.1.1
by John Arbash Meinel
Update Repository.iter_files_bytes() to return an iterable of bytestrings. |
1383 |
# Turn the 'iterators_of_bytes' back into simple strings for comparison
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1384 |
repo_texts = dict((i, b''.join(content)) for i, content |
|
4202.1.1
by John Arbash Meinel
Update Repository.iter_files_bytes() to return an iterable of bytestrings. |
1385 |
in target_repo.iter_files_bytes( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1386 |
[(b'fileid-2', b'rev1', '1'), |
1387 |
(b'fileid-2', b'rev2', '2')])) |
|
1388 |
self.assertEqual({'1': b'contents1\nstatic\n', |
|
1389 |
'2': b'contents2\nstatic\n'}, |
|
|
4202.1.1
by John Arbash Meinel
Update Repository.iter_files_bytes() to return an iterable of bytestrings. |
1390 |
repo_texts) |
|
6973.5.2
by Jelmer Vernooij
Add more bees. |
1391 |
rtree = target_repo.revision_tree(b'rev2') |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
1392 |
inventory_vf = target_repo.inventories |
1393 |
# If the inventory store has a graph, it must match the revision graph.
|
|
1394 |
self.assertSubset( |
|
|
6973.5.2
by Jelmer Vernooij
Add more bees. |
1395 |
[inventory_vf.get_parent_map([(b'rev2',)])[(b'rev2',)]], |
1396 |
[None, ((b'rev1',),)]) |
|
|
2520.4.10
by Aaron Bentley
Enable installation of revisions |
1397 |
self.assertEqual('changed file', |
|
6973.5.2
by Jelmer Vernooij
Add more bees. |
1398 |
target_repo.get_revision(b'rev2').message) |
|
2520.4.6
by Aaron Bentley
Get installation started |
1399 |
|
|
2520.4.32
by Aaron Bentley
Fix test case |
1400 |
@staticmethod
|
1401 |
def get_raw(bundle_file): |
|
1402 |
bundle_file.seek(0) |
|
|
2520.4.70
by Aaron Bentley
Yank patch-handling functionality |
1403 |
line = bundle_file.readline() |
1404 |
line = bundle_file.readline() |
|
|
2520.4.32
by Aaron Bentley
Fix test case |
1405 |
lines = bundle_file.readlines() |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1406 |
return bz2.decompress(b''.join(lines)) |
|
2520.4.32
by Aaron Bentley
Fix test case |
1407 |
|
|
2520.4.34
by Aaron Bentley
Add signature support |
1408 |
def test_copy_signatures(self): |
1409 |
tree_a = self.make_branch_and_tree('tree_a') |
|
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
1410 |
import breezy.gpg |
1411 |
import breezy.commit as commit |
|
1412 |
oldstrategy = breezy.gpg.GPGStrategy |
|
|
2520.4.34
by Aaron Bentley
Add signature support |
1413 |
branch = tree_a.branch |
1414 |
repo_a = branch.repository |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1415 |
tree_a.commit("base", allow_pointless=True, rev_id=b'A') |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1416 |
self.assertFalse(branch.repository.has_signature_for_revision_id(b'A')) |
|
2520.4.34
by Aaron Bentley
Add signature support |
1417 |
try: |
|
7206.4.1
by Jelmer Vernooij
Move breezy.testament to breezy.bzr.testament. |
1418 |
from ..bzr.testament import Testament |
|
2520.4.34
by Aaron Bentley
Add signature support |
1419 |
# monkey patch gpg signing mechanism
|
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
1420 |
breezy.gpg.GPGStrategy = breezy.gpg.LoopbackGPGStrategy |
|
6393.1.1
by Vincent Ladeuil
Provides MemoryStack to simplify configuration setup in tests |
1421 |
new_config = test_commit.MustSignConfig() |
|
6351.3.3
by Jelmer Vernooij
Convert more stuff to use config stacks. |
1422 |
commit.Commit(config_stack=new_config).commit(message="base", |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1423 |
allow_pointless=True, |
1424 |
rev_id=b'B', |
|
1425 |
working_tree=tree_a) |
|
1426 |
||
|
2520.4.34
by Aaron Bentley
Add signature support |
1427 |
def sign(text): |
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
1428 |
return breezy.gpg.LoopbackGPGStrategy(None).sign(text) |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1429 |
self.assertTrue(repo_a.has_signature_for_revision_id(b'B')) |
|
2520.4.34
by Aaron Bentley
Add signature support |
1430 |
finally: |
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
1431 |
breezy.gpg.GPGStrategy = oldstrategy |
|
2520.4.34
by Aaron Bentley
Add signature support |
1432 |
tree_b = self.make_branch_and_tree('tree_b') |
1433 |
repo_b = tree_b.branch.repository |
|
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
1434 |
s = BytesIO() |
|
2520.4.136
by Aaron Bentley
Fix format strings |
1435 |
serializer = BundleSerializerV4('4') |
|
7029.2.2
by Jelmer Vernooij
Fix two tests. |
1436 |
with tree_a.lock_read(): |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1437 |
serializer.write_bundle( |
1438 |
tree_a.branch.repository, b'B', b'null:', s) |
|
|
2520.4.34
by Aaron Bentley
Add signature support |
1439 |
s.seek(0) |
1440 |
install_bundle(repo_b, serializer.read(s)) |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1441 |
self.assertTrue(repo_b.has_signature_for_revision_id(b'B')) |
1442 |
self.assertEqual(repo_b.get_signature_text(b'B'), |
|
1443 |
repo_a.get_signature_text(b'B')) |
|
|
2520.4.100
by Aaron Bentley
Fix repeat signature installs |
1444 |
s.seek(0) |
1445 |
# ensure repeat installs are harmless
|
|
1446 |
install_bundle(repo_b, serializer.read(s)) |
|
|
2520.4.34
by Aaron Bentley
Add signature support |
1447 |
|
|
2520.4.4
by Aaron Bentley
Get basis support for a new bundle format in place |
1448 |
|
|
4543.2.4
by John Arbash Meinel
Start working on code that will use Repository._serializer.write_inventory_to_strig. |
1449 |
class V4_2aBundleTester(V4BundleTester): |
1450 |
||
1451 |
def bzrdir_format(self): |
|
1452 |
return '2a' |
|
1453 |
||
|
4543.2.8
by John Arbash Meinel
Add a custom get_invalid_bundle and allow BadBundle to be |
1454 |
def get_invalid_bundle(self, base_rev_id, rev_id): |
1455 |
"""Create a bundle from base_rev_id -> rev_id in built-in branch. |
|
1456 |
Munge the text so that it's invalid.
|
|
1457 |
||
1458 |
:return: The in-memory bundle
|
|
1459 |
"""
|
|
|
7358.12.1
by Jelmer Vernooij
Move bundle code to breezy.bzr. |
1460 |
from ..bzr.bundle import serializer |
|
4543.2.8
by John Arbash Meinel
Add a custom get_invalid_bundle and allow BadBundle to be |
1461 |
bundle_txt, rev_ids = self.create_bundle_text(base_rev_id, rev_id) |
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
1462 |
new_text = self.get_raw(BytesIO(b''.join(bundle_txt))) |
|
4543.2.9
by John Arbash Meinel
Down to 2 failing tests. |
1463 |
# We are going to be replacing some text to set the executable bit on a
|
1464 |
# file. Make sure the text replacement actually works correctly.
|
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1465 |
self.assertContainsRe(new_text, b'(?m)B244\n\ni 1\n<inventory') |
1466 |
new_text = new_text.replace(b'<file file_id="exe-1"', |
|
1467 |
b'<file executable="y" file_id="exe-1"') |
|
1468 |
new_text = new_text.replace(b'B244', b'B259') |
|
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
1469 |
bundle_txt = BytesIO() |
|
4543.2.8
by John Arbash Meinel
Add a custom get_invalid_bundle and allow BadBundle to be |
1470 |
bundle_txt.write(serializer._get_bundle_header('4')) |
|
6973.7.5
by Jelmer Vernooij
s/file/open. |
1471 |
bundle_txt.write(b'\n') |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1472 |
bundle_txt.write(bz2.compress(new_text)) |
|
4543.2.8
by John Arbash Meinel
Add a custom get_invalid_bundle and allow BadBundle to be |
1473 |
bundle_txt.seek(0) |
1474 |
bundle = read_bundle(bundle_txt) |
|
1475 |
self.valid_apply_bundle(base_rev_id, bundle) |
|
1476 |
return bundle |
|
1477 |
||
|
4543.2.5
by John Arbash Meinel
Fix issues with keys/ids and ghost handling. |
1478 |
def make_merged_branch(self): |
|
4543.2.6
by John Arbash Meinel
redefinning self.bzrdir_format() automatically sets the default format. |
1479 |
builder = self.make_branch_builder('source') |
|
4543.2.4
by John Arbash Meinel
Start working on code that will use Repository._serializer.write_inventory_to_strig. |
1480 |
builder.start_series() |
|
6816.2.1
by Jelmer Vernooij
Migrate some build_snapshot code over to having revision_id as keyword argument. |
1481 |
builder.build_snapshot(None, [ |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1482 |
('add', ('', b'root-id', 'directory', None)), |
1483 |
('add', ('file', b'file-id', 'file', b'original content\n')), |
|
|
6973.5.2
by Jelmer Vernooij
Add more bees. |
1484 |
], revision_id=b'a@cset-0-1') |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1485 |
builder.build_snapshot([b'a@cset-0-1'], [ |
1486 |
('modify', ('file', b'new-content\n')), |
|
|
6973.5.2
by Jelmer Vernooij
Add more bees. |
1487 |
], revision_id=b'a@cset-0-2a') |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1488 |
builder.build_snapshot([b'a@cset-0-1'], [ |
1489 |
('add', ('other-file', b'file2-id', 'file', b'file2-content\n')), |
|
|
6973.5.2
by Jelmer Vernooij
Add more bees. |
1490 |
], revision_id=b'a@cset-0-2b') |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1491 |
builder.build_snapshot([b'a@cset-0-2a', b'a@cset-0-2b'], [ |
1492 |
('add', ('other-file', b'file2-id', 'file', b'file2-content\n')), |
|
|
6973.5.2
by Jelmer Vernooij
Add more bees. |
1493 |
], revision_id=b'a@cset-0-3') |
|
4543.2.4
by John Arbash Meinel
Start working on code that will use Repository._serializer.write_inventory_to_strig. |
1494 |
builder.finish_series() |
1495 |
self.b1 = builder.get_branch() |
|
1496 |
self.b1.lock_read() |
|
1497 |
self.addCleanup(self.b1.unlock) |
|
1498 |
||
|
4543.2.5
by John Arbash Meinel
Fix issues with keys/ids and ghost handling. |
1499 |
def make_bundle_just_inventories(self, base_revision_id, |
1500 |
target_revision_id, |
|
1501 |
revision_ids): |
|
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
1502 |
sio = BytesIO() |
|
4543.2.5
by John Arbash Meinel
Fix issues with keys/ids and ghost handling. |
1503 |
writer = v4.BundleWriteOperation(base_revision_id, target_revision_id, |
|
4543.2.4
by John Arbash Meinel
Start working on code that will use Repository._serializer.write_inventory_to_strig. |
1504 |
self.b1.repository, sio) |
1505 |
writer.bundle.begin() |
|
|
4543.2.5
by John Arbash Meinel
Fix issues with keys/ids and ghost handling. |
1506 |
writer._add_inventory_mpdiffs_from_serializer(revision_ids) |
|
4543.2.4
by John Arbash Meinel
Start working on code that will use Repository._serializer.write_inventory_to_strig. |
1507 |
writer.bundle.end() |
1508 |
sio.seek(0) |
|
|
4543.2.5
by John Arbash Meinel
Fix issues with keys/ids and ghost handling. |
1509 |
return sio |
1510 |
||
1511 |
def test_single_inventory_multiple_parents_as_xml(self): |
|
1512 |
self.make_merged_branch() |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1513 |
sio = self.make_bundle_just_inventories(b'a@cset-0-1', b'a@cset-0-3', |
1514 |
[b'a@cset-0-3']) |
|
|
4543.2.4
by John Arbash Meinel
Start working on code that will use Repository._serializer.write_inventory_to_strig. |
1515 |
reader = v4.BundleReader(sio, stream_input=False) |
1516 |
records = list(reader.iter_records()) |
|
1517 |
self.assertEqual(1, len(records)) |
|
1518 |
(bytes, metadata, repo_kind, revision_id, |
|
1519 |
file_id) = records[0] |
|
1520 |
self.assertIs(None, file_id) |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1521 |
self.assertEqual(b'a@cset-0-3', revision_id) |
|
4543.2.4
by John Arbash Meinel
Start working on code that will use Repository._serializer.write_inventory_to_strig. |
1522 |
self.assertEqual('inventory', repo_kind) |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1523 |
self.assertEqual({b'parents': [b'a@cset-0-2a', b'a@cset-0-2b'], |
1524 |
b'sha1': b'09c53b0c4de0895e11a2aacc34fef60a6e70865c', |
|
1525 |
b'storage_kind': b'mpdiff', |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1526 |
}, metadata) |
|
4543.2.4
by John Arbash Meinel
Start working on code that will use Repository._serializer.write_inventory_to_strig. |
1527 |
# We should have an mpdiff that takes some lines from both parents.
|
1528 |
self.assertEqualDiff( |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1529 |
b'i 1\n' |
1530 |
b'<inventory format="10" revision_id="a@cset-0-3">\n' |
|
1531 |
b'\n' |
|
1532 |
b'c 0 1 1 2\n' |
|
1533 |
b'c 1 3 3 2\n', bytes) |
|
|
4543.2.4
by John Arbash Meinel
Start working on code that will use Repository._serializer.write_inventory_to_strig. |
1534 |
|
|
4543.2.5
by John Arbash Meinel
Fix issues with keys/ids and ghost handling. |
1535 |
def test_single_inv_no_parents_as_xml(self): |
1536 |
self.make_merged_branch() |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1537 |
sio = self.make_bundle_just_inventories(b'null:', b'a@cset-0-1', |
1538 |
[b'a@cset-0-1']) |
|
|
4543.2.5
by John Arbash Meinel
Fix issues with keys/ids and ghost handling. |
1539 |
reader = v4.BundleReader(sio, stream_input=False) |
1540 |
records = list(reader.iter_records()) |
|
1541 |
self.assertEqual(1, len(records)) |
|
1542 |
(bytes, metadata, repo_kind, revision_id, |
|
1543 |
file_id) = records[0] |
|
1544 |
self.assertIs(None, file_id) |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1545 |
self.assertEqual(b'a@cset-0-1', revision_id) |
|
4543.2.5
by John Arbash Meinel
Fix issues with keys/ids and ghost handling. |
1546 |
self.assertEqual('inventory', repo_kind) |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1547 |
self.assertEqual({b'parents': [], |
1548 |
b'sha1': b'a13f42b142d544aac9b085c42595d304150e31a2', |
|
1549 |
b'storage_kind': b'mpdiff', |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1550 |
}, metadata) |
|
4543.2.5
by John Arbash Meinel
Fix issues with keys/ids and ghost handling. |
1551 |
# We should have an mpdiff that takes some lines from both parents.
|
1552 |
self.assertEqualDiff( |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1553 |
b'i 4\n' |
1554 |
b'<inventory format="10" revision_id="a@cset-0-1">\n' |
|
1555 |
b'<directory file_id="root-id" name=""' |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1556 |
b' revision="a@cset-0-1" />\n' |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1557 |
b'<file file_id="file-id" name="file" parent_id="root-id"' |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1558 |
b' revision="a@cset-0-1"' |
1559 |
b' text_sha1="09c2f8647e14e49e922b955c194102070597c2d1"' |
|
1560 |
b' text_size="17" />\n' |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1561 |
b'</inventory>\n' |
1562 |
b'\n', bytes) |
|
|
4543.2.5
by John Arbash Meinel
Fix issues with keys/ids and ghost handling. |
1563 |
|
1564 |
def test_multiple_inventories_as_xml(self): |
|
1565 |
self.make_merged_branch() |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1566 |
sio = self.make_bundle_just_inventories(b'a@cset-0-1', b'a@cset-0-3', |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1567 |
[b'a@cset-0-2a', b'a@cset-0-2b', b'a@cset-0-3']) |
|
4543.2.5
by John Arbash Meinel
Fix issues with keys/ids and ghost handling. |
1568 |
reader = v4.BundleReader(sio, stream_input=False) |
1569 |
records = list(reader.iter_records()) |
|
1570 |
self.assertEqual(3, len(records)) |
|
1571 |
revision_ids = [rev_id for b, m, k, rev_id, f in records] |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1572 |
self.assertEqual([b'a@cset-0-2a', b'a@cset-0-2b', b'a@cset-0-3'], |
|
4543.2.5
by John Arbash Meinel
Fix issues with keys/ids and ghost handling. |
1573 |
revision_ids) |
1574 |
metadata_2a = records[0][1] |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1575 |
self.assertEqual({b'parents': [b'a@cset-0-1'], |
1576 |
b'sha1': b'1e105886d62d510763e22885eec733b66f5f09bf', |
|
1577 |
b'storage_kind': b'mpdiff', |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1578 |
}, metadata_2a) |
|
4543.2.5
by John Arbash Meinel
Fix issues with keys/ids and ghost handling. |
1579 |
metadata_2b = records[1][1] |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1580 |
self.assertEqual({b'parents': [b'a@cset-0-1'], |
1581 |
b'sha1': b'f03f12574bdb5ed2204c28636c98a8547544ccd8', |
|
1582 |
b'storage_kind': b'mpdiff', |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1583 |
}, metadata_2b) |
|
4543.2.5
by John Arbash Meinel
Fix issues with keys/ids and ghost handling. |
1584 |
metadata_3 = records[2][1] |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1585 |
self.assertEqual({b'parents': [b'a@cset-0-2a', b'a@cset-0-2b'], |
1586 |
b'sha1': b'09c53b0c4de0895e11a2aacc34fef60a6e70865c', |
|
1587 |
b'storage_kind': b'mpdiff', |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1588 |
}, metadata_3) |
|
4543.2.5
by John Arbash Meinel
Fix issues with keys/ids and ghost handling. |
1589 |
bytes_2a = records[0][0] |
1590 |
self.assertEqualDiff( |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1591 |
b'i 1\n' |
1592 |
b'<inventory format="10" revision_id="a@cset-0-2a">\n' |
|
1593 |
b'\n' |
|
1594 |
b'c 0 1 1 1\n' |
|
1595 |
b'i 1\n' |
|
1596 |
b'<file file_id="file-id" name="file" parent_id="root-id"' |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1597 |
b' revision="a@cset-0-2a"' |
1598 |
b' text_sha1="50f545ff40e57b6924b1f3174b267ffc4576e9a9"' |
|
1599 |
b' text_size="12" />\n' |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1600 |
b'\n' |
1601 |
b'c 0 3 3 1\n', bytes_2a) |
|
|
4543.2.5
by John Arbash Meinel
Fix issues with keys/ids and ghost handling. |
1602 |
bytes_2b = records[1][0] |
1603 |
self.assertEqualDiff( |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1604 |
b'i 1\n' |
1605 |
b'<inventory format="10" revision_id="a@cset-0-2b">\n' |
|
1606 |
b'\n' |
|
1607 |
b'c 0 1 1 2\n' |
|
1608 |
b'i 1\n' |
|
1609 |
b'<file file_id="file2-id" name="other-file" parent_id="root-id"' |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1610 |
b' revision="a@cset-0-2b"' |
1611 |
b' text_sha1="b46c0c8ea1e5ef8e46fc8894bfd4752a88ec939e"' |
|
1612 |
b' text_size="14" />\n' |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1613 |
b'\n' |
1614 |
b'c 0 3 4 1\n', bytes_2b) |
|
|
4543.2.5
by John Arbash Meinel
Fix issues with keys/ids and ghost handling. |
1615 |
bytes_3 = records[2][0] |
1616 |
self.assertEqualDiff( |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1617 |
b'i 1\n' |
1618 |
b'<inventory format="10" revision_id="a@cset-0-3">\n' |
|
1619 |
b'\n' |
|
1620 |
b'c 0 1 1 2\n' |
|
1621 |
b'c 1 3 3 2\n', bytes_3) |
|
|
4543.2.7
by John Arbash Meinel
It turns out CHKSerializer was inheriting from xml5 |
1622 |
|
1623 |
def test_creating_bundle_preserves_chk_pages(self): |
|
1624 |
self.make_merged_branch() |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
1625 |
target = self.b1.controldir.sprout('target', |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1626 |
revision_id=b'a@cset-0-2a').open_branch() |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1627 |
bundle_txt, rev_ids = self.create_bundle_text(b'a@cset-0-2a', |
1628 |
b'a@cset-0-3') |
|
|
7029.2.1
by Jelmer Vernooij
don't make assumptions about the order in which revision ids are returned by write_bundle. |
1629 |
self.assertEqual(set([b'a@cset-0-2b', b'a@cset-0-3']), set(rev_ids)) |
|
4543.2.7
by John Arbash Meinel
It turns out CHKSerializer was inheriting from xml5 |
1630 |
bundle = read_bundle(bundle_txt) |
1631 |
target.lock_write() |
|
1632 |
self.addCleanup(target.unlock) |
|
1633 |
install_bundle(target.repository, bundle) |
|
|
7018.3.10
by Jelmer Vernooij
Consistent return values in PreviewTree.list_files. |
1634 |
inv1 = next(self.b1.repository.inventories.get_record_stream([ |
1635 |
(b'a@cset-0-3',)], 'unordered', |
|
1636 |
True)).get_bytes_as('fulltext') |
|
1637 |
inv2 = next(target.repository.inventories.get_record_stream([ |
|
1638 |
(b'a@cset-0-3',)], 'unordered', |
|
1639 |
True)).get_bytes_as('fulltext') |
|
|
4543.2.7
by John Arbash Meinel
It turns out CHKSerializer was inheriting from xml5 |
1640 |
self.assertEqualDiff(inv1, inv2) |
|
4543.2.5
by John Arbash Meinel
Fix issues with keys/ids and ghost handling. |
1641 |
|
|
4543.2.4
by John Arbash Meinel
Start working on code that will use Repository._serializer.write_inventory_to_strig. |
1642 |
|
|
2520.4.79
by Aaron Bentley
Fixed up not-really-relevant munging tests |
1643 |
class MungedBundleTester(object): |
|
1793.3.2
by John Arbash Meinel
(failing) add some tests which munge trailing whitespace |
1644 |
|
1645 |
def build_test_bundle(self): |
|
1646 |
wt = self.make_branch_and_tree('b1') |
|
1647 |
||
1648 |
self.build_tree(['b1/one']) |
|
1649 |
wt.add('one') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1650 |
wt.commit('add one', rev_id=b'a@cset-0-1') |
|
1793.3.2
by John Arbash Meinel
(failing) add some tests which munge trailing whitespace |
1651 |
self.build_tree(['b1/two']) |
1652 |
wt.add('two') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1653 |
wt.commit('add two', rev_id=b'a@cset-0-2', |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1654 |
revprops={u'branch-nick': 'test'}) |
|
1793.3.2
by John Arbash Meinel
(failing) add some tests which munge trailing whitespace |
1655 |
|
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
1656 |
bundle_txt = BytesIO() |
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1657 |
rev_ids = write_bundle(wt.branch.repository, b'a@cset-0-2', |
1658 |
b'a@cset-0-1', bundle_txt, self.format) |
|
1659 |
self.assertEqual({b'a@cset-0-2'}, set(rev_ids)) |
|
|
1793.3.2
by John Arbash Meinel
(failing) add some tests which munge trailing whitespace |
1660 |
bundle_txt.seek(0, 0) |
1661 |
return bundle_txt |
|
1662 |
||
1663 |
def check_valid(self, bundle): |
|
1664 |
"""Check that after whatever munging, the final object is valid.""" |
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1665 |
self.assertEqual([b'a@cset-0-2'], |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1666 |
[r.revision_id for r in bundle.real_revisions]) |
|
1793.3.2
by John Arbash Meinel
(failing) add some tests which munge trailing whitespace |
1667 |
|
1668 |
def test_extra_whitespace(self): |
|
1669 |
bundle_txt = self.build_test_bundle() |
|
1670 |
||
1671 |
# Seek to the end of the file
|
|
1672 |
# Adding one extra newline used to give us
|
|
1673 |
# TypeError: float() argument must be a string or a number
|
|
1674 |
bundle_txt.seek(0, 2) |
|
|
6973.7.5
by Jelmer Vernooij
s/file/open. |
1675 |
bundle_txt.write(b'\n') |
|
1793.3.2
by John Arbash Meinel
(failing) add some tests which munge trailing whitespace |
1676 |
bundle_txt.seek(0) |
1677 |
||
|
1793.3.4
by John Arbash Meinel
[merge] bzr.dev 1804 and fix conflicts. |
1678 |
bundle = read_bundle(bundle_txt) |
|
1793.3.2
by John Arbash Meinel
(failing) add some tests which munge trailing whitespace |
1679 |
self.check_valid(bundle) |
1680 |
||
1681 |
def test_extra_whitespace_2(self): |
|
1682 |
bundle_txt = self.build_test_bundle() |
|
1683 |
||
1684 |
# Seek to the end of the file
|
|
1685 |
# Adding two extra newlines used to give us
|
|
1686 |
# MalformedPatches: The first line of all patches should be ...
|
|
1687 |
bundle_txt.seek(0, 2) |
|
|
6973.7.5
by Jelmer Vernooij
s/file/open. |
1688 |
bundle_txt.write(b'\n\n') |
|
1793.3.2
by John Arbash Meinel
(failing) add some tests which munge trailing whitespace |
1689 |
bundle_txt.seek(0) |
1690 |
||
|
1793.3.4
by John Arbash Meinel
[merge] bzr.dev 1804 and fix conflicts. |
1691 |
bundle = read_bundle(bundle_txt) |
|
1793.3.2
by John Arbash Meinel
(failing) add some tests which munge trailing whitespace |
1692 |
self.check_valid(bundle) |
1693 |
||
|
2520.4.79
by Aaron Bentley
Fixed up not-really-relevant munging tests |
1694 |
|
|
4241.14.13
by Vincent Ladeuil
Some more cleanup. |
1695 |
class MungedBundleTesterV09(tests.TestCaseWithTransport, MungedBundleTester): |
|
2520.4.79
by Aaron Bentley
Fixed up not-really-relevant munging tests |
1696 |
|
1697 |
format = '0.9' |
|
1698 |
||
|
1793.3.2
by John Arbash Meinel
(failing) add some tests which munge trailing whitespace |
1699 |
def test_missing_trailing_whitespace(self): |
1700 |
bundle_txt = self.build_test_bundle() |
|
1701 |
||
1702 |
# Remove a trailing newline, it shouldn't kill the parser
|
|
1703 |
raw = bundle_txt.getvalue() |
|
1704 |
# The contents of the bundle don't have to be this, but this
|
|
1705 |
# test is concerned with the exact case where the serializer
|
|
1706 |
# creates a blank line at the end, and fails if that
|
|
1707 |
# line is stripped
|
|
|
6973.7.10
by Jelmer Vernooij
More fixes. |
1708 |
self.assertEqual(b'\n\n', raw[-2:]) |
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
1709 |
bundle_txt = BytesIO(raw[:-1]) |
|
1793.3.2
by John Arbash Meinel
(failing) add some tests which munge trailing whitespace |
1710 |
|
|
1793.3.4
by John Arbash Meinel
[merge] bzr.dev 1804 and fix conflicts. |
1711 |
bundle = read_bundle(bundle_txt) |
|
1793.3.2
by John Arbash Meinel
(failing) add some tests which munge trailing whitespace |
1712 |
self.check_valid(bundle) |
|
1793.3.14
by John Arbash Meinel
Actually fix the bug with missing trailing newline bug #49182 |
1713 |
|
|
1793.3.16
by John Arbash Meinel
Add tests to ensure that we gracefully handle opening and trailing non-bundle text. |
1714 |
def test_opening_text(self): |
1715 |
bundle_txt = self.build_test_bundle() |
|
1716 |
||
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
1717 |
bundle_txt = BytesIO( |
1718 |
b"Some random\nemail comments\n" + bundle_txt.getvalue()) |
|
|
1793.3.16
by John Arbash Meinel
Add tests to ensure that we gracefully handle opening and trailing non-bundle text. |
1719 |
|
1720 |
bundle = read_bundle(bundle_txt) |
|
1721 |
self.check_valid(bundle) |
|
1722 |
||
1723 |
def test_trailing_text(self): |
|
1724 |
bundle_txt = self.build_test_bundle() |
|
1725 |
||
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
1726 |
bundle_txt = BytesIO( |
1727 |
bundle_txt.getvalue() + b"Some trailing\nrandom\ntext\n") |
|
|
1793.3.16
by John Arbash Meinel
Add tests to ensure that we gracefully handle opening and trailing non-bundle text. |
1728 |
|
1729 |
bundle = read_bundle(bundle_txt) |
|
1730 |
self.check_valid(bundle) |
|
|
2520.4.56
by Aaron Bentley
Begin adding support for arbitrary metadata |
1731 |
|
1732 |
||
|
4241.14.13
by Vincent Ladeuil
Some more cleanup. |
1733 |
class MungedBundleTesterV4(tests.TestCaseWithTransport, MungedBundleTester): |
|
2520.4.79
by Aaron Bentley
Fixed up not-really-relevant munging tests |
1734 |
|
|
2520.4.136
by Aaron Bentley
Fix format strings |
1735 |
format = '4' |
|
2520.4.79
by Aaron Bentley
Fixed up not-really-relevant munging tests |
1736 |
|
1737 |
||
|
4241.14.13
by Vincent Ladeuil
Some more cleanup. |
1738 |
class TestBundleWriterReader(tests.TestCase): |
|
2520.4.56
by Aaron Bentley
Begin adding support for arbitrary metadata |
1739 |
|
1740 |
def test_roundtrip_record(self): |
|
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
1741 |
fileobj = BytesIO() |
|
2520.4.72
by Aaron Bentley
Rename format to 4alpha |
1742 |
writer = v4.BundleWriter(fileobj) |
|
2520.4.56
by Aaron Bentley
Begin adding support for arbitrary metadata |
1743 |
writer.begin() |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
1744 |
writer.add_info_record({b'foo': b'bar'}) |
|
7065.3.11
by Jelmer Vernooij
Fix bundle tests. |
1745 |
writer._add_record(b"Record body", {b'parents': [b'1', b'3'], |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1746 |
b'storage_kind': b'fulltext'}, 'file', b'revid', b'fileid') |
|
2520.4.56
by Aaron Bentley
Begin adding support for arbitrary metadata |
1747 |
writer.end() |
1748 |
fileobj.seek(0) |
|
|
2520.4.148
by Aaron Bentley
Updates from review |
1749 |
reader = v4.BundleReader(fileobj, stream_input=True) |
|
2520.4.145
by Aaron Bentley
Add memory_friendly toggle, be memory-unfriendly for merge directives |
1750 |
record_iter = reader.iter_records() |
|
6634.2.1
by Martin
Apply 2to3 next fixer and make compatible |
1751 |
record = next(record_iter) |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
1752 |
self.assertEqual((None, {b'foo': b'bar', b'storage_kind': b'header'}, |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1753 |
'info', None, None), record) |
|
6634.2.1
by Martin
Apply 2to3 next fixer and make compatible |
1754 |
record = next(record_iter) |
|
7065.3.11
by Jelmer Vernooij
Fix bundle tests. |
1755 |
self.assertEqual((b"Record body", {b'storage_kind': b'fulltext', |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1756 |
b'parents': [b'1', b'3']}, 'file', b'revid', b'fileid'), |
1757 |
record) |
|
|
2520.4.145
by Aaron Bentley
Add memory_friendly toggle, be memory-unfriendly for merge directives |
1758 |
|
1759 |
def test_roundtrip_record_memory_hungry(self): |
|
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
1760 |
fileobj = BytesIO() |
|
2520.4.145
by Aaron Bentley
Add memory_friendly toggle, be memory-unfriendly for merge directives |
1761 |
writer = v4.BundleWriter(fileobj) |
1762 |
writer.begin() |
|
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
1763 |
writer.add_info_record({b'foo': b'bar'}) |
|
7065.3.11
by Jelmer Vernooij
Fix bundle tests. |
1764 |
writer._add_record(b"Record body", {b'parents': [b'1', b'3'], |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1765 |
b'storage_kind': b'fulltext'}, 'file', b'revid', b'fileid') |
|
2520.4.145
by Aaron Bentley
Add memory_friendly toggle, be memory-unfriendly for merge directives |
1766 |
writer.end() |
1767 |
fileobj.seek(0) |
|
|
2520.4.148
by Aaron Bentley
Updates from review |
1768 |
reader = v4.BundleReader(fileobj, stream_input=False) |
|
2520.4.145
by Aaron Bentley
Add memory_friendly toggle, be memory-unfriendly for merge directives |
1769 |
record_iter = reader.iter_records() |
|
6634.2.1
by Martin
Apply 2to3 next fixer and make compatible |
1770 |
record = next(record_iter) |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
1771 |
self.assertEqual((None, {b'foo': b'bar', b'storage_kind': b'header'}, |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1772 |
'info', None, None), record) |
|
6634.2.1
by Martin
Apply 2to3 next fixer and make compatible |
1773 |
record = next(record_iter) |
|
7065.3.11
by Jelmer Vernooij
Fix bundle tests. |
1774 |
self.assertEqual((b"Record body", {b'storage_kind': b'fulltext', |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1775 |
b'parents': [b'1', b'3']}, 'file', b'revid', b'fileid'), |
1776 |
record) |
|
|
2520.4.95
by Aaron Bentley
Add support for header/info records |
1777 |
|
|
2520.4.127
by Aaron Bentley
Fix up name encoding to handle revision-ids with slashes |
1778 |
def test_encode_name(self): |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
1779 |
self.assertEqual(b'revision/rev1', |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1780 |
v4.BundleWriter.encode_name('revision', b'rev1')) |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
1781 |
self.assertEqual(b'file/rev//1/file-id-1', |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1782 |
v4.BundleWriter.encode_name('file', b'rev/1', b'file-id-1')) |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
1783 |
self.assertEqual(b'info', |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1784 |
v4.BundleWriter.encode_name('info', None, None)) |
|
2520.4.95
by Aaron Bentley
Add support for header/info records |
1785 |
|
|
2520.4.127
by Aaron Bentley
Fix up name encoding to handle revision-ids with slashes |
1786 |
def test_decode_name(self): |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
1787 |
self.assertEqual(('revision', b'rev1', None), |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1788 |
v4.BundleReader.decode_name(b'revision/rev1')) |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
1789 |
self.assertEqual(('file', b'rev/1', b'file-id-1'), |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1790 |
v4.BundleReader.decode_name(b'file/rev//1/file-id-1')) |
|
2520.4.95
by Aaron Bentley
Add support for header/info records |
1791 |
self.assertEqual(('info', None, None), |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
1792 |
v4.BundleReader.decode_name(b'info')) |
|
2520.4.131
by Aaron Bentley
Raise BadBundle for records with wrong number of names |
1793 |
|
1794 |
def test_too_many_names(self): |
|
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
1795 |
fileobj = BytesIO() |
|
2520.4.131
by Aaron Bentley
Raise BadBundle for records with wrong number of names |
1796 |
writer = v4.BundleWriter(fileobj) |
1797 |
writer.begin() |
|
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
1798 |
writer.add_info_record({b'foo': b'bar'}) |
|
7065.3.11
by Jelmer Vernooij
Fix bundle tests. |
1799 |
writer._container.add_bytes_record(b'blah', [(b'two', ), (b'names', )]) |
|
2520.4.131
by Aaron Bentley
Raise BadBundle for records with wrong number of names |
1800 |
writer.end() |
1801 |
fileobj.seek(0) |
|
1802 |
record_iter = v4.BundleReader(fileobj).iter_records() |
|
|
6634.2.1
by Martin
Apply 2to3 next fixer and make compatible |
1803 |
record = next(record_iter) |
|
6973.7.8
by Jelmer Vernooij
Fix more tests. |
1804 |
self.assertEqual((None, {b'foo': b'bar', b'storage_kind': b'header'}, |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1805 |
'info', None, None), record) |
|
6634.2.1
by Martin
Apply 2to3 next fixer and make compatible |
1806 |
self.assertRaises(errors.BadBundle, next, record_iter) |