Merge lp:~jelmer/brz/move-bzr-tests into lp:brz/3.1
- move-bzr-tests
- Merge into 3.1
Proposed by
Jelmer Vernooij
Status: | Merged |
---|---|
Approved by: | Jelmer Vernooij |
Approved revision: | no longer in the source branch. |
Merge reported by: | The Breezy Bot |
Merged at revision: | not available |
Proposed branch: | lp:~jelmer/brz/move-bzr-tests |
Merge into: | lp:brz/3.1 |
Diff against target: |
1192 lines (+239/-198) 29 files modified
breezy/bzr/bundle/serializer/v4.py (+1/-1) breezy/bzr/chk_serializer.py (+3/-2) breezy/bzr/dirstate.py (+1/-1) breezy/bzr/groupcompress.py (+7/-5) breezy/bzr/inventory.py (+12/-3) breezy/bzr/knit.py (+12/-10) breezy/bzr/serializer.py (+22/-1) breezy/bzr/tests/__init__.py (+1/-0) breezy/bzr/tests/per_versionedfile.py (+7/-5) breezy/bzr/tests/test_inv.py (+10/-0) breezy/bzr/tests/test_versionedfile.py (+10/-0) breezy/bzr/tests/test_workingtree.py (+33/-0) breezy/bzr/tests/test_xml.py (+6/-5) breezy/bzr/versionedfile.py (+29/-12) breezy/bzr/vf_repository.py (+1/-1) breezy/bzr/weave.py (+3/-2) breezy/bzr/workingtree.py (+12/-2) breezy/bzr/xml5.py (+1/-2) breezy/bzr/xml_serializer.py (+7/-7) breezy/errors.py (+0/-101) breezy/git/annotate.py (+1/-1) breezy/merge_directive.py (+11/-1) breezy/tests/per_workingtree/test_add.py (+2/-2) breezy/tests/per_workingtree/test_read_working_inventory.py (+2/-2) breezy/tests/test_conflicts.py (+2/-1) breezy/tests/test_errors.py (+0/-19) breezy/tests/test_shelf.py (+1/-4) breezy/tests/test_transform.py (+6/-5) breezy/transform.py (+36/-3) |
To merge this branch: | bzr merge lp:~jelmer/brz/move-bzr-tests |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jelmer Vernooij | Approve | ||
Review via email: mp+386406@code.launchpad.net |
Commit message
Move some more tests to breezy.bzr.
Description of the change
Move some more tests to breezy.bzr.
To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) : | # |
review:
Approve
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote : | # |
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote : | # |
Running landing tests failed
https:/
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote : | # |
Running landing tests failed
https:/
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote : | # |
Running landing tests failed
https:/
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'breezy/bzr/bundle/serializer/v4.py' | |||
2 | --- breezy/bzr/bundle/serializer/v4.py 2020-02-09 02:41:42 +0000 | |||
3 | +++ breezy/bzr/bundle/serializer/v4.py 2020-06-26 01:36:03 +0000 | |||
4 | @@ -690,7 +690,7 @@ | |||
5 | 690 | delta = target_inv._make_delta(parent_inv) | 690 | delta = target_inv._make_delta(parent_inv) |
6 | 691 | self._repository.add_inventory_by_delta(parent_ids[0], | 691 | self._repository.add_inventory_by_delta(parent_ids[0], |
7 | 692 | delta, revision_id, parent_ids) | 692 | delta, revision_id, parent_ids) |
9 | 693 | except errors.UnsupportedInventoryKind: | 693 | except serializer.UnsupportedInventoryKind: |
10 | 694 | raise errors.IncompatibleRevision(repr(self._repository)) | 694 | raise errors.IncompatibleRevision(repr(self._repository)) |
11 | 695 | inventory_cache[revision_id] = target_inv | 695 | inventory_cache[revision_id] = target_inv |
12 | 696 | 696 | ||
13 | 697 | 697 | ||
14 | === modified file 'breezy/bzr/chk_serializer.py' | |||
15 | --- breezy/bzr/chk_serializer.py 2020-01-31 10:39:02 +0000 | |||
16 | +++ breezy/bzr/chk_serializer.py 2020-06-26 01:36:03 +0000 | |||
17 | @@ -22,6 +22,7 @@ | |||
18 | 22 | lazy_import.lazy_import(globals(), | 22 | lazy_import.lazy_import(globals(), |
19 | 23 | """ | 23 | """ |
20 | 24 | from breezy.bzr import ( | 24 | from breezy.bzr import ( |
21 | 25 | serializer, | ||
22 | 25 | xml_serializer, | 26 | xml_serializer, |
23 | 26 | ) | 27 | ) |
24 | 27 | """) | 28 | """) |
25 | @@ -183,7 +184,7 @@ | |||
26 | 183 | entry_cache=entry_cache, | 184 | entry_cache=entry_cache, |
27 | 184 | return_from_cache=return_from_cache) | 185 | return_from_cache=return_from_cache) |
28 | 185 | except xml_serializer.ParseError as e: | 186 | except xml_serializer.ParseError as e: |
30 | 186 | raise errors.UnexpectedInventoryFormat(e) | 187 | raise serializer.UnexpectedInventoryFormat(e) |
31 | 187 | 188 | ||
32 | 188 | def read_inventory(self, f, revision_id=None): | 189 | def read_inventory(self, f, revision_id=None): |
33 | 189 | """Read an inventory from a file-like object.""" | 190 | """Read an inventory from a file-like object.""" |
34 | @@ -194,7 +195,7 @@ | |||
35 | 194 | finally: | 195 | finally: |
36 | 195 | f.close() | 196 | f.close() |
37 | 196 | except xml_serializer.ParseError as e: | 197 | except xml_serializer.ParseError as e: |
39 | 197 | raise errors.UnexpectedInventoryFormat(e) | 198 | raise serializer.UnexpectedInventoryFormat(e) |
40 | 198 | 199 | ||
41 | 199 | def write_inventory_to_lines(self, inv): | 200 | def write_inventory_to_lines(self, inv): |
42 | 200 | """Return a list of lines with the encoded inventory.""" | 201 | """Return a list of lines with the encoded inventory.""" |
43 | 201 | 202 | ||
44 | === modified file 'breezy/bzr/dirstate.py' | |||
45 | --- breezy/bzr/dirstate.py 2019-09-21 17:08:09 +0000 | |||
46 | +++ breezy/bzr/dirstate.py 2020-06-26 01:36:03 +0000 | |||
47 | @@ -531,7 +531,7 @@ | |||
48 | 531 | file_id_entry[0][0], file_id_entry[0][1]) | 531 | file_id_entry[0][0], file_id_entry[0][1]) |
49 | 532 | kind = DirState._minikind_to_kind[file_id_entry[1][0][0]] | 532 | kind = DirState._minikind_to_kind[file_id_entry[1][0][0]] |
50 | 533 | info = '%s:%s' % (kind, path) | 533 | info = '%s:%s' % (kind, path) |
52 | 534 | raise errors.DuplicateFileId(file_id, info) | 534 | raise inventory.DuplicateFileId(file_id, info) |
53 | 535 | first_key = (dirname, basename, b'') | 535 | first_key = (dirname, basename, b'') |
54 | 536 | block_index, present = self._find_block_index_from_key(first_key) | 536 | block_index, present = self._find_block_index_from_key(first_key) |
55 | 537 | if present: | 537 | if present: |
56 | 538 | 538 | ||
57 | === modified file 'breezy/bzr/groupcompress.py' | |||
58 | --- breezy/bzr/groupcompress.py 2020-02-09 02:20:11 +0000 | |||
59 | +++ breezy/bzr/groupcompress.py 2020-06-26 01:36:03 +0000 | |||
60 | @@ -57,8 +57,10 @@ | |||
61 | 57 | adapter_registry, | 57 | adapter_registry, |
62 | 58 | AbsentContentFactory, | 58 | AbsentContentFactory, |
63 | 59 | ChunkedContentFactory, | 59 | ChunkedContentFactory, |
64 | 60 | ExistingContent, | ||
65 | 60 | FulltextContentFactory, | 61 | FulltextContentFactory, |
66 | 61 | VersionedFilesWithFallbacks, | 62 | VersionedFilesWithFallbacks, |
67 | 63 | UnavailableRepresentation, | ||
68 | 62 | ) | 64 | ) |
69 | 63 | 65 | ||
70 | 64 | # Minimum number of uncompressed bytes to try fetch at once when retrieving | 66 | # Minimum number of uncompressed bytes to try fetch at once when retrieving |
71 | @@ -490,7 +492,7 @@ | |||
72 | 490 | return self._chunks | 492 | return self._chunks |
73 | 491 | else: | 493 | else: |
74 | 492 | return osutils.chunks_to_lines(self._chunks) | 494 | return osutils.chunks_to_lines(self._chunks) |
76 | 493 | raise errors.UnavailableRepresentation(self.key, storage_kind, | 495 | raise UnavailableRepresentation(self.key, storage_kind, |
77 | 494 | self.storage_kind) | 496 | self.storage_kind) |
78 | 495 | 497 | ||
79 | 496 | def iter_bytes_as(self, storage_kind): | 498 | def iter_bytes_as(self, storage_kind): |
80 | @@ -500,7 +502,7 @@ | |||
81 | 500 | return iter(self._chunks) | 502 | return iter(self._chunks) |
82 | 501 | elif storage_kind == 'lines': | 503 | elif storage_kind == 'lines': |
83 | 502 | return iter(osutils.chunks_to_lines(self._chunks)) | 504 | return iter(osutils.chunks_to_lines(self._chunks)) |
85 | 503 | raise errors.UnavailableRepresentation(self.key, storage_kind, | 505 | raise UnavailableRepresentation(self.key, storage_kind, |
86 | 504 | self.storage_kind) | 506 | self.storage_kind) |
87 | 505 | 507 | ||
88 | 506 | 508 | ||
89 | @@ -871,7 +873,7 @@ | |||
90 | 871 | """ | 873 | """ |
91 | 872 | if length == 0: # empty, like a dir entry, etc | 874 | if length == 0: # empty, like a dir entry, etc |
92 | 873 | if nostore_sha == _null_sha1: | 875 | if nostore_sha == _null_sha1: |
94 | 874 | raise errors.ExistingContent() | 876 | raise ExistingContent() |
95 | 875 | return _null_sha1, 0, 0, 'fulltext' | 877 | return _null_sha1, 0, 0, 'fulltext' |
96 | 876 | # we assume someone knew what they were doing when they passed it in | 878 | # we assume someone knew what they were doing when they passed it in |
97 | 877 | if expected_sha is not None: | 879 | if expected_sha is not None: |
98 | @@ -880,7 +882,7 @@ | |||
99 | 880 | sha1 = osutils.sha_strings(chunks) | 882 | sha1 = osutils.sha_strings(chunks) |
100 | 881 | if nostore_sha is not None: | 883 | if nostore_sha is not None: |
101 | 882 | if sha1 == nostore_sha: | 884 | if sha1 == nostore_sha: |
103 | 883 | raise errors.ExistingContent() | 885 | raise ExistingContent() |
104 | 884 | if key[-1] is None: | 886 | if key[-1] is None: |
105 | 885 | key = key[:-1] + (b'sha1:' + sha1,) | 887 | key = key[:-1] + (b'sha1:' + sha1,) |
106 | 886 | 888 | ||
107 | @@ -1841,7 +1843,7 @@ | |||
108 | 1841 | continue | 1843 | continue |
109 | 1842 | try: | 1844 | try: |
110 | 1843 | chunks = record.get_bytes_as('chunked') | 1845 | chunks = record.get_bytes_as('chunked') |
112 | 1844 | except errors.UnavailableRepresentation: | 1846 | except UnavailableRepresentation: |
113 | 1845 | adapter_key = record.storage_kind, 'chunked' | 1847 | adapter_key = record.storage_kind, 'chunked' |
114 | 1846 | adapter = get_adapter(adapter_key) | 1848 | adapter = get_adapter(adapter_key) |
115 | 1847 | chunks = adapter.get_bytes(record, 'chunked') | 1849 | chunks = adapter.get_bytes(record, 'chunked') |
116 | 1848 | 1850 | ||
117 | === modified file 'breezy/bzr/inventory.py' | |||
118 | --- breezy/bzr/inventory.py 2020-01-30 16:13:31 +0000 | |||
119 | +++ breezy/bzr/inventory.py 2020-06-26 01:36:03 +0000 | |||
120 | @@ -59,6 +59,16 @@ | |||
121 | 59 | from ..static_tuple import StaticTuple | 59 | from ..static_tuple import StaticTuple |
122 | 60 | 60 | ||
123 | 61 | 61 | ||
124 | 62 | class DuplicateFileId(errors.BzrError): | ||
125 | 63 | |||
126 | 64 | _fmt = "File id {%(file_id)s} already exists in inventory as %(entry)s" | ||
127 | 65 | |||
128 | 66 | def __init__(self, file_id, entry): | ||
129 | 67 | errors.BzrError.__init__(self) | ||
130 | 68 | self.file_id = file_id | ||
131 | 69 | self.entry = entry | ||
132 | 70 | |||
133 | 71 | |||
134 | 62 | class InventoryEntry(object): | 72 | class InventoryEntry(object): |
135 | 63 | """Description of a versioned file. | 73 | """Description of a versioned file. |
136 | 64 | 74 | ||
137 | @@ -1131,7 +1141,7 @@ | |||
138 | 1131 | new_entry = replacement | 1141 | new_entry = replacement |
139 | 1132 | try: | 1142 | try: |
140 | 1133 | self.add(new_entry) | 1143 | self.add(new_entry) |
142 | 1134 | except errors.DuplicateFileId: | 1144 | except DuplicateFileId: |
143 | 1135 | raise errors.InconsistentDelta(new_path, new_entry.file_id, | 1145 | raise errors.InconsistentDelta(new_path, new_entry.file_id, |
144 | 1136 | "New id is already present in target.") | 1146 | "New id is already present in target.") |
145 | 1137 | except AttributeError: | 1147 | except AttributeError: |
146 | @@ -1233,8 +1243,7 @@ | |||
147 | 1233 | :return: entry | 1243 | :return: entry |
148 | 1234 | """ | 1244 | """ |
149 | 1235 | if entry.file_id in self._byid: | 1245 | if entry.file_id in self._byid: |
152 | 1236 | raise errors.DuplicateFileId(entry.file_id, | 1246 | raise DuplicateFileId(entry.file_id, self._byid[entry.file_id]) |
151 | 1237 | self._byid[entry.file_id]) | ||
153 | 1238 | if entry.parent_id is None: | 1247 | if entry.parent_id is None: |
154 | 1239 | self.root = entry | 1248 | self.root = entry |
155 | 1240 | else: | 1249 | else: |
156 | 1241 | 1250 | ||
157 | === modified file 'breezy/bzr/knit.py' | |||
158 | --- breezy/bzr/knit.py 2020-01-30 18:07:32 +0000 | |||
159 | +++ breezy/bzr/knit.py 2020-06-26 01:36:03 +0000 | |||
160 | @@ -107,7 +107,9 @@ | |||
161 | 107 | adapter_registry, | 107 | adapter_registry, |
162 | 108 | ConstantMapper, | 108 | ConstantMapper, |
163 | 109 | ContentFactory, | 109 | ContentFactory, |
164 | 110 | ExistingContent, | ||
165 | 110 | sort_groupcompress, | 111 | sort_groupcompress, |
166 | 112 | UnavailableRepresentation, | ||
167 | 111 | VersionedFilesWithFallbacks, | 113 | VersionedFilesWithFallbacks, |
168 | 112 | ) | 114 | ) |
169 | 113 | 115 | ||
170 | @@ -225,7 +227,7 @@ | |||
171 | 225 | 227 | ||
172 | 226 | def get_bytes(self, factory, target_storage_kind): | 228 | def get_bytes(self, factory, target_storage_kind): |
173 | 227 | if target_storage_kind != 'knit-ft-gz': | 229 | if target_storage_kind != 'knit-ft-gz': |
175 | 228 | raise errors.UnavailableRepresentation( | 230 | raise UnavailableRepresentation( |
176 | 229 | factory.key, target_storage_kind, factory.storage_kind) | 231 | factory.key, target_storage_kind, factory.storage_kind) |
177 | 230 | annotated_compressed_bytes = factory._raw_record | 232 | annotated_compressed_bytes = factory._raw_record |
178 | 231 | rec, contents = \ | 233 | rec, contents = \ |
179 | @@ -241,7 +243,7 @@ | |||
180 | 241 | 243 | ||
181 | 242 | def get_bytes(self, factory, target_storage_kind): | 244 | def get_bytes(self, factory, target_storage_kind): |
182 | 243 | if target_storage_kind != 'knit-delta-gz': | 245 | if target_storage_kind != 'knit-delta-gz': |
184 | 244 | raise errors.UnavailableRepresentation( | 246 | raise UnavailableRepresentation( |
185 | 245 | factory.key, target_storage_kind, factory.storage_kind) | 247 | factory.key, target_storage_kind, factory.storage_kind) |
186 | 246 | annotated_compressed_bytes = factory._raw_record | 248 | annotated_compressed_bytes = factory._raw_record |
187 | 247 | rec, contents = \ | 249 | rec, contents = \ |
188 | @@ -266,7 +268,7 @@ | |||
189 | 266 | return b''.join(content.text()) | 268 | return b''.join(content.text()) |
190 | 267 | elif target_storage_kind in ('chunked', 'lines'): | 269 | elif target_storage_kind in ('chunked', 'lines'): |
191 | 268 | return content.text() | 270 | return content.text() |
193 | 269 | raise errors.UnavailableRepresentation( | 271 | raise UnavailableRepresentation( |
194 | 270 | factory.key, target_storage_kind, factory.storage_kind) | 272 | factory.key, target_storage_kind, factory.storage_kind) |
195 | 271 | 273 | ||
196 | 272 | 274 | ||
197 | @@ -295,7 +297,7 @@ | |||
198 | 295 | return b''.join(basis_content.text()) | 297 | return b''.join(basis_content.text()) |
199 | 296 | elif target_storage_kind in ('chunked', 'lines'): | 298 | elif target_storage_kind in ('chunked', 'lines'): |
200 | 297 | return basis_content.text() | 299 | return basis_content.text() |
202 | 298 | raise errors.UnavailableRepresentation( | 300 | raise UnavailableRepresentation( |
203 | 299 | factory.key, target_storage_kind, factory.storage_kind) | 301 | factory.key, target_storage_kind, factory.storage_kind) |
204 | 300 | 302 | ||
205 | 301 | 303 | ||
206 | @@ -312,7 +314,7 @@ | |||
207 | 312 | return b''.join(content.text()) | 314 | return b''.join(content.text()) |
208 | 313 | elif target_storage_kind in ('chunked', 'lines'): | 315 | elif target_storage_kind in ('chunked', 'lines'): |
209 | 314 | return content.text() | 316 | return content.text() |
211 | 315 | raise errors.UnavailableRepresentation( | 317 | raise UnavailableRepresentation( |
212 | 316 | factory.key, target_storage_kind, factory.storage_kind) | 318 | factory.key, target_storage_kind, factory.storage_kind) |
213 | 317 | 319 | ||
214 | 318 | 320 | ||
215 | @@ -340,7 +342,7 @@ | |||
216 | 340 | return b''.join(content.text()) | 342 | return b''.join(content.text()) |
217 | 341 | elif target_storage_kind in ('chunked', 'lines'): | 343 | elif target_storage_kind in ('chunked', 'lines'): |
218 | 342 | return content.text() | 344 | return content.text() |
220 | 343 | raise errors.UnavailableRepresentation( | 345 | raise UnavailableRepresentation( |
221 | 344 | factory.key, target_storage_kind, factory.storage_kind) | 346 | factory.key, target_storage_kind, factory.storage_kind) |
222 | 345 | 347 | ||
223 | 346 | 348 | ||
224 | @@ -418,7 +420,7 @@ | |||
225 | 418 | return self._knit.get_lines(self.key[0]) | 420 | return self._knit.get_lines(self.key[0]) |
226 | 419 | elif storage_kind == 'fulltext': | 421 | elif storage_kind == 'fulltext': |
227 | 420 | return self._knit.get_text(self.key[0]) | 422 | return self._knit.get_text(self.key[0]) |
229 | 421 | raise errors.UnavailableRepresentation(self.key, storage_kind, | 423 | raise UnavailableRepresentation(self.key, storage_kind, |
230 | 422 | self.storage_kind) | 424 | self.storage_kind) |
231 | 423 | 425 | ||
232 | 424 | def iter_bytes_as(self, storage_kind): | 426 | def iter_bytes_as(self, storage_kind): |
233 | @@ -466,7 +468,7 @@ | |||
234 | 466 | return chunks | 468 | return chunks |
235 | 467 | else: | 469 | else: |
236 | 468 | return b''.join(chunks) | 470 | return b''.join(chunks) |
238 | 469 | raise errors.UnavailableRepresentation(self.key, storage_kind, | 471 | raise UnavailableRepresentation(self.key, storage_kind, |
239 | 470 | self.storage_kind) | 472 | self.storage_kind) |
240 | 471 | 473 | ||
241 | 472 | def iter_bytes_as(self, storage_kind): | 474 | def iter_bytes_as(self, storage_kind): |
242 | @@ -1068,7 +1070,7 @@ | |||
243 | 1068 | # that out. | 1070 | # that out. |
244 | 1069 | digest = sha_string(line_bytes) | 1071 | digest = sha_string(line_bytes) |
245 | 1070 | if nostore_sha == digest: | 1072 | if nostore_sha == digest: |
247 | 1071 | raise errors.ExistingContent | 1073 | raise ExistingContent |
248 | 1072 | 1074 | ||
249 | 1073 | present_parents = [] | 1075 | present_parents = [] |
250 | 1074 | if parent_texts is None: | 1076 | if parent_texts is None: |
251 | @@ -1793,7 +1795,7 @@ | |||
252 | 1793 | try: | 1795 | try: |
253 | 1794 | # Try getting a fulltext directly from the record. | 1796 | # Try getting a fulltext directly from the record. |
254 | 1795 | lines = record.get_bytes_as('lines') | 1797 | lines = record.get_bytes_as('lines') |
256 | 1796 | except errors.UnavailableRepresentation: | 1798 | except UnavailableRepresentation: |
257 | 1797 | adapter_key = record.storage_kind, 'lines' | 1799 | adapter_key = record.storage_kind, 'lines' |
258 | 1798 | adapter = get_adapter(adapter_key) | 1800 | adapter = get_adapter(adapter_key) |
259 | 1799 | lines = adapter.get_bytes(record, 'lines') | 1801 | lines = adapter.get_bytes(record, 'lines') |
260 | 1800 | 1802 | ||
261 | === modified file 'breezy/bzr/serializer.py' | |||
262 | --- breezy/bzr/serializer.py 2020-01-31 10:39:02 +0000 | |||
263 | +++ breezy/bzr/serializer.py 2020-06-26 01:36:03 +0000 | |||
264 | @@ -18,7 +18,28 @@ | |||
265 | 18 | 18 | ||
266 | 19 | from __future__ import absolute_import | 19 | from __future__ import absolute_import |
267 | 20 | 20 | ||
269 | 21 | from .. import registry | 21 | from .. import errors, registry |
270 | 22 | |||
271 | 23 | |||
272 | 24 | class BadInventoryFormat(errors.BzrError): | ||
273 | 25 | |||
274 | 26 | _fmt = "Root class for inventory serialization errors" | ||
275 | 27 | |||
276 | 28 | |||
277 | 29 | class UnexpectedInventoryFormat(BadInventoryFormat): | ||
278 | 30 | |||
279 | 31 | _fmt = "The inventory was not in the expected format:\n %(msg)s" | ||
280 | 32 | |||
281 | 33 | def __init__(self, msg): | ||
282 | 34 | BadInventoryFormat.__init__(self, msg=msg) | ||
283 | 35 | |||
284 | 36 | |||
285 | 37 | class UnsupportedInventoryKind(errors.BzrError): | ||
286 | 38 | |||
287 | 39 | _fmt = """Unsupported entry kind %(kind)s""" | ||
288 | 40 | |||
289 | 41 | def __init__(self, kind): | ||
290 | 42 | self.kind = kind | ||
291 | 22 | 43 | ||
292 | 23 | 44 | ||
293 | 24 | class Serializer(object): | 45 | class Serializer(object): |
294 | 25 | 46 | ||
295 | === modified file 'breezy/bzr/tests/__init__.py' | |||
296 | --- breezy/bzr/tests/__init__.py 2020-06-17 17:41:09 +0000 | |||
297 | +++ breezy/bzr/tests/__init__.py 2020-06-26 01:36:03 +0000 | |||
298 | @@ -84,6 +84,7 @@ | |||
299 | 84 | 'test_versionedfile', | 84 | 'test_versionedfile', |
300 | 85 | 'test_vf_search', | 85 | 'test_vf_search', |
301 | 86 | 'test_vfs_ratchet', | 86 | 'test_vfs_ratchet', |
302 | 87 | 'test_workingtree', | ||
303 | 87 | 'test_workingtree_4', | 88 | 'test_workingtree_4', |
304 | 88 | 'test_weave', | 89 | 'test_weave', |
305 | 89 | 'test_xml', | 90 | 'test_xml', |
306 | 90 | 91 | ||
307 | === modified file 'breezy/bzr/tests/per_versionedfile.py' | |||
308 | --- breezy/bzr/tests/per_versionedfile.py 2020-06-12 17:33:41 +0000 | |||
309 | +++ breezy/bzr/tests/per_versionedfile.py 2020-06-26 01:36:03 +0000 | |||
310 | @@ -61,8 +61,10 @@ | |||
311 | 61 | from ..versionedfile import ( | 61 | from ..versionedfile import ( |
312 | 62 | ChunkedContentFactory, | 62 | ChunkedContentFactory, |
313 | 63 | ConstantMapper, | 63 | ConstantMapper, |
314 | 64 | ExistingContent, | ||
315 | 64 | HashEscapedPrefixMapper, | 65 | HashEscapedPrefixMapper, |
316 | 65 | PrefixMapper, | 66 | PrefixMapper, |
317 | 67 | UnavailableRepresentation, | ||
318 | 66 | VirtualVersionedFiles, | 68 | VirtualVersionedFiles, |
319 | 67 | make_versioned_files_factory, | 69 | make_versioned_files_factory, |
320 | 68 | ) | 70 | ) |
321 | @@ -306,7 +308,7 @@ | |||
322 | 306 | # we now have a copy of all the lines in the vf. | 308 | # we now have a copy of all the lines in the vf. |
323 | 307 | for sha, (version, lines) in zip( | 309 | for sha, (version, lines) in zip( |
324 | 308 | shas, (empty_text, sample_text_nl, sample_text_no_nl)): | 310 | shas, (empty_text, sample_text_nl, sample_text_no_nl)): |
326 | 309 | self.assertRaises(errors.ExistingContent, | 311 | self.assertRaises(ExistingContent, |
327 | 310 | vf.add_lines, version + b"2", [], lines, | 312 | vf.add_lines, version + b"2", [], lines, |
328 | 311 | nostore_sha=sha) | 313 | nostore_sha=sha) |
329 | 312 | # and no new version should have been added. | 314 | # and no new version should have been added. |
330 | @@ -331,7 +333,7 @@ | |||
331 | 331 | raise TestSkipped("add_lines_with_ghosts is optional") | 333 | raise TestSkipped("add_lines_with_ghosts is optional") |
332 | 332 | for sha, (version, lines) in zip( | 334 | for sha, (version, lines) in zip( |
333 | 333 | shas, (empty_text, sample_text_nl, sample_text_no_nl)): | 335 | shas, (empty_text, sample_text_nl, sample_text_no_nl)): |
335 | 334 | self.assertRaises(errors.ExistingContent, | 336 | self.assertRaises(ExistingContent, |
336 | 335 | vf.add_lines_with_ghosts, version + b"2", [], lines, | 337 | vf.add_lines_with_ghosts, version + b"2", [], lines, |
337 | 336 | nostore_sha=sha) | 338 | nostore_sha=sha) |
338 | 337 | # and no new version should have been added. | 339 | # and no new version should have been added. |
339 | @@ -1647,10 +1649,10 @@ | |||
340 | 1647 | for sha, (version, lines) in zip( | 1649 | for sha, (version, lines) in zip( |
341 | 1648 | shas, (empty_text, sample_text_nl, sample_text_no_nl)): | 1650 | shas, (empty_text, sample_text_nl, sample_text_no_nl)): |
342 | 1649 | new_key = self.get_simple_key(version + b"2") | 1651 | new_key = self.get_simple_key(version + b"2") |
344 | 1650 | self.assertRaises(errors.ExistingContent, | 1652 | self.assertRaises(ExistingContent, |
345 | 1651 | vf.add_lines, new_key, [], lines, | 1653 | vf.add_lines, new_key, [], lines, |
346 | 1652 | nostore_sha=sha) | 1654 | nostore_sha=sha) |
348 | 1653 | self.assertRaises(errors.ExistingContent, | 1655 | self.assertRaises(ExistingContent, |
349 | 1654 | vf.add_lines, new_key, [], lines, | 1656 | vf.add_lines, new_key, [], lines, |
350 | 1655 | nostore_sha=sha) | 1657 | nostore_sha=sha) |
351 | 1656 | # and no new version should have been added. | 1658 | # and no new version should have been added. |
352 | @@ -1985,7 +1987,7 @@ | |||
353 | 1985 | factory.sha1) | 1987 | factory.sha1) |
354 | 1986 | self.assertEqual(parent_map[factory.key], factory.parents) | 1988 | self.assertEqual(parent_map[factory.key], factory.parents) |
355 | 1987 | # currently no stream emits mpdiff | 1989 | # currently no stream emits mpdiff |
357 | 1988 | self.assertRaises(errors.UnavailableRepresentation, | 1990 | self.assertRaises(UnavailableRepresentation, |
358 | 1989 | factory.get_bytes_as, 'mpdiff') | 1991 | factory.get_bytes_as, 'mpdiff') |
359 | 1990 | self.assertIsInstance(factory.get_bytes_as(factory.storage_kind), | 1992 | self.assertIsInstance(factory.get_bytes_as(factory.storage_kind), |
360 | 1991 | bytes) | 1993 | bytes) |
361 | 1992 | 1994 | ||
362 | === modified file 'breezy/bzr/tests/test_inv.py' | |||
363 | --- breezy/bzr/tests/test_inv.py 2020-06-10 21:13:00 +0000 | |||
364 | +++ breezy/bzr/tests/test_inv.py 2020-06-26 01:36:03 +0000 | |||
365 | @@ -31,6 +31,7 @@ | |||
366 | 31 | ) | 31 | ) |
367 | 32 | from ..inventory import ( | 32 | from ..inventory import ( |
368 | 33 | CHKInventory, | 33 | CHKInventory, |
369 | 34 | DuplicateFileId, | ||
370 | 34 | Inventory, | 35 | Inventory, |
371 | 35 | ROOT_ID, | 36 | ROOT_ID, |
372 | 36 | InventoryFile, | 37 | InventoryFile, |
373 | @@ -1601,3 +1602,12 @@ | |||
374 | 1601 | inv.get_entry(b'thefileid').executable = True | 1602 | inv.get_entry(b'thefileid').executable = True |
375 | 1602 | self.assertFalse(tree.root_inventory.get_entry( | 1603 | self.assertFalse(tree.root_inventory.get_entry( |
376 | 1603 | b'thefileid').executable) | 1604 | b'thefileid').executable) |
377 | 1605 | |||
378 | 1606 | |||
379 | 1607 | class ErrorTests(TestCase): | ||
380 | 1608 | |||
381 | 1609 | def test_duplicate_file_id(self): | ||
382 | 1610 | error = DuplicateFileId('a_file_id', 'foo') | ||
383 | 1611 | self.assertEqualDiff( | ||
384 | 1612 | 'File id {a_file_id} already exists in inventory as foo', | ||
385 | 1613 | str(error)) | ||
386 | 1604 | 1614 | ||
387 | === modified file 'breezy/bzr/tests/test_versionedfile.py' | |||
388 | --- breezy/bzr/tests/test_versionedfile.py 2020-06-10 02:56:53 +0000 | |||
389 | +++ breezy/bzr/tests/test_versionedfile.py 2020-06-26 01:36:03 +0000 | |||
390 | @@ -137,3 +137,13 @@ | |||
391 | 137 | multiparent.MultiParent([multiparent.NewText([b'first\n'])]), | 137 | multiparent.MultiParent([multiparent.NewText([b'first\n'])]), |
392 | 138 | ] | 138 | ] |
393 | 139 | self.assertEqual(expected_diffs, diffs) | 139 | self.assertEqual(expected_diffs, diffs) |
394 | 140 | |||
395 | 141 | |||
396 | 142 | class ErrorTests(tests.TestCase): | ||
397 | 143 | |||
398 | 144 | def test_unavailable_representation(self): | ||
399 | 145 | error = versionedfile.UnavailableRepresentation( | ||
400 | 146 | ('key',), "mpdiff", "fulltext") | ||
401 | 147 | self.assertEqualDiff("The encoding 'mpdiff' is not available for key " | ||
402 | 148 | "('key',) which is encoded as 'fulltext'.", | ||
403 | 149 | str(error)) | ||
404 | 140 | 150 | ||
405 | === added file 'breezy/bzr/tests/test_workingtree.py' | |||
406 | --- breezy/bzr/tests/test_workingtree.py 1970-01-01 00:00:00 +0000 | |||
407 | +++ breezy/bzr/tests/test_workingtree.py 2020-06-26 01:36:03 +0000 | |||
408 | @@ -0,0 +1,33 @@ | |||
409 | 1 | # Copyright (C) 2007-2012, 2016 Canonical Ltd | ||
410 | 2 | # | ||
411 | 3 | # This program is free software; you can redistribute it and/or modify | ||
412 | 4 | # it under the terms of the GNU General Public License as published by | ||
413 | 5 | # the Free Software Foundation; either version 2 of the License, or | ||
414 | 6 | # (at your option) any later version. | ||
415 | 7 | # | ||
416 | 8 | # This program is distributed in the hope that it will be useful, | ||
417 | 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
418 | 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
419 | 11 | # GNU General Public License for more details. | ||
420 | 12 | # | ||
421 | 13 | # You should have received a copy of the GNU General Public License | ||
422 | 14 | # along with this program; if not, write to the Free Software | ||
423 | 15 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
424 | 16 | |||
425 | 17 | """Tests for InventoryWorkingTree""" | ||
426 | 18 | |||
427 | 19 | from . import TestCase | ||
428 | 20 | |||
429 | 21 | from ..workingtree import InventoryModified | ||
430 | 22 | |||
431 | 23 | |||
432 | 24 | class ErrorTests(TestCase): | ||
433 | 25 | |||
434 | 26 | def test_inventory_modified(self): | ||
435 | 27 | error = InventoryModified("a tree to be repred") | ||
436 | 28 | self.assertEqualDiff("The current inventory for the tree 'a tree to " | ||
437 | 29 | "be repred' has been modified, so a clean inventory cannot be " | ||
438 | 30 | "read without data loss.", | ||
439 | 31 | str(error)) | ||
440 | 32 | |||
441 | 33 | |||
442 | 0 | 34 | ||
443 | === modified file 'breezy/bzr/tests/test_xml.py' | |||
444 | --- breezy/bzr/tests/test_xml.py 2020-06-10 02:56:53 +0000 | |||
445 | +++ breezy/bzr/tests/test_xml.py 2020-06-26 01:36:03 +0000 | |||
446 | @@ -21,6 +21,7 @@ | |||
447 | 21 | ) | 21 | ) |
448 | 22 | from .. import ( | 22 | from .. import ( |
449 | 23 | inventory, | 23 | inventory, |
450 | 24 | serializer, | ||
451 | 24 | xml6, | 25 | xml6, |
452 | 25 | xml7, | 26 | xml7, |
453 | 26 | xml8, | 27 | xml8, |
454 | @@ -409,10 +410,10 @@ | |||
455 | 409 | """Can't accidentally open a file with wrong serializer""" | 410 | """Can't accidentally open a file with wrong serializer""" |
456 | 410 | s_v6 = breezy.bzr.xml6.serializer_v6 | 411 | s_v6 = breezy.bzr.xml6.serializer_v6 |
457 | 411 | s_v7 = xml7.serializer_v7 | 412 | s_v7 = xml7.serializer_v7 |
459 | 412 | self.assertRaises(errors.UnexpectedInventoryFormat, | 413 | self.assertRaises(serializer.UnexpectedInventoryFormat, |
460 | 413 | s_v7.read_inventory_from_lines, | 414 | s_v7.read_inventory_from_lines, |
461 | 414 | breezy.osutils.split_lines(_expected_inv_v5)) | 415 | breezy.osutils.split_lines(_expected_inv_v5)) |
463 | 415 | self.assertRaises(errors.UnexpectedInventoryFormat, | 416 | self.assertRaises(serializer.UnexpectedInventoryFormat, |
464 | 416 | s_v6.read_inventory_from_lines, | 417 | s_v6.read_inventory_from_lines, |
465 | 417 | breezy.osutils.split_lines(_expected_inv_v7)) | 418 | breezy.osutils.split_lines(_expected_inv_v7)) |
466 | 418 | 419 | ||
467 | @@ -424,9 +425,9 @@ | |||
468 | 424 | inv.root.revision = b'root-rev' | 425 | inv.root.revision = b'root-rev' |
469 | 425 | inv.add(inventory.TreeReference(b'nested-id', 'nested', b'tree-root-321', | 426 | inv.add(inventory.TreeReference(b'nested-id', 'nested', b'tree-root-321', |
470 | 426 | b'rev-outer', b'rev-inner')) | 427 | b'rev-outer', b'rev-inner')) |
472 | 427 | self.assertRaises(errors.UnsupportedInventoryKind, | 428 | self.assertRaises(serializer.UnsupportedInventoryKind, |
473 | 428 | s_v5.write_inventory_to_lines, inv) | 429 | s_v5.write_inventory_to_lines, inv) |
475 | 429 | self.assertRaises(errors.UnsupportedInventoryKind, | 430 | self.assertRaises(serializer.UnsupportedInventoryKind, |
476 | 430 | s_v6.write_inventory_to_lines, inv) | 431 | s_v6.write_inventory_to_lines, inv) |
477 | 431 | lines = s_v7.write_inventory_to_chunks(inv) | 432 | lines = s_v7.write_inventory_to_chunks(inv) |
478 | 432 | inv2 = s_v7.read_inventory_from_lines(lines) | 433 | inv2 = s_v7.read_inventory_from_lines(lines) |
479 | @@ -528,7 +529,7 @@ | |||
480 | 528 | def test_serialization_error(self): | 529 | def test_serialization_error(self): |
481 | 529 | s_v5 = breezy.bzr.xml5.serializer_v5 | 530 | s_v5 = breezy.bzr.xml5.serializer_v5 |
482 | 530 | e = self.assertRaises( | 531 | e = self.assertRaises( |
484 | 531 | errors.UnexpectedInventoryFormat, | 532 | serializer.UnexpectedInventoryFormat, |
485 | 532 | s_v5.read_inventory_from_lines, [b"<Notquitexml"]) | 533 | s_v5.read_inventory_from_lines, [b"<Notquitexml"]) |
486 | 533 | self.assertEqual(str(e), "unclosed token: line 1, column 0") | 534 | self.assertEqual(str(e), "unclosed token: line 1, column 0") |
487 | 534 | 535 | ||
488 | 535 | 536 | ||
489 | === modified file 'breezy/bzr/versionedfile.py' | |||
490 | --- breezy/bzr/versionedfile.py 2020-06-12 17:33:41 +0000 | |||
491 | +++ breezy/bzr/versionedfile.py 2020-06-26 01:36:03 +0000 | |||
492 | @@ -71,6 +71,23 @@ | |||
493 | 71 | 'breezy.bzr.knit', 'DeltaAnnotatedToFullText') | 71 | 'breezy.bzr.knit', 'DeltaAnnotatedToFullText') |
494 | 72 | 72 | ||
495 | 73 | 73 | ||
496 | 74 | class UnavailableRepresentation(errors.InternalBzrError): | ||
497 | 75 | |||
498 | 76 | _fmt = ("The encoding '%(wanted)s' is not available for key %(key)s which " | ||
499 | 77 | "is encoded as '%(native)s'.") | ||
500 | 78 | |||
501 | 79 | def __init__(self, key, wanted, native): | ||
502 | 80 | errors.InternalBzrError.__init__(self) | ||
503 | 81 | self.wanted = wanted | ||
504 | 82 | self.native = native | ||
505 | 83 | self.key = key | ||
506 | 84 | |||
507 | 85 | |||
508 | 86 | class ExistingContent(errors.BzrError): | ||
509 | 87 | |||
510 | 88 | _fmt = "The content being inserted is already present." | ||
511 | 89 | |||
512 | 90 | |||
513 | 74 | class ContentFactory(object): | 91 | class ContentFactory(object): |
514 | 75 | """Abstract interface for insertion and retrieval from a VersionedFile. | 92 | """Abstract interface for insertion and retrieval from a VersionedFile. |
515 | 76 | 93 | ||
516 | @@ -134,8 +151,8 @@ | |||
517 | 134 | if self._chunks_are_lines: | 151 | if self._chunks_are_lines: |
518 | 135 | return self._chunks | 152 | return self._chunks |
519 | 136 | return list(osutils.chunks_to_lines(self._chunks)) | 153 | return list(osutils.chunks_to_lines(self._chunks)) |
522 | 137 | raise errors.UnavailableRepresentation(self.key, storage_kind, | 154 | raise UnavailableRepresentation(self.key, storage_kind, |
523 | 138 | self.storage_kind) | 155 | self.storage_kind) |
524 | 139 | 156 | ||
525 | 140 | def iter_bytes_as(self, storage_kind): | 157 | def iter_bytes_as(self, storage_kind): |
526 | 141 | if storage_kind == 'chunked': | 158 | if storage_kind == 'chunked': |
527 | @@ -144,8 +161,8 @@ | |||
528 | 144 | if self._chunks_are_lines: | 161 | if self._chunks_are_lines: |
529 | 145 | return iter(self._chunks) | 162 | return iter(self._chunks) |
530 | 146 | return iter(osutils.chunks_to_lines(self._chunks)) | 163 | return iter(osutils.chunks_to_lines(self._chunks)) |
533 | 147 | raise errors.UnavailableRepresentation(self.key, storage_kind, | 164 | raise UnavailableRepresentation(self.key, storage_kind, |
534 | 148 | self.storage_kind) | 165 | self.storage_kind) |
535 | 149 | 166 | ||
536 | 150 | class FulltextContentFactory(ContentFactory): | 167 | class FulltextContentFactory(ContentFactory): |
537 | 151 | """Static data content factory. | 168 | """Static data content factory. |
538 | @@ -181,16 +198,16 @@ | |||
539 | 181 | return [self._text] | 198 | return [self._text] |
540 | 182 | elif storage_kind == 'lines': | 199 | elif storage_kind == 'lines': |
541 | 183 | return osutils.split_lines(self._text) | 200 | return osutils.split_lines(self._text) |
544 | 184 | raise errors.UnavailableRepresentation(self.key, storage_kind, | 201 | raise UnavailableRepresentation(self.key, storage_kind, |
545 | 185 | self.storage_kind) | 202 | self.storage_kind) |
546 | 186 | 203 | ||
547 | 187 | def iter_bytes_as(self, storage_kind): | 204 | def iter_bytes_as(self, storage_kind): |
548 | 188 | if storage_kind == 'chunked': | 205 | if storage_kind == 'chunked': |
549 | 189 | return iter([self._text]) | 206 | return iter([self._text]) |
550 | 190 | elif storage_kind == 'lines': | 207 | elif storage_kind == 'lines': |
551 | 191 | return iter(osutils.split_lines(self._text)) | 208 | return iter(osutils.split_lines(self._text)) |
554 | 192 | raise errors.UnavailableRepresentation(self.key, storage_kind, | 209 | raise UnavailableRepresentation(self.key, storage_kind, |
555 | 193 | self.storage_kind) | 210 | self.storage_kind) |
556 | 194 | 211 | ||
557 | 195 | 212 | ||
558 | 196 | class FileContentFactory(ContentFactory): | 213 | class FileContentFactory(ContentFactory): |
559 | @@ -213,8 +230,8 @@ | |||
560 | 213 | return list(osutils.file_iterator(self.file)) | 230 | return list(osutils.file_iterator(self.file)) |
561 | 214 | elif storage_kind == 'lines': | 231 | elif storage_kind == 'lines': |
562 | 215 | return list(self.file.readlines()) | 232 | return list(self.file.readlines()) |
565 | 216 | raise errors.UnavailableRepresentation(self.key, storage_kind, | 233 | raise UnavailableRepresentation(self.key, storage_kind, |
566 | 217 | self.storage_kind) | 234 | self.storage_kind) |
567 | 218 | 235 | ||
568 | 219 | def iter_bytes_as(self, storage_kind): | 236 | def iter_bytes_as(self, storage_kind): |
569 | 220 | self.file.seek(0) | 237 | self.file.seek(0) |
570 | @@ -222,8 +239,8 @@ | |||
571 | 222 | return osutils.file_iterator(self.file) | 239 | return osutils.file_iterator(self.file) |
572 | 223 | elif storage_kind == 'lines': | 240 | elif storage_kind == 'lines': |
573 | 224 | return self.file | 241 | return self.file |
576 | 225 | raise errors.UnavailableRepresentation(self.key, storage_kind, | 242 | raise UnavailableRepresentation(self.key, storage_kind, |
577 | 226 | self.storage_kind) | 243 | self.storage_kind) |
578 | 227 | 244 | ||
579 | 228 | 245 | ||
580 | 229 | class AbsentContentFactory(ContentFactory): | 246 | class AbsentContentFactory(ContentFactory): |
581 | 230 | 247 | ||
582 | === modified file 'breezy/bzr/vf_repository.py' | |||
583 | --- breezy/bzr/vf_repository.py 2020-02-09 01:16:06 +0000 | |||
584 | +++ breezy/bzr/vf_repository.py 2020-06-26 01:36:03 +0000 | |||
585 | @@ -499,7 +499,7 @@ | |||
586 | 499 | file_id, file_obj, heads, nostore_sha, | 499 | file_id, file_obj, heads, nostore_sha, |
587 | 500 | size=(stat_value.st_size if stat_value else None)) | 500 | size=(stat_value.st_size if stat_value else None)) |
588 | 501 | yield change.path[1], (entry.text_sha1, stat_value) | 501 | yield change.path[1], (entry.text_sha1, stat_value) |
590 | 502 | except errors.ExistingContent: | 502 | except versionedfile.ExistingContent: |
591 | 503 | # No content change against a carry_over parent | 503 | # No content change against a carry_over parent |
592 | 504 | # Perhaps this should also yield a fs hash update? | 504 | # Perhaps this should also yield a fs hash update? |
593 | 505 | carried_over = True | 505 | carried_over = True |
594 | 506 | 506 | ||
595 | === modified file 'breezy/bzr/weave.py' | |||
596 | --- breezy/bzr/weave.py 2020-06-12 17:33:41 +0000 | |||
597 | +++ breezy/bzr/weave.py 2020-06-26 01:36:03 +0000 | |||
598 | @@ -81,7 +81,6 @@ | |||
599 | 81 | from ..errors import ( | 81 | from ..errors import ( |
600 | 82 | RevisionAlreadyPresent, | 82 | RevisionAlreadyPresent, |
601 | 83 | RevisionNotPresent, | 83 | RevisionNotPresent, |
602 | 84 | UnavailableRepresentation, | ||
603 | 85 | ) | 84 | ) |
604 | 86 | from ..osutils import dirname, sha, sha_strings, split_lines | 85 | from ..osutils import dirname, sha, sha_strings, split_lines |
605 | 87 | from ..revision import NULL_REVISION | 86 | from ..revision import NULL_REVISION |
606 | @@ -93,7 +92,9 @@ | |||
607 | 93 | AbsentContentFactory, | 92 | AbsentContentFactory, |
608 | 94 | adapter_registry, | 93 | adapter_registry, |
609 | 95 | ContentFactory, | 94 | ContentFactory, |
610 | 95 | ExistingContent, | ||
611 | 96 | sort_groupcompress, | 96 | sort_groupcompress, |
612 | 97 | UnavailableRepresentation, | ||
613 | 97 | VersionedFile, | 98 | VersionedFile, |
614 | 98 | ) | 99 | ) |
615 | 99 | from .weavefile import _read_weave_v5, write_weave_v5 | 100 | from .weavefile import _read_weave_v5, write_weave_v5 |
616 | @@ -488,7 +489,7 @@ | |||
617 | 488 | if not sha1: | 489 | if not sha1: |
618 | 489 | sha1 = sha_strings(lines) | 490 | sha1 = sha_strings(lines) |
619 | 490 | if sha1 == nostore_sha: | 491 | if sha1 == nostore_sha: |
621 | 491 | raise errors.ExistingContent | 492 | raise ExistingContent |
622 | 492 | if version_id is None: | 493 | if version_id is None: |
623 | 493 | version_id = b"sha1:" + sha1 | 494 | version_id = b"sha1:" + sha1 |
624 | 494 | if version_id in self._name_map: | 495 | if version_id in self._name_map: |
625 | 495 | 496 | ||
626 | === modified file 'breezy/bzr/workingtree.py' | |||
627 | --- breezy/bzr/workingtree.py 2020-01-30 16:13:31 +0000 | |||
628 | +++ breezy/bzr/workingtree.py 2020-06-26 01:36:03 +0000 | |||
629 | @@ -62,6 +62,7 @@ | |||
630 | 62 | ) | 62 | ) |
631 | 63 | from breezy.bzr import ( | 63 | from breezy.bzr import ( |
632 | 64 | inventory, | 64 | inventory, |
633 | 65 | serializer, | ||
634 | 65 | xml5, | 66 | xml5, |
635 | 66 | xml7, | 67 | xml7, |
636 | 67 | ) | 68 | ) |
637 | @@ -101,6 +102,15 @@ | |||
638 | 101 | ERROR_PATH_NOT_FOUND = 3 # WindowsError errno code, equivalent to ENOENT | 102 | ERROR_PATH_NOT_FOUND = 3 # WindowsError errno code, equivalent to ENOENT |
639 | 102 | 103 | ||
640 | 103 | 104 | ||
641 | 105 | class InventoryModified(errors.InternalBzrError): | ||
642 | 106 | |||
643 | 107 | _fmt = ("The current inventory for the tree %(tree)r has been modified," | ||
644 | 108 | " so a clean inventory cannot be read without data loss.") | ||
645 | 109 | |||
646 | 110 | def __init__(self, tree): | ||
647 | 111 | self.tree = tree | ||
648 | 112 | |||
649 | 113 | |||
650 | 104 | class InventoryWorkingTree(WorkingTree, MutableInventoryTree): | 114 | class InventoryWorkingTree(WorkingTree, MutableInventoryTree): |
651 | 105 | """Base class for working trees that are inventory-oriented. | 115 | """Base class for working trees that are inventory-oriented. |
652 | 106 | 116 | ||
653 | @@ -655,7 +665,7 @@ | |||
654 | 655 | # binary. | 665 | # binary. |
655 | 656 | with self.lock_read(): | 666 | with self.lock_read(): |
656 | 657 | if self._inventory_is_modified: | 667 | if self._inventory_is_modified: |
658 | 658 | raise errors.InventoryModified(self) | 668 | raise InventoryModified(self) |
659 | 659 | with self._transport.get('inventory') as f: | 669 | with self._transport.get('inventory') as f: |
660 | 660 | result = self._deserialize(f) | 670 | result = self._deserialize(f) |
661 | 661 | self._set_inventory(result, dirty=False) | 671 | self._set_inventory(result, dirty=False) |
662 | @@ -812,7 +822,7 @@ | |||
663 | 812 | if inv.revision_id == revision_id: | 822 | if inv.revision_id == revision_id: |
664 | 813 | return InventoryRevisionTree( | 823 | return InventoryRevisionTree( |
665 | 814 | self.branch.repository, inv, revision_id) | 824 | self.branch.repository, inv, revision_id) |
667 | 815 | except errors.BadInventoryFormat: | 825 | except serializer.BadInventoryFormat: |
668 | 816 | pass | 826 | pass |
669 | 817 | # raise if there was no inventory, or if we read the wrong inventory. | 827 | # raise if there was no inventory, or if we read the wrong inventory. |
670 | 818 | raise errors.NoSuchRevisionInTree(self, revision_id) | 828 | raise errors.NoSuchRevisionInTree(self, revision_id) |
671 | 819 | 829 | ||
672 | === modified file 'breezy/bzr/xml5.py' | |||
673 | --- breezy/bzr/xml5.py 2020-01-31 02:49:47 +0000 | |||
674 | +++ breezy/bzr/xml5.py 2020-06-26 01:36:03 +0000 | |||
675 | @@ -75,8 +75,7 @@ | |||
676 | 75 | raise errors.BzrError("parent_id {%s} not in inventory" | 75 | raise errors.BzrError("parent_id {%s} not in inventory" |
677 | 76 | % (parent_id,)) | 76 | % (parent_id,)) |
678 | 77 | if ie.file_id in byid: | 77 | if ie.file_id in byid: |
681 | 78 | raise errors.DuplicateFileId(ie.file_id, | 78 | raise inventory.DuplicateFileId(ie.file_id, byid[ie.file_id]) |
680 | 79 | byid[ie.file_id]) | ||
682 | 80 | if ie.name in parent.children: | 79 | if ie.name in parent.children: |
683 | 81 | raise errors.BzrError( | 80 | raise errors.BzrError( |
684 | 82 | "%s is already versioned" % ( | 81 | "%s is already versioned" % ( |
685 | 83 | 82 | ||
686 | === modified file 'breezy/bzr/xml_serializer.py' | |||
687 | --- breezy/bzr/xml_serializer.py 2020-01-31 10:39:02 +0000 | |||
688 | +++ breezy/bzr/xml_serializer.py 2020-06-26 01:36:03 +0000 | |||
689 | @@ -86,7 +86,7 @@ | |||
690 | 86 | entry_cache=entry_cache, | 86 | entry_cache=entry_cache, |
691 | 87 | return_from_cache=return_from_cache) | 87 | return_from_cache=return_from_cache) |
692 | 88 | except ParseError as e: | 88 | except ParseError as e: |
694 | 89 | raise errors.UnexpectedInventoryFormat(str(e)) | 89 | raise serializer.UnexpectedInventoryFormat(str(e)) |
695 | 90 | 90 | ||
696 | 91 | def read_inventory(self, f, revision_id=None): | 91 | def read_inventory(self, f, revision_id=None): |
697 | 92 | try: | 92 | try: |
698 | @@ -96,7 +96,7 @@ | |||
699 | 96 | finally: | 96 | finally: |
700 | 97 | f.close() | 97 | f.close() |
701 | 98 | except ParseError as e: | 98 | except ParseError as e: |
703 | 99 | raise errors.UnexpectedInventoryFormat(str(e)) | 99 | raise serializer.UnexpectedInventoryFormat(str(e)) |
704 | 100 | 100 | ||
705 | 101 | def write_revision_to_string(self, rev): | 101 | def write_revision_to_string(self, rev): |
706 | 102 | return b''.join(self.write_revision_to_lines(rev)) | 102 | return b''.join(self.write_revision_to_lines(rev)) |
707 | @@ -320,7 +320,7 @@ | |||
708 | 320 | ie = inventory.TreeReference(file_id, name, parent_id, revision, | 320 | ie = inventory.TreeReference(file_id, name, parent_id, revision, |
709 | 321 | reference_revision) | 321 | reference_revision) |
710 | 322 | else: | 322 | else: |
712 | 323 | raise errors.UnsupportedInventoryKind(kind) | 323 | raise serializer.UnsupportedInventoryKind(kind) |
713 | 324 | ie.revision = revision | 324 | ie.revision = revision |
714 | 325 | if revision is not None and entry_cache is not None: | 325 | if revision is not None and entry_cache is not None: |
715 | 326 | # We cache a copy() because callers like to mutate objects, and | 326 | # We cache a copy() because callers like to mutate objects, and |
716 | @@ -344,11 +344,11 @@ | |||
717 | 344 | encountered | 344 | encountered |
718 | 345 | """ | 345 | """ |
719 | 346 | if elt.tag != 'inventory': | 346 | if elt.tag != 'inventory': |
721 | 347 | raise errors.UnexpectedInventoryFormat('Root tag is %r' % elt.tag) | 347 | raise serializer.UnexpectedInventoryFormat('Root tag is %r' % elt.tag) |
722 | 348 | format = elt.get('format') | 348 | format = elt.get('format') |
723 | 349 | if ((format is None and format_num is not None) or | 349 | if ((format is None and format_num is not None) or |
724 | 350 | format.encode() != format_num): | 350 | format.encode() != format_num): |
726 | 351 | raise errors.UnexpectedInventoryFormat('Invalid format version %r' | 351 | raise serializer.UnexpectedInventoryFormat('Invalid format version %r' |
727 | 352 | % format) | 352 | % format) |
728 | 353 | revision_id = elt.get('revision_id') | 353 | revision_id = elt.get('revision_id') |
729 | 354 | if revision_id is not None: | 354 | if revision_id is not None: |
730 | @@ -422,7 +422,7 @@ | |||
731 | 422 | parent_str)) | 422 | parent_str)) |
732 | 423 | elif ie.kind == 'tree-reference': | 423 | elif ie.kind == 'tree-reference': |
733 | 424 | if ie.kind not in supported_kinds: | 424 | if ie.kind not in supported_kinds: |
735 | 425 | raise errors.UnsupportedInventoryKind(ie.kind) | 425 | raise serializer.UnsupportedInventoryKind(ie.kind) |
736 | 426 | if not working: | 426 | if not working: |
737 | 427 | append(b'<tree-reference file_id="%s" name="%s"%s ' | 427 | append(b'<tree-reference file_id="%s" name="%s"%s ' |
738 | 428 | b'revision="%s" reference_revision="%s" />\n' % ( | 428 | b'revision="%s" reference_revision="%s" />\n' % ( |
739 | @@ -437,5 +437,5 @@ | |||
740 | 437 | encode_and_escape(ie.name), | 437 | encode_and_escape(ie.name), |
741 | 438 | parent_str)) | 438 | parent_str)) |
742 | 439 | else: | 439 | else: |
744 | 440 | raise errors.UnsupportedInventoryKind(ie.kind) | 440 | raise serializer.UnsupportedInventoryKind(ie.kind) |
745 | 441 | append(b'</inventory>\n') | 441 | append(b'</inventory>\n') |
746 | 442 | 442 | ||
747 | === modified file 'breezy/errors.py' | |||
748 | --- breezy/errors.py 2020-06-21 02:47:58 +0000 | |||
749 | +++ breezy/errors.py 2020-06-26 01:36:03 +0000 | |||
750 | @@ -250,15 +250,6 @@ | |||
751 | 250 | _fmt = "The branch '%(branch)s' is not stacked." | 250 | _fmt = "The branch '%(branch)s' is not stacked." |
752 | 251 | 251 | ||
753 | 252 | 252 | ||
754 | 253 | class InventoryModified(InternalBzrError): | ||
755 | 254 | |||
756 | 255 | _fmt = ("The current inventory for the tree %(tree)r has been modified," | ||
757 | 256 | " so a clean inventory cannot be read without data loss.") | ||
758 | 257 | |||
759 | 258 | def __init__(self, tree): | ||
760 | 259 | self.tree = tree | ||
761 | 260 | |||
762 | 261 | |||
763 | 262 | class NoWorkingTree(BzrError): | 253 | class NoWorkingTree(BzrError): |
764 | 263 | 254 | ||
765 | 264 | _fmt = 'No WorkingTree exists for "%(base)s".' | 255 | _fmt = 'No WorkingTree exists for "%(base)s".' |
766 | @@ -406,18 +397,6 @@ | |||
767 | 406 | _fmt = 'Permission denied: "%(path)s"%(extra)s' | 397 | _fmt = 'Permission denied: "%(path)s"%(extra)s' |
768 | 407 | 398 | ||
769 | 408 | 399 | ||
770 | 409 | class UnavailableRepresentation(InternalBzrError): | ||
771 | 410 | |||
772 | 411 | _fmt = ("The encoding '%(wanted)s' is not available for key %(key)s which " | ||
773 | 412 | "is encoded as '%(native)s'.") | ||
774 | 413 | |||
775 | 414 | def __init__(self, key, wanted, native): | ||
776 | 415 | InternalBzrError.__init__(self) | ||
777 | 416 | self.wanted = wanted | ||
778 | 417 | self.native = native | ||
779 | 418 | self.key = key | ||
780 | 419 | |||
781 | 420 | |||
782 | 421 | class UnsupportedProtocol(PathError): | 400 | class UnsupportedProtocol(PathError): |
783 | 422 | 401 | ||
784 | 423 | _fmt = 'Unsupported protocol for url "%(path)s"%(extra)s' | 402 | _fmt = 'Unsupported protocol for url "%(path)s"%(extra)s' |
785 | @@ -1499,16 +1478,6 @@ | |||
786 | 1499 | self.file_id = file_id | 1478 | self.file_id = file_id |
787 | 1500 | 1479 | ||
788 | 1501 | 1480 | ||
789 | 1502 | class DuplicateFileId(BzrError): | ||
790 | 1503 | |||
791 | 1504 | _fmt = "File id {%(file_id)s} already exists in inventory as %(entry)s" | ||
792 | 1505 | |||
793 | 1506 | def __init__(self, file_id, entry): | ||
794 | 1507 | BzrError.__init__(self) | ||
795 | 1508 | self.file_id = file_id | ||
796 | 1509 | self.entry = entry | ||
797 | 1510 | |||
798 | 1511 | |||
799 | 1512 | class DuplicateKey(BzrError): | 1481 | class DuplicateKey(BzrError): |
800 | 1513 | 1482 | ||
801 | 1514 | _fmt = "Key %(key)s is already present in map" | 1483 | _fmt = "Key %(key)s is already present in map" |
802 | @@ -1522,23 +1491,6 @@ | |||
803 | 1522 | self.prefix = prefix | 1491 | self.prefix = prefix |
804 | 1523 | 1492 | ||
805 | 1524 | 1493 | ||
806 | 1525 | class MalformedTransform(InternalBzrError): | ||
807 | 1526 | |||
808 | 1527 | _fmt = "Tree transform is malformed %(conflicts)r" | ||
809 | 1528 | |||
810 | 1529 | |||
811 | 1530 | class NoFinalPath(BzrError): | ||
812 | 1531 | |||
813 | 1532 | _fmt = ("No final name for trans_id %(trans_id)r\n" | ||
814 | 1533 | "file-id: %(file_id)r\n" | ||
815 | 1534 | "root trans-id: %(root_trans_id)r\n") | ||
816 | 1535 | |||
817 | 1536 | def __init__(self, trans_id, transform): | ||
818 | 1537 | self.trans_id = trans_id | ||
819 | 1538 | self.file_id = transform.final_file_id(trans_id) | ||
820 | 1539 | self.root_trans_id = transform.root | ||
821 | 1540 | |||
822 | 1541 | |||
823 | 1542 | class BzrBadParameter(InternalBzrError): | 1494 | class BzrBadParameter(InternalBzrError): |
824 | 1543 | 1495 | ||
825 | 1544 | _fmt = "Bad parameter: %(param)r" | 1496 | _fmt = "Bad parameter: %(param)r" |
826 | @@ -1556,11 +1508,6 @@ | |||
827 | 1556 | _fmt = "Parameter %(param)s is neither unicode nor utf8." | 1508 | _fmt = "Parameter %(param)s is neither unicode nor utf8." |
828 | 1557 | 1509 | ||
829 | 1558 | 1510 | ||
830 | 1559 | class ReusingTransform(BzrError): | ||
831 | 1560 | |||
832 | 1561 | _fmt = "Attempt to reuse a transform that has already been applied." | ||
833 | 1562 | |||
834 | 1563 | |||
835 | 1564 | class CantMoveRoot(BzrError): | 1511 | class CantMoveRoot(BzrError): |
836 | 1565 | 1512 | ||
837 | 1566 | _fmt = "Moving the root directory is not supported at this time" | 1513 | _fmt = "Moving the root directory is not supported at this time" |
838 | @@ -1706,12 +1653,6 @@ | |||
839 | 1706 | _fmt = "Diff3 is not installed on this machine." | 1653 | _fmt = "Diff3 is not installed on this machine." |
840 | 1707 | 1654 | ||
841 | 1708 | 1655 | ||
842 | 1709 | class ExistingContent(BzrError): | ||
843 | 1710 | # Added in breezy 0.92, used by VersionedFile.add_lines. | ||
844 | 1711 | |||
845 | 1712 | _fmt = "The content being inserted is already present." | ||
846 | 1713 | |||
847 | 1714 | |||
848 | 1715 | class ExistingLimbo(BzrError): | 1656 | class ExistingLimbo(BzrError): |
849 | 1716 | 1657 | ||
850 | 1717 | _fmt = """This tree contains left-over files from a failed operation. | 1658 | _fmt = """This tree contains left-over files from a failed operation. |
851 | @@ -1733,17 +1674,6 @@ | |||
852 | 1733 | BzrError.__init__(self, pending_deletion=pending_deletion) | 1674 | BzrError.__init__(self, pending_deletion=pending_deletion) |
853 | 1734 | 1675 | ||
854 | 1735 | 1676 | ||
855 | 1736 | class ImmortalLimbo(BzrError): | ||
856 | 1737 | |||
857 | 1738 | _fmt = """Unable to delete transform temporary directory %(limbo_dir)s. | ||
858 | 1739 | Please examine %(limbo_dir)s to see if it contains any files you wish to | ||
859 | 1740 | keep, and delete it when you are done.""" | ||
860 | 1741 | |||
861 | 1742 | def __init__(self, limbo_dir): | ||
862 | 1743 | BzrError.__init__(self) | ||
863 | 1744 | self.limbo_dir = limbo_dir | ||
864 | 1745 | |||
865 | 1746 | |||
866 | 1747 | class ImmortalPendingDeletion(BzrError): | 1677 | class ImmortalPendingDeletion(BzrError): |
867 | 1748 | 1678 | ||
868 | 1749 | _fmt = ("Unable to delete transform temporary directory " | 1679 | _fmt = ("Unable to delete transform temporary directory " |
869 | @@ -1970,19 +1900,6 @@ | |||
870 | 1970 | self.other = other | 1900 | self.other = other |
871 | 1971 | 1901 | ||
872 | 1972 | 1902 | ||
873 | 1973 | class BadInventoryFormat(BzrError): | ||
874 | 1974 | |||
875 | 1975 | _fmt = "Root class for inventory serialization errors" | ||
876 | 1976 | |||
877 | 1977 | |||
878 | 1978 | class UnexpectedInventoryFormat(BadInventoryFormat): | ||
879 | 1979 | |||
880 | 1980 | _fmt = "The inventory was not in the expected format:\n %(msg)s" | ||
881 | 1981 | |||
882 | 1982 | def __init__(self, msg): | ||
883 | 1983 | BadInventoryFormat.__init__(self, msg=msg) | ||
884 | 1984 | |||
885 | 1985 | |||
886 | 1986 | class RootNotRich(BzrError): | 1903 | class RootNotRich(BzrError): |
887 | 1987 | 1904 | ||
888 | 1988 | _fmt = """This operation requires rich root data storage""" | 1905 | _fmt = """This operation requires rich root data storage""" |
889 | @@ -2045,16 +1962,6 @@ | |||
890 | 2045 | " branch location." | 1962 | " branch location." |
891 | 2046 | 1963 | ||
892 | 2047 | 1964 | ||
893 | 2048 | class IllegalMergeDirectivePayload(BzrError): | ||
894 | 2049 | """A merge directive contained something other than a patch or bundle""" | ||
895 | 2050 | |||
896 | 2051 | _fmt = "Bad merge directive payload %(start)r" | ||
897 | 2052 | |||
898 | 2053 | def __init__(self, start): | ||
899 | 2054 | BzrError(self) | ||
900 | 2055 | self.start = start | ||
901 | 2056 | |||
902 | 2057 | |||
903 | 2058 | class PatchVerificationFailed(BzrError): | 1965 | class PatchVerificationFailed(BzrError): |
904 | 2059 | """A patch from a merge directive could not be verified""" | 1966 | """A patch from a merge directive could not be verified""" |
905 | 2060 | 1967 | ||
906 | @@ -2084,14 +1991,6 @@ | |||
907 | 2084 | self.location = location | 1991 | self.location = location |
908 | 2085 | 1992 | ||
909 | 2086 | 1993 | ||
910 | 2087 | class UnsupportedInventoryKind(BzrError): | ||
911 | 2088 | |||
912 | 2089 | _fmt = """Unsupported entry kind %(kind)s""" | ||
913 | 2090 | |||
914 | 2091 | def __init__(self, kind): | ||
915 | 2092 | self.kind = kind | ||
916 | 2093 | |||
917 | 2094 | |||
918 | 2095 | class BadSubsumeSource(BzrError): | 1994 | class BadSubsumeSource(BzrError): |
919 | 2096 | 1995 | ||
920 | 2097 | _fmt = "Can't subsume %(other_tree)s into %(tree)s. %(reason)s" | 1996 | _fmt = "Can't subsume %(other_tree)s into %(tree)s. %(reason)s" |
921 | 2098 | 1997 | ||
922 | === modified file 'breezy/git/annotate.py' | |||
923 | --- breezy/git/annotate.py 2020-02-09 01:27:02 +0000 | |||
924 | +++ breezy/git/annotate.py 2020-06-26 01:36:03 +0000 | |||
925 | @@ -23,9 +23,9 @@ | |||
926 | 23 | ) | 23 | ) |
927 | 24 | 24 | ||
928 | 25 | from .. import osutils | 25 | from .. import osutils |
929 | 26 | from ..bzr.versionedfile import UnavailableRepresentation | ||
930 | 26 | from ..errors import ( | 27 | from ..errors import ( |
931 | 27 | NoSuchRevision, | 28 | NoSuchRevision, |
932 | 28 | UnavailableRepresentation, | ||
933 | 29 | ) | 29 | ) |
934 | 30 | from ..graph import Graph | 30 | from ..graph import Graph |
935 | 31 | from ..revision import ( | 31 | from ..revision import ( |
936 | 32 | 32 | ||
937 | === modified file 'breezy/merge_directive.py' | |||
938 | --- breezy/merge_directive.py 2020-01-11 17:41:33 +0000 | |||
939 | +++ breezy/merge_directive.py 2020-06-26 01:36:03 +0000 | |||
940 | @@ -49,6 +49,16 @@ | |||
941 | 49 | ) | 49 | ) |
942 | 50 | 50 | ||
943 | 51 | 51 | ||
944 | 52 | class IllegalMergeDirectivePayload(errors.BzrError): | ||
945 | 53 | """A merge directive contained something other than a patch or bundle""" | ||
946 | 54 | |||
947 | 55 | _fmt = "Bad merge directive payload %(start)r" | ||
948 | 56 | |||
949 | 57 | def __init__(self, start): | ||
950 | 58 | errors.BzrError(self) | ||
951 | 59 | self.start = start | ||
952 | 60 | |||
953 | 61 | |||
954 | 52 | class MergeRequestBodyParams(object): | 62 | class MergeRequestBodyParams(object): |
955 | 53 | """Parameter object for the merge_request_body hook.""" | 63 | """Parameter object for the merge_request_body hook.""" |
956 | 54 | 64 | ||
957 | @@ -546,7 +556,7 @@ | |||
958 | 546 | if start.startswith(b'# Begin bundle'): | 556 | if start.startswith(b'# Begin bundle'): |
959 | 547 | bundle = b''.join(line_iter) | 557 | bundle = b''.join(line_iter) |
960 | 548 | else: | 558 | else: |
962 | 549 | raise errors.IllegalMergeDirectivePayload(start) | 559 | raise IllegalMergeDirectivePayload(start) |
963 | 550 | time, timezone = timestamp.parse_patch_date(stanza.get('timestamp')) | 560 | time, timezone = timestamp.parse_patch_date(stanza.get('timestamp')) |
964 | 551 | kwargs = {} | 561 | kwargs = {} |
965 | 552 | for key in ('revision_id', 'testament_sha1', 'target_branch', | 562 | for key in ('revision_id', 'testament_sha1', 'target_branch', |
966 | 553 | 563 | ||
967 | === modified file 'breezy/tests/per_workingtree/test_add.py' | |||
968 | --- breezy/tests/per_workingtree/test_add.py 2019-06-29 13:16:26 +0000 | |||
969 | +++ breezy/tests/per_workingtree/test_add.py 2020-06-26 01:36:03 +0000 | |||
970 | @@ -50,8 +50,8 @@ | |||
971 | 50 | self.skipTest("tree does not support setting file ids") | 50 | self.skipTest("tree does not support setting file ids") |
972 | 51 | self.build_tree(['a', 'b']) | 51 | self.build_tree(['a', 'b']) |
973 | 52 | tree.add(['a']) | 52 | tree.add(['a']) |
976 | 53 | self.assertRaises(errors.DuplicateFileId, | 53 | self.assertRaises( |
977 | 54 | tree.add, ['b'], [tree.path2id('a')]) | 54 | inventory.DuplicateFileId, tree.add, ['b'], [tree.path2id('a')]) |
978 | 55 | # And the entry should not have been added. | 55 | # And the entry should not have been added. |
979 | 56 | self.assertTreeLayout(['', 'a'], tree) | 56 | self.assertTreeLayout(['', 'a'], tree) |
980 | 57 | 57 | ||
981 | 58 | 58 | ||
982 | === modified file 'breezy/tests/per_workingtree/test_read_working_inventory.py' | |||
983 | --- breezy/tests/per_workingtree/test_read_working_inventory.py 2018-11-11 04:08:32 +0000 | |||
984 | +++ breezy/tests/per_workingtree/test_read_working_inventory.py 2020-06-26 01:36:03 +0000 | |||
985 | @@ -20,7 +20,7 @@ | |||
986 | 20 | from breezy.bzr import inventory | 20 | from breezy.bzr import inventory |
987 | 21 | from breezy.tests import TestNotApplicable | 21 | from breezy.tests import TestNotApplicable |
988 | 22 | from breezy.tests.per_workingtree import TestCaseWithWorkingTree | 22 | from breezy.tests.per_workingtree import TestCaseWithWorkingTree |
990 | 23 | from breezy.bzr.workingtree import InventoryWorkingTree | 23 | from breezy.bzr.workingtree import InventoryWorkingTree, InventoryModified |
991 | 24 | 24 | ||
992 | 25 | 25 | ||
993 | 26 | class TestReadWorkingInventory(TestCaseWithWorkingTree): | 26 | class TestReadWorkingInventory(TestCaseWithWorkingTree): |
994 | @@ -49,7 +49,7 @@ | |||
995 | 49 | # OR, the call can be ignored and the changes preserved | 49 | # OR, the call can be ignored and the changes preserved |
996 | 50 | try: | 50 | try: |
997 | 51 | tree.read_working_inventory() | 51 | tree.read_working_inventory() |
999 | 52 | except errors.InventoryModified: | 52 | except InventoryModified: |
1000 | 53 | pass | 53 | pass |
1001 | 54 | else: | 54 | else: |
1002 | 55 | self.assertEqual(b'new-root', tree.path2id('')) | 55 | self.assertEqual(b'new-root', tree.path2id('')) |
1003 | 56 | 56 | ||
1004 | === modified file 'breezy/tests/test_conflicts.py' | |||
1005 | --- breezy/tests/test_conflicts.py 2018-11-11 04:08:32 +0000 | |||
1006 | +++ breezy/tests/test_conflicts.py 2020-06-26 01:36:03 +0000 | |||
1007 | @@ -23,6 +23,7 @@ | |||
1008 | 23 | option, | 23 | option, |
1009 | 24 | osutils, | 24 | osutils, |
1010 | 25 | tests, | 25 | tests, |
1011 | 26 | transform, | ||
1012 | 26 | ) | 27 | ) |
1013 | 27 | from ..sixish import text_type | 28 | from ..sixish import text_type |
1014 | 28 | from . import ( | 29 | from . import ( |
1015 | @@ -1077,7 +1078,7 @@ | |||
1016 | 1077 | # This is nearly like TestResolveNonDirectoryParent but with branch and | 1078 | # This is nearly like TestResolveNonDirectoryParent but with branch and |
1017 | 1078 | # trunk switched. As such it should certainly produce the same | 1079 | # trunk switched. As such it should certainly produce the same |
1018 | 1079 | # conflict. | 1080 | # conflict. |
1020 | 1080 | self.assertRaises(errors.MalformedTransform, | 1081 | self.assertRaises(transform.MalformedTransform, |
1021 | 1081 | self.run_script, """ | 1082 | self.run_script, """ |
1022 | 1082 | $ brz init trunk | 1083 | $ brz init trunk |
1023 | 1083 | ... | 1084 | ... |
1024 | 1084 | 1085 | ||
1025 | === modified file 'breezy/tests/test_errors.py' | |||
1026 | --- breezy/tests/test_errors.py 2019-03-04 00:16:27 +0000 | |||
1027 | +++ breezy/tests/test_errors.py 2020-06-26 01:36:03 +0000 | |||
1028 | @@ -67,11 +67,6 @@ | |||
1029 | 67 | "^Filename b?'bad/filen\\\\xe5me' is not valid in your current" | 67 | "^Filename b?'bad/filen\\\\xe5me' is not valid in your current" |
1030 | 68 | " filesystem encoding UTF-8$") | 68 | " filesystem encoding UTF-8$") |
1031 | 69 | 69 | ||
1032 | 70 | def test_duplicate_file_id(self): | ||
1033 | 71 | error = errors.DuplicateFileId('a_file_id', 'foo') | ||
1034 | 72 | self.assertEqualDiff('File id {a_file_id} already exists in inventory' | ||
1035 | 73 | ' as foo', str(error)) | ||
1036 | 74 | |||
1037 | 75 | def test_duplicate_help_prefix(self): | 70 | def test_duplicate_help_prefix(self): |
1038 | 76 | error = errors.DuplicateHelpPrefix('foo') | 71 | error = errors.DuplicateHelpPrefix('foo') |
1039 | 77 | self.assertEqualDiff('The prefix foo is in the help search path twice.', | 72 | self.assertEqualDiff('The prefix foo is in the help search path twice.', |
1040 | @@ -125,13 +120,6 @@ | |||
1041 | 125 | self.assertEqual("Invalid range access in path at 12: bad range", | 120 | self.assertEqual("Invalid range access in path at 12: bad range", |
1042 | 126 | str(error)) | 121 | str(error)) |
1043 | 127 | 122 | ||
1044 | 128 | def test_inventory_modified(self): | ||
1045 | 129 | error = errors.InventoryModified("a tree to be repred") | ||
1046 | 130 | self.assertEqualDiff("The current inventory for the tree 'a tree to " | ||
1047 | 131 | "be repred' has been modified, so a clean inventory cannot be " | ||
1048 | 132 | "read without data loss.", | ||
1049 | 133 | str(error)) | ||
1050 | 134 | |||
1051 | 135 | def test_jail_break(self): | 123 | def test_jail_break(self): |
1052 | 136 | error = errors.JailBreak("some url") | 124 | error = errors.JailBreak("some url") |
1053 | 137 | self.assertEqualDiff("An attempt to access a url outside the server" | 125 | self.assertEqualDiff("An attempt to access a url outside the server" |
1054 | @@ -199,13 +187,6 @@ | |||
1055 | 199 | "the currently open request.", | 187 | "the currently open request.", |
1056 | 200 | str(error)) | 188 | str(error)) |
1057 | 201 | 189 | ||
1058 | 202 | def test_unavailable_representation(self): | ||
1059 | 203 | error = errors.UnavailableRepresentation( | ||
1060 | 204 | ('key',), "mpdiff", "fulltext") | ||
1061 | 205 | self.assertEqualDiff("The encoding 'mpdiff' is not available for key " | ||
1062 | 206 | "('key',) which is encoded as 'fulltext'.", | ||
1063 | 207 | str(error)) | ||
1064 | 208 | |||
1065 | 209 | def test_unstackable_location(self): | 190 | def test_unstackable_location(self): |
1066 | 210 | error = errors.UnstackableLocationError('foo', 'bar') | 191 | error = errors.UnstackableLocationError('foo', 'bar') |
1067 | 211 | self.assertEqualDiff("The branch 'foo' cannot be stacked on 'bar'.", | 192 | self.assertEqualDiff("The branch 'foo' cannot be stacked on 'bar'.", |
1068 | 212 | 193 | ||
1069 | === modified file 'breezy/tests/test_shelf.py' | |||
1070 | --- breezy/tests/test_shelf.py 2019-09-27 02:48:17 +0000 | |||
1071 | +++ breezy/tests/test_shelf.py 2020-06-26 01:36:03 +0000 | |||
1072 | @@ -32,9 +32,6 @@ | |||
1073 | 32 | features, | 32 | features, |
1074 | 33 | KnownFailure, | 33 | KnownFailure, |
1075 | 34 | ) | 34 | ) |
1076 | 35 | from ..errors import ( | ||
1077 | 36 | MalformedTransform, | ||
1078 | 37 | ) | ||
1079 | 38 | 35 | ||
1080 | 39 | 36 | ||
1081 | 40 | EMPTY_SHELF = (b"Bazaar pack format 1 (introduced in 0.18)\n" | 37 | EMPTY_SHELF = (b"Bazaar pack format 1 (introduced in 0.18)\n" |
1082 | @@ -254,7 +251,7 @@ | |||
1083 | 254 | try: | 251 | try: |
1084 | 255 | creator.transform() | 252 | creator.transform() |
1085 | 256 | self.check_shelve_creation(creator, tree) | 253 | self.check_shelve_creation(creator, tree) |
1087 | 257 | except MalformedTransform: | 254 | except transform.MalformedTransform: |
1088 | 258 | raise KnownFailure( | 255 | raise KnownFailure( |
1089 | 259 | 'shelving directory with ignored file: see bug #611739') | 256 | 'shelving directory with ignored file: see bug #611739') |
1090 | 260 | 257 | ||
1091 | 261 | 258 | ||
1092 | === modified file 'breezy/tests/test_transform.py' | |||
1093 | --- breezy/tests/test_transform.py 2019-09-21 23:05:12 +0000 | |||
1094 | +++ breezy/tests/test_transform.py 2020-06-26 01:36:03 +0000 | |||
1095 | @@ -51,11 +51,8 @@ | |||
1096 | 51 | DuplicateKey, | 51 | DuplicateKey, |
1097 | 52 | ExistingLimbo, | 52 | ExistingLimbo, |
1098 | 53 | ExistingPendingDeletion, | 53 | ExistingPendingDeletion, |
1099 | 54 | ImmortalLimbo, | ||
1100 | 55 | ImmortalPendingDeletion, | 54 | ImmortalPendingDeletion, |
1101 | 56 | LockError, | 55 | LockError, |
1102 | 57 | MalformedTransform, | ||
1103 | 58 | ReusingTransform, | ||
1104 | 59 | ) | 56 | ) |
1105 | 60 | from ..osutils import ( | 57 | from ..osutils import ( |
1106 | 61 | file_kind, | 58 | file_kind, |
1107 | @@ -86,6 +83,10 @@ | |||
1108 | 86 | resolve_conflicts, | 83 | resolve_conflicts, |
1109 | 87 | resolve_checkout, | 84 | resolve_checkout, |
1110 | 88 | ROOT_PARENT, | 85 | ROOT_PARENT, |
1111 | 86 | ImmortalLimbo, | ||
1112 | 87 | MalformedTransform, | ||
1113 | 88 | NoFinalPath, | ||
1114 | 89 | ReusingTransform, | ||
1115 | 89 | TransformPreview, | 90 | TransformPreview, |
1116 | 90 | TreeTransform, | 91 | TreeTransform, |
1117 | 91 | ) | 92 | ) |
1118 | @@ -982,7 +983,7 @@ | |||
1119 | 982 | self.assertEqual(('missing parent', 'Created directory', 'new-1'), | 983 | self.assertEqual(('missing parent', 'Created directory', 'new-1'), |
1120 | 983 | raw_conflicts.pop()) | 984 | raw_conflicts.pop()) |
1121 | 984 | # apply fail since the missing directory doesn't exist | 985 | # apply fail since the missing directory doesn't exist |
1123 | 985 | self.assertRaises(errors.NoFinalPath, tt.apply) | 986 | self.assertRaises(NoFinalPath, tt.apply) |
1124 | 986 | 987 | ||
1125 | 987 | def test_moving_versioned_directories(self): | 988 | def test_moving_versioned_directories(self): |
1126 | 988 | create, root = self.get_transform() | 989 | create, root = self.get_transform() |
1127 | @@ -2445,7 +2446,7 @@ | |||
1128 | 2445 | branch, tt = self.get_branch_and_transform() | 2446 | branch, tt = self.get_branch_and_transform() |
1129 | 2446 | parent_id = tt.trans_id_file_id(b'parent-id') | 2447 | parent_id = tt.trans_id_file_id(b'parent-id') |
1130 | 2447 | tt.new_file('file', parent_id, [b'contents'], b'file-id') | 2448 | tt.new_file('file', parent_id, [b'contents'], b'file-id') |
1132 | 2448 | self.assertRaises(errors.MalformedTransform, tt.commit, branch, | 2449 | self.assertRaises(MalformedTransform, tt.commit, branch, |
1133 | 2449 | 'message') | 2450 | 'message') |
1134 | 2450 | 2451 | ||
1135 | 2451 | def test_commit_rich_revision_data(self): | 2452 | def test_commit_rich_revision_data(self): |
1136 | 2452 | 2453 | ||
1137 | === modified file 'breezy/transform.py' | |||
1138 | --- breezy/transform.py 2020-02-09 17:10:01 +0000 | |||
1139 | +++ breezy/transform.py 2020-06-26 01:36:03 +0000 | |||
1140 | @@ -51,9 +51,9 @@ | |||
1141 | 51 | ) | 51 | ) |
1142 | 52 | from breezy.i18n import gettext | 52 | from breezy.i18n import gettext |
1143 | 53 | """) | 53 | """) |
1147 | 54 | from .errors import (DuplicateKey, MalformedTransform, | 54 | from .errors import (DuplicateKey, |
1148 | 55 | ReusingTransform, CantMoveRoot, | 55 | CantMoveRoot, |
1149 | 56 | ImmortalLimbo, NoFinalPath) | 56 | BzrError, InternalBzrError) |
1150 | 57 | from .filters import filtered_output_bytes, ContentFilterContext | 57 | from .filters import filtered_output_bytes, ContentFilterContext |
1151 | 58 | from .mutabletree import MutableTree | 58 | from .mutabletree import MutableTree |
1152 | 59 | from .osutils import ( | 59 | from .osutils import ( |
1153 | @@ -79,6 +79,39 @@ | |||
1154 | 79 | ROOT_PARENT = "root-parent" | 79 | ROOT_PARENT = "root-parent" |
1155 | 80 | 80 | ||
1156 | 81 | 81 | ||
1157 | 82 | class NoFinalPath(BzrError): | ||
1158 | 83 | |||
1159 | 84 | _fmt = ("No final name for trans_id %(trans_id)r\n" | ||
1160 | 85 | "file-id: %(file_id)r\n" | ||
1161 | 86 | "root trans-id: %(root_trans_id)r\n") | ||
1162 | 87 | |||
1163 | 88 | def __init__(self, trans_id, transform): | ||
1164 | 89 | self.trans_id = trans_id | ||
1165 | 90 | self.file_id = transform.final_file_id(trans_id) | ||
1166 | 91 | self.root_trans_id = transform.root | ||
1167 | 92 | |||
1168 | 93 | |||
1169 | 94 | class ReusingTransform(BzrError): | ||
1170 | 95 | |||
1171 | 96 | _fmt = "Attempt to reuse a transform that has already been applied." | ||
1172 | 97 | |||
1173 | 98 | |||
1174 | 99 | class MalformedTransform(InternalBzrError): | ||
1175 | 100 | |||
1176 | 101 | _fmt = "Tree transform is malformed %(conflicts)r" | ||
1177 | 102 | |||
1178 | 103 | |||
1179 | 104 | class ImmortalLimbo(BzrError): | ||
1180 | 105 | |||
1181 | 106 | _fmt = """Unable to delete transform temporary directory %(limbo_dir)s. | ||
1182 | 107 | Please examine %(limbo_dir)s to see if it contains any files you wish to | ||
1183 | 108 | keep, and delete it when you are done.""" | ||
1184 | 109 | |||
1185 | 110 | def __init__(self, limbo_dir): | ||
1186 | 111 | BzrError.__init__(self) | ||
1187 | 112 | self.limbo_dir = limbo_dir | ||
1188 | 113 | |||
1189 | 114 | |||
1190 | 82 | def unique_add(map, key, value): | 115 | def unique_add(map, key, value): |
1191 | 83 | if key in map: | 116 | if key in map: |
1192 | 84 | raise DuplicateKey(key=key) | 117 | raise DuplicateKey(key=key) |
Running landing tests failed /ci.breezy- vcs.org/ job/brz- 3.1/job/ brz-3.1- land/158/
https:/