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/objects-1 |
Merge into: | lp:brz |
Prerequisite: | lp:~jelmer/brz/objects |
Diff against target: |
1612 lines (+440/-407) 28 files modified
breezy/builtins.py (+8/-8) breezy/bzr/_dirstate_helpers_pyx.pyx (+6/-3) breezy/bzr/dirstate.py (+9/-9) breezy/bzr/inventory.py (+3/-2) breezy/bzr/inventorytree.py (+4/-5) breezy/bzr/vf_repository.py (+30/-28) breezy/bzr/workingtree.py (+9/-10) breezy/commit.py (+16/-19) breezy/delta.py (+31/-31) breezy/diff.py (+13/-12) breezy/git/commit.py (+29/-29) breezy/git/object_store.py (+21/-22) breezy/git/workingtree.py (+11/-12) breezy/merge.py (+11/-11) breezy/mutabletree.py (+1/-1) breezy/plugins/fastimport/revision_store.py (+41/-36) breezy/plugins/launchpad/lp_propose.py (+2/-3) breezy/plugins/propose/launchpad.py (+2/-3) breezy/rename_map.py (+13/-13) breezy/shelf.py (+22/-23) breezy/tests/per_intertree/test_compare.py (+76/-61) breezy/tests/per_repository/test_check.py (+4/-2) breezy/tests/per_repository/test_commit_builder.py (+6/-4) breezy/tests/test__dirstate_helpers.py (+3/-6) breezy/tests/test_commit.py (+17/-12) breezy/tests/test_transform.py (+2/-3) breezy/transform.py (+35/-34) breezy/tree.py (+15/-5) |
To merge this branch: | bzr merge lp:~jelmer/brz/objects-1 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Martin Packman | Approve | ||
Review via email: mp+368859@code.launchpad.net |
Commit message
Use the new attributes on TreeChange rather than indexing.
Description of the change
Use the new attributes on TreeChange rather than indexing.
To post a comment you must log in.
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/builtins.py' | |||
2 | --- breezy/builtins.py 2019-06-02 03:11:13 +0000 | |||
3 | +++ breezy/builtins.py 2019-06-15 17:35:57 +0000 | |||
4 | @@ -1701,12 +1701,12 @@ | |||
5 | 1701 | self.add_cleanup(old_tree.lock_read().unlock) | 1701 | self.add_cleanup(old_tree.lock_read().unlock) |
6 | 1702 | renames = [] | 1702 | renames = [] |
7 | 1703 | iterator = tree.iter_changes(old_tree, include_unchanged=True) | 1703 | iterator = tree.iter_changes(old_tree, include_unchanged=True) |
14 | 1704 | for f, paths, c, v, p, n, k, e in iterator: | 1704 | for change in iterator: |
15 | 1705 | if paths[0] == paths[1]: | 1705 | if change.path[0] == change.path[1]: |
16 | 1706 | continue | 1706 | continue |
17 | 1707 | if None in (paths): | 1707 | if None in change.path: |
18 | 1708 | continue | 1708 | continue |
19 | 1709 | renames.append(paths) | 1709 | renames.append(change.path) |
20 | 1710 | renames.sort() | 1710 | renames.sort() |
21 | 1711 | for old_name, new_name in renames: | 1711 | for old_name, new_name in renames: |
22 | 1712 | self.outf.write("%s => %s\n" % (old_name, new_name)) | 1712 | self.outf.write("%s => %s\n" % (old_name, new_name)) |
23 | @@ -1916,8 +1916,8 @@ | |||
24 | 1916 | missing = [] | 1916 | missing = [] |
25 | 1917 | for change in tree.iter_changes(tree.basis_tree()): | 1917 | for change in tree.iter_changes(tree.basis_tree()): |
26 | 1918 | # Find paths in the working tree that have no kind: | 1918 | # Find paths in the working tree that have no kind: |
29 | 1919 | if change[1][1] is not None and change[6][1] is None: | 1919 | if change.path[1] is not None and change.kind[1] is None: |
30 | 1920 | missing.append(change[1][1]) | 1920 | missing.append(change.path[1]) |
31 | 1921 | file_list = sorted(missing, reverse=True) | 1921 | file_list = sorted(missing, reverse=True) |
32 | 1922 | file_deletion_strategy = 'keep' | 1922 | file_deletion_strategy = 'keep' |
33 | 1923 | tree.remove(file_list, verbose=verbose, to_file=self.outf, | 1923 | tree.remove(file_list, verbose=verbose, to_file=self.outf, |
34 | 1924 | 1924 | ||
35 | === modified file 'breezy/bzr/_dirstate_helpers_pyx.pyx' | |||
36 | --- breezy/bzr/_dirstate_helpers_pyx.pyx 2019-06-15 01:02:49 +0000 | |||
37 | +++ breezy/bzr/_dirstate_helpers_pyx.pyx 2019-06-15 17:35:57 +0000 | |||
38 | @@ -1553,7 +1553,8 @@ | |||
39 | 1553 | new_executable = bool( | 1553 | new_executable = bool( |
40 | 1554 | stat.S_ISREG(self.root_dir_info[3].st_mode) | 1554 | stat.S_ISREG(self.root_dir_info[3].st_mode) |
41 | 1555 | and stat.S_IEXEC & self.root_dir_info[3].st_mode) | 1555 | and stat.S_IEXEC & self.root_dir_info[3].st_mode) |
43 | 1556 | return (None, | 1556 | return TreeChange( |
44 | 1557 | None, | ||
45 | 1557 | (None, self.current_root_unicode), | 1558 | (None, self.current_root_unicode), |
46 | 1558 | True, | 1559 | True, |
47 | 1559 | (False, False), | 1560 | (False, False), |
48 | @@ -1664,7 +1665,8 @@ | |||
49 | 1664 | new_executable = bool( | 1665 | new_executable = bool( |
50 | 1665 | stat.S_ISREG(current_path_info[3].st_mode) | 1666 | stat.S_ISREG(current_path_info[3].st_mode) |
51 | 1666 | and stat.S_IEXEC & current_path_info[3].st_mode) | 1667 | and stat.S_IEXEC & current_path_info[3].st_mode) |
53 | 1667 | return (None, | 1668 | return TreeChange( |
54 | 1669 | None, | ||
55 | 1668 | (None, self.utf8_decode(current_path_info[0])[0]), | 1670 | (None, self.utf8_decode(current_path_info[0])[0]), |
56 | 1669 | True, | 1671 | True, |
57 | 1670 | (False, False), | 1672 | (False, False), |
58 | @@ -1833,7 +1835,8 @@ | |||
59 | 1833 | if changed is not None: | 1835 | if changed is not None: |
60 | 1834 | raise AssertionError( | 1836 | raise AssertionError( |
61 | 1835 | "result is not None: %r" % result) | 1837 | "result is not None: %r" % result) |
63 | 1836 | result = (None, | 1838 | result = TreeChange( |
64 | 1839 | None, | ||
65 | 1837 | (None, relpath_unicode), | 1840 | (None, relpath_unicode), |
66 | 1838 | True, | 1841 | True, |
67 | 1839 | (False, False), | 1842 | (False, False), |
68 | 1840 | 1843 | ||
69 | === modified file 'breezy/bzr/dirstate.py' | |||
70 | --- breezy/bzr/dirstate.py 2019-06-15 01:02:49 +0000 | |||
71 | +++ breezy/bzr/dirstate.py 2019-06-15 17:35:57 +0000 | |||
72 | @@ -4190,15 +4190,15 @@ | |||
73 | 4190 | except UnicodeDecodeError: | 4190 | except UnicodeDecodeError: |
74 | 4191 | raise errors.BadFilenameEncoding( | 4191 | raise errors.BadFilenameEncoding( |
75 | 4192 | current_path_info[0], osutils._fs_enc) | 4192 | current_path_info[0], osutils._fs_enc) |
85 | 4193 | yield (None, | 4193 | yield TreeChange( |
86 | 4194 | (None, relpath_unicode), | 4194 | None, |
87 | 4195 | True, | 4195 | (None, relpath_unicode), |
88 | 4196 | (False, False), | 4196 | True, |
89 | 4197 | (None, None), | 4197 | (False, False), |
90 | 4198 | (None, utf8_decode( | 4198 | (None, None), |
91 | 4199 | current_path_info[1])[0]), | 4199 | (None, utf8_decode(current_path_info[1])[0]), |
92 | 4200 | (None, current_path_info[2]), | 4200 | (None, current_path_info[2]), |
93 | 4201 | (None, new_executable)) | 4201 | (None, new_executable)) |
94 | 4202 | # dont descend into this unversioned path if it is | 4202 | # dont descend into this unversioned path if it is |
95 | 4203 | # a dir | 4203 | # a dir |
96 | 4204 | if current_path_info[2] in ('directory'): | 4204 | if current_path_info[2] in ('directory'): |
97 | 4205 | 4205 | ||
98 | === modified file 'breezy/bzr/inventory.py' | |||
99 | --- breezy/bzr/inventory.py 2019-06-15 13:33:16 +0000 | |||
100 | +++ breezy/bzr/inventory.py 2019-06-15 17:35:57 +0000 | |||
101 | @@ -2104,8 +2104,9 @@ | |||
102 | 2104 | # Could happen when only the revision changed for a directory | 2104 | # Could happen when only the revision changed for a directory |
103 | 2105 | # for instance. | 2105 | # for instance. |
104 | 2106 | continue | 2106 | continue |
107 | 2107 | yield (file_id, (path_in_source, path_in_target), changed_content, | 2107 | yield ( |
108 | 2108 | versioned, parent, name, kind, executable) | 2108 | file_id, (path_in_source, path_in_target), changed_content, |
109 | 2109 | versioned, parent, name, kind, executable) | ||
110 | 2109 | 2110 | ||
111 | 2110 | def __len__(self): | 2111 | def __len__(self): |
112 | 2111 | """Return the number of entries in the inventory.""" | 2112 | """Return the number of entries in the inventory.""" |
113 | 2112 | 2113 | ||
114 | === modified file 'breezy/bzr/inventorytree.py' | |||
115 | --- breezy/bzr/inventorytree.py 2019-06-15 01:02:49 +0000 | |||
116 | +++ breezy/bzr/inventorytree.py 2019-06-15 17:35:57 +0000 | |||
117 | @@ -893,16 +893,15 @@ | |||
118 | 893 | # FIXME: nested tree support | 893 | # FIXME: nested tree support |
119 | 894 | for result in self.target.root_inventory.iter_changes( | 894 | for result in self.target.root_inventory.iter_changes( |
120 | 895 | self.source.root_inventory): | 895 | self.source.root_inventory): |
121 | 896 | result = TreeChange(*result) | ||
122 | 896 | if specific_file_ids is not None: | 897 | if specific_file_ids is not None: |
125 | 897 | file_id = result[0] | 898 | if result.file_id not in specific_file_ids: |
124 | 898 | if file_id not in specific_file_ids: | ||
126 | 899 | # A change from the whole tree that we don't want to show yet. | 899 | # A change from the whole tree that we don't want to show yet. |
127 | 900 | # We may find that we need to show it for delta consistency, so | 900 | # We may find that we need to show it for delta consistency, so |
128 | 901 | # stash it. | 901 | # stash it. |
130 | 902 | discarded_changes[result[0]] = result | 902 | discarded_changes[result.file_id] = result |
131 | 903 | continue | 903 | continue |
134 | 904 | new_parent_id = result[4][1] | 904 | precise_file_ids.add(result.parent_id[1]) |
133 | 905 | precise_file_ids.add(new_parent_id) | ||
135 | 906 | yield result | 905 | yield result |
136 | 907 | changed_file_ids.add(result[0]) | 906 | changed_file_ids.add(result[0]) |
137 | 908 | if specific_file_ids is not None: | 907 | if specific_file_ids is not None: |
138 | 909 | 908 | ||
139 | === modified file 'breezy/bzr/vf_repository.py' | |||
140 | --- breezy/bzr/vf_repository.py 2019-05-29 03:22:34 +0000 | |||
141 | +++ breezy/bzr/vf_repository.py 2019-06-15 17:35:57 +0000 | |||
142 | @@ -85,6 +85,7 @@ | |||
143 | 85 | from ..trace import ( | 85 | from ..trace import ( |
144 | 86 | mutter | 86 | mutter |
145 | 87 | ) | 87 | ) |
146 | 88 | from ..tree import TreeChange | ||
147 | 88 | 89 | ||
148 | 89 | 90 | ||
149 | 90 | class VersionedFileRepositoryFormat(RepositoryFormat): | 91 | class VersionedFileRepositoryFormat(RepositoryFormat): |
150 | @@ -374,12 +375,12 @@ | |||
151 | 374 | changes = {} | 375 | changes = {} |
152 | 375 | for change in iter_changes: | 376 | for change in iter_changes: |
153 | 376 | # This probably looks up in basis_inv way to much. | 377 | # This probably looks up in basis_inv way to much. |
156 | 377 | if change[1][0] is not None: | 378 | if change.path[0] is not None: |
157 | 378 | head_candidate = [basis_inv.get_entry(change[0]).revision] | 379 | head_candidate = [basis_inv.get_entry(change.file_id).revision] |
158 | 379 | else: | 380 | else: |
159 | 380 | head_candidate = [] | 381 | head_candidate = [] |
162 | 381 | changes[change[0]] = change, merged_ids.get(change[0], | 382 | changes[change.file_id] = change, merged_ids.get( |
163 | 382 | head_candidate) | 383 | change.file_id, head_candidate) |
164 | 383 | unchanged_merged = set(merged_ids) - set(changes) | 384 | unchanged_merged = set(merged_ids) - set(changes) |
165 | 384 | # Extend the changes dict with synthetic changes to record merges of | 385 | # Extend the changes dict with synthetic changes to record merges of |
166 | 385 | # texts. | 386 | # texts. |
167 | @@ -403,13 +404,14 @@ | |||
168 | 403 | # by the user. So we discard this change. | 404 | # by the user. So we discard this change. |
169 | 404 | pass | 405 | pass |
170 | 405 | else: | 406 | else: |
178 | 406 | change = (file_id, | 407 | change = TreeChange( |
179 | 407 | (basis_inv.id2path(file_id), tree.id2path(file_id)), | 408 | file_id, |
180 | 408 | False, (True, True), | 409 | (basis_inv.id2path(file_id), tree.id2path(file_id)), |
181 | 409 | (basis_entry.parent_id, basis_entry.parent_id), | 410 | False, (True, True), |
182 | 410 | (basis_entry.name, basis_entry.name), | 411 | (basis_entry.parent_id, basis_entry.parent_id), |
183 | 411 | (basis_entry.kind, basis_entry.kind), | 412 | (basis_entry.name, basis_entry.name), |
184 | 412 | (basis_entry.executable, basis_entry.executable)) | 413 | (basis_entry.kind, basis_entry.kind), |
185 | 414 | (basis_entry.executable, basis_entry.executable)) | ||
186 | 413 | changes[file_id] = (change, merged_ids[file_id]) | 415 | changes[file_id] = (change, merged_ids[file_id]) |
187 | 414 | # changes contains tuples with the change and a set of inventory | 416 | # changes contains tuples with the change and a set of inventory |
188 | 415 | # candidates for the file. | 417 | # candidates for the file. |
189 | @@ -419,7 +421,7 @@ | |||
190 | 419 | inv_delta = self._basis_delta | 421 | inv_delta = self._basis_delta |
191 | 420 | modified_rev = self._new_revision_id | 422 | modified_rev = self._new_revision_id |
192 | 421 | for change, head_candidates in viewvalues(changes): | 423 | for change, head_candidates in viewvalues(changes): |
194 | 422 | if change[3][1]: # versioned in target. | 424 | if change.versioned[1]: # versioned in target. |
195 | 423 | # Several things may be happening here: | 425 | # Several things may be happening here: |
196 | 424 | # We may have a fork in the per-file graph | 426 | # We may have a fork in the per-file graph |
197 | 425 | # - record a change with the content from tree | 427 | # - record a change with the content from tree |
198 | @@ -427,11 +429,11 @@ | |||
199 | 427 | # - carry over the tree that hasn't changed | 429 | # - carry over the tree that hasn't changed |
200 | 428 | # We may have a change against all trees | 430 | # We may have a change against all trees |
201 | 429 | # - record the change with the content from tree | 431 | # - record the change with the content from tree |
207 | 430 | kind = change[6][1] | 432 | kind = change.kind[1] |
208 | 431 | file_id = change[0] | 433 | file_id = change.file_id |
209 | 432 | entry = _entry_factory[kind](file_id, change[5][1], | 434 | entry = _entry_factory[kind](file_id, change.name[1], |
210 | 433 | change[4][1]) | 435 | change.parent_id[1]) |
211 | 434 | head_set = self._heads(change[0], set(head_candidates)) | 436 | head_set = self._heads(change.file_id, set(head_candidates)) |
212 | 435 | heads = [] | 437 | heads = [] |
213 | 436 | # Preserve ordering. | 438 | # Preserve ordering. |
214 | 437 | for head_candidate in head_candidates: | 439 | for head_candidate in head_candidates: |
215 | @@ -478,7 +480,7 @@ | |||
216 | 478 | # other process reverts it while commit is running (with | 480 | # other process reverts it while commit is running (with |
217 | 479 | # the revert happening after iter_changes did its | 481 | # the revert happening after iter_changes did its |
218 | 480 | # examination). | 482 | # examination). |
220 | 481 | if change[7][1]: | 483 | if change.executable[1]: |
221 | 482 | entry.executable = True | 484 | entry.executable = True |
222 | 483 | else: | 485 | else: |
223 | 484 | entry.executable = False | 486 | entry.executable = False |
224 | @@ -489,11 +491,11 @@ | |||
225 | 489 | nostore_sha = parent_entry.text_sha1 | 491 | nostore_sha = parent_entry.text_sha1 |
226 | 490 | else: | 492 | else: |
227 | 491 | nostore_sha = None | 493 | nostore_sha = None |
229 | 492 | file_obj, stat_value = tree.get_file_with_stat(change[1][1]) | 494 | file_obj, stat_value = tree.get_file_with_stat(change.path[1]) |
230 | 493 | try: | 495 | try: |
231 | 494 | entry.text_sha1, entry.text_size = self._add_file_to_weave( | 496 | entry.text_sha1, entry.text_size = self._add_file_to_weave( |
232 | 495 | file_id, file_obj, heads, nostore_sha) | 497 | file_id, file_obj, heads, nostore_sha) |
234 | 496 | yield change[1][1], (entry.text_sha1, stat_value) | 498 | yield change.path[1], (entry.text_sha1, stat_value) |
235 | 497 | except errors.ExistingContent: | 499 | except errors.ExistingContent: |
236 | 498 | # No content change against a carry_over parent | 500 | # No content change against a carry_over parent |
237 | 499 | # Perhaps this should also yield a fs hash update? | 501 | # Perhaps this should also yield a fs hash update? |
238 | @@ -505,23 +507,23 @@ | |||
239 | 505 | elif kind == 'symlink': | 507 | elif kind == 'symlink': |
240 | 506 | # Wants a path hint? | 508 | # Wants a path hint? |
241 | 507 | entry.symlink_target = tree.get_symlink_target( | 509 | entry.symlink_target = tree.get_symlink_target( |
243 | 508 | change[1][1]) | 510 | change.path[1]) |
244 | 509 | if (carry_over_possible and | 511 | if (carry_over_possible and |
245 | 510 | parent_entry.symlink_target == | 512 | parent_entry.symlink_target == |
246 | 511 | entry.symlink_target): | 513 | entry.symlink_target): |
247 | 512 | carried_over = True | 514 | carried_over = True |
248 | 513 | else: | 515 | else: |
249 | 514 | self._add_file_to_weave( | 516 | self._add_file_to_weave( |
251 | 515 | change[0], BytesIO(), heads, None) | 517 | change.file_id, BytesIO(), heads, None) |
252 | 516 | elif kind == 'directory': | 518 | elif kind == 'directory': |
253 | 517 | if carry_over_possible: | 519 | if carry_over_possible: |
254 | 518 | carried_over = True | 520 | carried_over = True |
255 | 519 | else: | 521 | else: |
256 | 520 | # Nothing to set on the entry. | 522 | # Nothing to set on the entry. |
257 | 521 | # XXX: split into the Root and nonRoot versions. | 523 | # XXX: split into the Root and nonRoot versions. |
259 | 522 | if change[1][1] != '' or self.repository.supports_rich_root(): | 524 | if change.path[1] != '' or self.repository.supports_rich_root(): |
260 | 523 | self._add_file_to_weave( | 525 | self._add_file_to_weave( |
262 | 524 | change[0], BytesIO(), heads, None) | 526 | change.file_id, BytesIO(), heads, None) |
263 | 525 | elif kind == 'tree-reference': | 527 | elif kind == 'tree-reference': |
264 | 526 | if not self.repository._format.supports_tree_reference: | 528 | if not self.repository._format.supports_tree_reference: |
265 | 527 | # This isn't quite sane as an error, but we shouldn't | 529 | # This isn't quite sane as an error, but we shouldn't |
266 | @@ -531,7 +533,7 @@ | |||
267 | 531 | raise errors.UnsupportedOperation( | 533 | raise errors.UnsupportedOperation( |
268 | 532 | tree.add_reference, self.repository) | 534 | tree.add_reference, self.repository) |
269 | 533 | reference_revision = tree.get_reference_revision( | 535 | reference_revision = tree.get_reference_revision( |
271 | 534 | change[1][1]) | 536 | change.path[1]) |
272 | 535 | entry.reference_revision = reference_revision | 537 | entry.reference_revision = reference_revision |
273 | 536 | if (carry_over_possible | 538 | if (carry_over_possible |
274 | 537 | and parent_entry.reference_revision == | 539 | and parent_entry.reference_revision == |
275 | @@ -539,7 +541,7 @@ | |||
276 | 539 | carried_over = True | 541 | carried_over = True |
277 | 540 | else: | 542 | else: |
278 | 541 | self._add_file_to_weave( | 543 | self._add_file_to_weave( |
280 | 542 | change[0], BytesIO(), heads, None) | 544 | change.file_id, BytesIO(), heads, None) |
281 | 543 | else: | 545 | else: |
282 | 544 | raise AssertionError('unknown kind %r' % kind) | 546 | raise AssertionError('unknown kind %r' % kind) |
283 | 545 | if not carried_over: | 547 | if not carried_over: |
284 | @@ -548,8 +550,8 @@ | |||
285 | 548 | entry.revision = parent_entry.revision | 550 | entry.revision = parent_entry.revision |
286 | 549 | else: | 551 | else: |
287 | 550 | entry = None | 552 | entry = None |
290 | 551 | new_path = change[1][1] | 553 | new_path = change.path[1] |
291 | 552 | inv_delta.append((change[1][0], new_path, change[0], entry)) | 554 | inv_delta.append((change.path[0], new_path, change.file_id, entry)) |
292 | 553 | if new_path == '': | 555 | if new_path == '': |
293 | 554 | seen_root = True | 556 | seen_root = True |
294 | 555 | # The initial commit adds a root directory, but this in itself is not | 557 | # The initial commit adds a root directory, but this in itself is not |
295 | 556 | 558 | ||
296 | === modified file 'breezy/bzr/workingtree.py' | |||
297 | --- breezy/bzr/workingtree.py 2019-06-04 00:08:59 +0000 | |||
298 | +++ breezy/bzr/workingtree.py 2019-06-15 17:35:57 +0000 | |||
299 | @@ -426,19 +426,18 @@ | |||
300 | 426 | 426 | ||
301 | 427 | # Bail out if we are going to delete files we shouldn't | 427 | # Bail out if we are going to delete files we shouldn't |
302 | 428 | if not keep_files and not force: | 428 | if not keep_files and not force: |
309 | 429 | for (file_id, path, content_change, versioned, parent_id, name, | 429 | for change in self.iter_changes( |
310 | 430 | kind, executable) in self.iter_changes( | 430 | self.basis_tree(), include_unchanged=True, |
311 | 431 | self.basis_tree(), include_unchanged=True, | 431 | require_versioned=False, want_unversioned=True, |
312 | 432 | require_versioned=False, want_unversioned=True, | 432 | specific_files=files): |
313 | 433 | specific_files=files): | 433 | if change.versioned[0] is False: |
308 | 434 | if versioned[0] is False: | ||
314 | 435 | # The record is unknown or newly added | 434 | # The record is unknown or newly added |
318 | 436 | files_to_backup.append(path[1]) | 435 | files_to_backup.append(change.path[1]) |
319 | 437 | elif (content_change and (kind[1] is not None) | 436 | elif (change.changed_content and (change.kind[1] is not None) |
320 | 438 | and osutils.is_inside_any(files, path[1])): | 437 | and osutils.is_inside_any(files, change.path[1])): |
321 | 439 | # Versioned and changed, but not deleted, and still | 438 | # Versioned and changed, but not deleted, and still |
322 | 440 | # in one of the dirs to be deleted. | 439 | # in one of the dirs to be deleted. |
324 | 441 | files_to_backup.append(path[1]) | 440 | files_to_backup.append(change.path[1]) |
325 | 442 | 441 | ||
326 | 443 | def backup(file_to_backup): | 442 | def backup(file_to_backup): |
327 | 444 | backup_name = self.controldir._available_backup_name( | 443 | backup_name = self.controldir._available_backup_name( |
328 | 445 | 444 | ||
329 | === modified file 'breezy/commit.py' | |||
330 | --- breezy/commit.py 2019-03-04 01:44:35 +0000 | |||
331 | +++ breezy/commit.py 2019-06-15 17:35:57 +0000 | |||
332 | @@ -69,6 +69,7 @@ | |||
333 | 69 | minimum_path_selection, | 69 | minimum_path_selection, |
334 | 70 | ) | 70 | ) |
335 | 71 | from .trace import mutter, note, is_quiet | 71 | from .trace import mutter, note, is_quiet |
336 | 72 | from .tree import TreeChange | ||
337 | 72 | from .urlutils import unescape_for_display | 73 | from .urlutils import unescape_for_display |
338 | 73 | from .i18n import gettext | 74 | from .i18n import gettext |
339 | 74 | 75 | ||
340 | @@ -96,14 +97,11 @@ | |||
341 | 96 | :return: iter_changes function | 97 | :return: iter_changes function |
342 | 97 | """ | 98 | """ |
343 | 98 | for change in iter_changes: | 99 | for change in iter_changes: |
352 | 99 | old_path = change[1][0] | 100 | new_excluded = (change.path[1] is not None and |
353 | 100 | new_path = change[1][1] | 101 | is_inside_any(exclude, change.path[1])) |
354 | 101 | 102 | ||
355 | 102 | new_excluded = (new_path is not None and | 103 | old_excluded = (change.path[0] is not None and |
356 | 103 | is_inside_any(exclude, new_path)) | 104 | is_inside_any(exclude, change.path[0])) |
349 | 104 | |||
350 | 105 | old_excluded = (old_path is not None and | ||
351 | 106 | is_inside_any(exclude, old_path)) | ||
357 | 107 | 105 | ||
358 | 108 | if old_excluded and new_excluded: | 106 | if old_excluded and new_excluded: |
359 | 109 | continue | 107 | continue |
360 | @@ -701,29 +699,28 @@ | |||
361 | 701 | deleted_paths = [] | 699 | deleted_paths = [] |
362 | 702 | for change in iter_changes: | 700 | for change in iter_changes: |
363 | 703 | if report_changes: | 701 | if report_changes: |
369 | 704 | old_path = change[1][0] | 702 | old_path = change.path[0] |
370 | 705 | new_path = change[1][1] | 703 | new_path = change.path[1] |
371 | 706 | versioned = change[3][1] | 704 | versioned = change.versioned[1] |
372 | 707 | kind = change[6][1] | 705 | kind = change.kind[1] |
373 | 708 | versioned = change[3][1] | 706 | versioned = change.versioned[1] |
374 | 709 | if kind is None and versioned: | 707 | if kind is None and versioned: |
375 | 710 | # 'missing' path | 708 | # 'missing' path |
376 | 711 | if report_changes: | 709 | if report_changes: |
377 | 712 | reporter.missing(new_path) | 710 | reporter.missing(new_path) |
379 | 713 | if change[6][0] == 'symlink' and not self.work_tree.supports_symlinks(): | 711 | if change.kind[0] == 'symlink' and not self.work_tree.supports_symlinks(): |
380 | 714 | trace.warning('Ignoring "%s" as symlinks are not ' | 712 | trace.warning('Ignoring "%s" as symlinks are not ' |
382 | 715 | 'supported on this filesystem.' % (change[1][0],)) | 713 | 'supported on this filesystem.' % (change.path[0],)) |
383 | 716 | continue | 714 | continue |
384 | 717 | deleted_paths.append(change[1][1]) | 715 | deleted_paths.append(change[1][1]) |
385 | 718 | # Reset the new path (None) and new versioned flag (False) | 716 | # Reset the new path (None) and new versioned flag (False) |
389 | 719 | change = (change[0], (change[1][0], None), change[2], | 717 | change = change.discard_new() |
390 | 720 | (change[3][0], False)) + change[4:] | 718 | new_path = change.path[1] |
388 | 721 | new_path = change[1][1] | ||
391 | 722 | versioned = False | 719 | versioned = False |
392 | 723 | elif kind == 'tree-reference': | 720 | elif kind == 'tree-reference': |
393 | 724 | if self.recursive == 'down': | 721 | if self.recursive == 'down': |
394 | 725 | self._commit_nested_tree(change[1][1]) | 722 | self._commit_nested_tree(change[1][1]) |
396 | 726 | if change[3][0] or change[3][1]: | 723 | if change.versioned[0] or change.versioned[1]: |
397 | 727 | yield change | 724 | yield change |
398 | 728 | if report_changes: | 725 | if report_changes: |
399 | 729 | if new_path is None: | 726 | if new_path is None: |
400 | 730 | 727 | ||
401 | === modified file 'breezy/delta.py' | |||
402 | --- breezy/delta.py 2019-06-03 21:25:01 +0000 | |||
403 | +++ breezy/delta.py 2019-06-15 17:35:57 +0000 | |||
404 | @@ -125,48 +125,48 @@ | |||
405 | 125 | delta = TreeDelta() | 125 | delta = TreeDelta() |
406 | 126 | # mutter('start compare_trees') | 126 | # mutter('start compare_trees') |
407 | 127 | 127 | ||
420 | 128 | for (file_id, path, content_change, versioned, parent_id, name, kind, | 128 | for change in new_tree.iter_changes( |
421 | 129 | executable) in new_tree.iter_changes(old_tree, want_unchanged, | 129 | old_tree, want_unchanged, specific_files, extra_trees=extra_trees, |
422 | 130 | specific_files, extra_trees=extra_trees, | 130 | require_versioned=require_versioned, |
423 | 131 | require_versioned=require_versioned, | 131 | want_unversioned=want_unversioned): |
424 | 132 | want_unversioned=want_unversioned): | 132 | if change.versioned == (False, False): |
425 | 133 | if versioned == (False, False): | 133 | delta.unversioned.append((change.path[1], None, change.kind[1])) |
426 | 134 | delta.unversioned.append((path[1], None, kind[1])) | 134 | continue |
427 | 135 | continue | 135 | if not include_root and (None, None) == change.parent_id: |
428 | 136 | if not include_root and (None, None) == parent_id: | 136 | continue |
429 | 137 | continue | 137 | fully_present = tuple( |
430 | 138 | fully_present = tuple((versioned[x] and kind[x] is not None) for | 138 | (change.versioned[x] and change.kind[x] is not None) |
431 | 139 | x in range(2)) | 139 | for x in range(2)) |
432 | 140 | if fully_present[0] != fully_present[1]: | 140 | if fully_present[0] != fully_present[1]: |
433 | 141 | if fully_present[1] is True: | 141 | if fully_present[1] is True: |
435 | 142 | delta.added.append((path[1], file_id, kind[1])) | 142 | delta.added.append((change.path[1], change.file_id, change.kind[1])) |
436 | 143 | else: | 143 | else: |
438 | 144 | if kind[0] == 'symlink' and not new_tree.supports_symlinks(): | 144 | if change.kind[0] == 'symlink' and not new_tree.supports_symlinks(): |
439 | 145 | trace.warning( | 145 | trace.warning( |
440 | 146 | 'Ignoring "%s" as symlinks ' | 146 | 'Ignoring "%s" as symlinks ' |
442 | 147 | 'are not supported on this filesystem.' % (path[0],)) | 147 | 'are not supported on this filesystem.' % (change.path[0],)) |
443 | 148 | else: | 148 | else: |
445 | 149 | delta.removed.append((path[0], file_id, kind[0])) | 149 | delta.removed.append( |
446 | 150 | (change.path[0], change.file_id, change.kind[0])) | ||
447 | 150 | elif fully_present[0] is False: | 151 | elif fully_present[0] is False: |
450 | 151 | delta.missing.append((path[1], file_id, kind[1])) | 152 | delta.missing.append((change.path[1], change.file_id, change.kind[1])) |
451 | 152 | elif name[0] != name[1] or parent_id[0] != parent_id[1]: | 153 | elif change.name[0] != change.name[1] or change.parent_id[0] != change.parent_id[1]: |
452 | 153 | # If the name changes, or the parent_id changes, we have a rename | 154 | # If the name changes, or the parent_id changes, we have a rename |
453 | 154 | # (if we move a parent, that doesn't count as a rename for the | 155 | # (if we move a parent, that doesn't count as a rename for the |
454 | 155 | # file) | 156 | # file) |
467 | 156 | delta.renamed.append((path[0], | 157 | delta.renamed.append( |
468 | 157 | path[1], | 158 | (change.path[0], change.path[1], change.file_id, |
469 | 158 | file_id, | 159 | change.kind[1], change.changed_content, |
470 | 159 | kind[1], | 160 | (change.executable[0] != change.executable[1]))) |
471 | 160 | content_change, | 161 | elif change.kind[0] != change.kind[1]: |
472 | 161 | (executable[0] != executable[1]))) | 162 | delta.kind_changed.append( |
473 | 162 | elif kind[0] != kind[1]: | 163 | (change.path[1], change.file_id, change.kind[0], change.kind[1])) |
474 | 163 | delta.kind_changed.append((path[1], file_id, kind[0], kind[1])) | 164 | elif change.changed_content or change.executable[0] != change.executable[1]: |
475 | 164 | elif content_change or executable[0] != executable[1]: | 165 | delta.modified.append((change.path[1], change.file_id, change.kind[1], |
476 | 165 | delta.modified.append((path[1], file_id, kind[1], | 166 | change.changed_content, |
477 | 166 | content_change, | 167 | (change.executable[0] != change.executable[1]))) |
466 | 167 | (executable[0] != executable[1]))) | ||
478 | 168 | else: | 168 | else: |
480 | 169 | delta.unchanged.append((path[1], file_id, kind[1])) | 169 | delta.unchanged.append((change.path[1], change.file_id, change.kind[1])) |
481 | 170 | 170 | ||
482 | 171 | delta.removed.sort() | 171 | delta.removed.sort() |
483 | 172 | delta.added.sort() | 172 | delta.added.sort() |
484 | 173 | 173 | ||
485 | === modified file 'breezy/diff.py' | |||
486 | --- breezy/diff.py 2019-06-15 14:43:05 +0000 | |||
487 | +++ breezy/diff.py 2019-06-15 17:35:57 +0000 | |||
488 | @@ -1060,23 +1060,24 @@ | |||
489 | 1060 | def get_encoded_path(path): | 1060 | def get_encoded_path(path): |
490 | 1061 | if path is not None: | 1061 | if path is not None: |
491 | 1062 | return path.encode(self.path_encoding, "replace") | 1062 | return path.encode(self.path_encoding, "replace") |
494 | 1063 | for (file_id, paths, changed_content, versioned, parent, name, kind, | 1063 | for change in sorted(iterator, key=changes_key): |
493 | 1064 | executable) in sorted(iterator, key=changes_key): | ||
495 | 1065 | # The root does not get diffed, and items with no known kind (that | 1064 | # The root does not get diffed, and items with no known kind (that |
496 | 1066 | # is, missing) in both trees are skipped as well. | 1065 | # is, missing) in both trees are skipped as well. |
498 | 1067 | if parent == (None, None) or kind == (None, None): | 1066 | if change.parent_id == (None, None) or change.kind == (None, None): |
499 | 1068 | continue | 1067 | continue |
501 | 1069 | if kind[0] == 'symlink' and not self.new_tree.supports_symlinks(): | 1068 | if change.kind[0] == 'symlink' and not self.new_tree.supports_symlinks(): |
502 | 1070 | warning( | 1069 | warning( |
503 | 1071 | 'Ignoring "%s" as symlinks are not ' | 1070 | 'Ignoring "%s" as symlinks are not ' |
505 | 1072 | 'supported on this filesystem.' % (paths[0],)) | 1071 | 'supported on this filesystem.' % (change.path[0],)) |
506 | 1073 | continue | 1072 | continue |
513 | 1074 | oldpath, newpath = paths | 1073 | oldpath, newpath = change.path |
514 | 1075 | oldpath_encoded = get_encoded_path(paths[0]) | 1074 | oldpath_encoded = get_encoded_path(change.path[0]) |
515 | 1076 | newpath_encoded = get_encoded_path(paths[1]) | 1075 | newpath_encoded = get_encoded_path(change.path[1]) |
516 | 1077 | old_present = (kind[0] is not None and versioned[0]) | 1076 | old_present = (change.kind[0] is not None and change.versioned[0]) |
517 | 1078 | new_present = (kind[1] is not None and versioned[1]) | 1077 | new_present = (change.kind[1] is not None and change.versioned[1]) |
518 | 1079 | renamed = (parent[0], name[0]) != (parent[1], name[1]) | 1078 | executable = change.executable |
519 | 1079 | kind = change.kind | ||
520 | 1080 | renamed = (change.parent_id[0], change.name[0]) != (change.parent_id[1], change.name[1]) | ||
521 | 1080 | 1081 | ||
522 | 1081 | properties_changed = [] | 1082 | properties_changed = [] |
523 | 1082 | properties_changed.extend( | 1083 | properties_changed.extend( |
524 | @@ -1104,7 +1105,7 @@ | |||
525 | 1104 | # modified *somehow*, either content or execute bit. | 1105 | # modified *somehow*, either content or execute bit. |
526 | 1105 | self.to_file.write(b"=== modified %s '%s'%s\n" % (kind[0].encode('ascii'), | 1106 | self.to_file.write(b"=== modified %s '%s'%s\n" % (kind[0].encode('ascii'), |
527 | 1106 | newpath_encoded, prop_str)) | 1107 | newpath_encoded, prop_str)) |
529 | 1107 | if changed_content: | 1108 | if change.changed_content: |
530 | 1108 | self._diff(oldpath, newpath, kind[0], kind[1]) | 1109 | self._diff(oldpath, newpath, kind[0], kind[1]) |
531 | 1109 | has_changes = 1 | 1110 | has_changes = 1 |
532 | 1110 | if renamed: | 1111 | if renamed: |
533 | 1111 | 1112 | ||
534 | === modified file 'breezy/git/commit.py' | |||
535 | --- breezy/git/commit.py 2019-06-15 13:38:17 +0000 | |||
536 | +++ breezy/git/commit.py 2019-06-15 17:35:57 +0000 | |||
537 | @@ -88,32 +88,32 @@ | |||
538 | 88 | 88 | ||
539 | 89 | def record_iter_changes(self, workingtree, basis_revid, iter_changes): | 89 | def record_iter_changes(self, workingtree, basis_revid, iter_changes): |
540 | 90 | seen_root = False | 90 | seen_root = False |
544 | 91 | for (file_id, path, changed_content, versioned, parent, name, kind, | 91 | for change in iter_changes: |
545 | 92 | executable) in iter_changes: | 92 | if change.kind[1] in ("directory",): |
543 | 93 | if kind[1] in ("directory",): | ||
546 | 94 | self._inv_delta.append( | 93 | self._inv_delta.append( |
551 | 95 | (path[0], path[1], file_id, entry_factory[kind[1]]( | 94 | (change.path[0], change.path[1], change.file_id, |
552 | 96 | file_id, name[1], parent[1]))) | 95 | entry_factory[change.kind[1]]( |
553 | 97 | if kind[0] in ("file", "symlink"): | 96 | change.file_id, change.name[1], change.parent_id[1]))) |
554 | 98 | self._blobs[path[0].encode("utf-8")] = None | 97 | if change.kind[0] in ("file", "symlink"): |
555 | 98 | self._blobs[change.path[0].encode("utf-8")] = None | ||
556 | 99 | self._any_changes = True | 99 | self._any_changes = True |
558 | 100 | if path[1] == "": | 100 | if change.path[1] == "": |
559 | 101 | seen_root = True | 101 | seen_root = True |
560 | 102 | continue | 102 | continue |
561 | 103 | self._any_changes = True | 103 | self._any_changes = True |
565 | 104 | if path[1] is None: | 104 | if change.path[1] is None: |
566 | 105 | self._inv_delta.append((path[0], path[1], file_id, None)) | 105 | self._inv_delta.append((change.path[0], change.path[1], change.file_id, None)) |
567 | 106 | self._blobs[path[0].encode("utf-8")] = None | 106 | self._blobs[change.path[0].encode("utf-8")] = None |
568 | 107 | continue | 107 | continue |
569 | 108 | try: | 108 | try: |
571 | 109 | entry_kls = entry_factory[kind[1]] | 109 | entry_kls = entry_factory[change.kind[1]] |
572 | 110 | except KeyError: | 110 | except KeyError: |
577 | 111 | raise KeyError("unknown kind %s" % kind[1]) | 111 | raise KeyError("unknown kind %s" % change.kind[1]) |
578 | 112 | entry = entry_kls(file_id, name[1], parent[1]) | 112 | entry = entry_kls(change.file_id, change.name[1], change.parent_id[1]) |
579 | 113 | if kind[1] == "file": | 113 | if change.kind[1] == "file": |
580 | 114 | entry.executable = executable[1] | 114 | entry.executable = change.executable[1] |
581 | 115 | blob = Blob() | 115 | blob = Blob() |
583 | 116 | f, st = workingtree.get_file_with_stat(path[1]) | 116 | f, st = workingtree.get_file_with_stat(change.path[1]) |
584 | 117 | try: | 117 | try: |
585 | 118 | blob.data = f.read() | 118 | blob.data = f.read() |
586 | 119 | finally: | 119 | finally: |
587 | @@ -122,29 +122,29 @@ | |||
588 | 122 | entry.text_sha1 = osutils.sha_string(blob.data) | 122 | entry.text_sha1 = osutils.sha_string(blob.data) |
589 | 123 | self.store.add_object(blob) | 123 | self.store.add_object(blob) |
590 | 124 | sha = blob.id | 124 | sha = blob.id |
593 | 125 | elif kind[1] == "symlink": | 125 | elif change.kind[1] == "symlink": |
594 | 126 | symlink_target = workingtree.get_symlink_target(path[1]) | 126 | symlink_target = workingtree.get_symlink_target(change.path[1]) |
595 | 127 | blob = Blob() | 127 | blob = Blob() |
596 | 128 | blob.data = symlink_target.encode("utf-8") | 128 | blob.data = symlink_target.encode("utf-8") |
597 | 129 | self.store.add_object(blob) | 129 | self.store.add_object(blob) |
598 | 130 | sha = blob.id | 130 | sha = blob.id |
599 | 131 | entry.symlink_target = symlink_target | 131 | entry.symlink_target = symlink_target |
600 | 132 | st = None | 132 | st = None |
604 | 133 | elif kind[1] == "tree-reference": | 133 | elif change.kind[1] == "tree-reference": |
605 | 134 | sha = read_submodule_head(workingtree.abspath(path[1])) | 134 | sha = read_submodule_head(workingtree.abspath(change.path[1])) |
606 | 135 | reference_revision = workingtree.get_reference_revision(path[1]) | 135 | reference_revision = workingtree.get_reference_revision(change.path[1]) |
607 | 136 | entry.reference_revision = reference_revision | 136 | entry.reference_revision = reference_revision |
608 | 137 | st = None | 137 | st = None |
609 | 138 | else: | 138 | else: |
614 | 139 | raise AssertionError("Unknown kind %r" % kind[1]) | 139 | raise AssertionError("Unknown kind %r" % change.kind[1]) |
615 | 140 | mode = object_mode(kind[1], executable[1]) | 140 | mode = object_mode(change.kind[1], change.executable[1]) |
616 | 141 | self._inv_delta.append((path[0], path[1], file_id, entry)) | 141 | self._inv_delta.append((change.path[0], change.path[1], change.file_id, entry)) |
617 | 142 | encoded_new_path = path[1].encode("utf-8") | 142 | encoded_new_path = change.path[1].encode("utf-8") |
618 | 143 | self._blobs[encoded_new_path] = (mode, sha) | 143 | self._blobs[encoded_new_path] = (mode, sha) |
619 | 144 | if st is not None: | 144 | if st is not None: |
623 | 145 | yield path[1], (entry.text_sha1, st) | 145 | yield change.path[1], (entry.text_sha1, st) |
624 | 146 | if self._mapping.generate_file_id(encoded_new_path) != file_id: | 146 | if self._mapping.generate_file_id(encoded_new_path) != change.file_id: |
625 | 147 | self._override_fileids[encoded_new_path] = file_id | 147 | self._override_fileids[encoded_new_path] = change.file_id |
626 | 148 | else: | 148 | else: |
627 | 149 | self._override_fileids[encoded_new_path] = None | 149 | self._override_fileids[encoded_new_path] = None |
628 | 150 | if not seen_root and len(self.parents) == 0: | 150 | if not seen_root and len(self.parents) == 0: |
629 | 151 | 151 | ||
630 | === modified file 'breezy/git/object_store.py' | |||
631 | --- breezy/git/object_store.py 2019-06-06 22:22:47 +0000 | |||
632 | +++ breezy/git/object_store.py 2019-06-15 17:35:57 +0000 | |||
633 | @@ -249,16 +249,15 @@ | |||
634 | 249 | raise KeyError | 249 | raise KeyError |
635 | 250 | 250 | ||
636 | 251 | # Find all the changed blobs | 251 | # Find all the changed blobs |
640 | 252 | for (file_id, path, changed_content, versioned, parent, name, kind, | 252 | for change in tree.iter_changes(base_tree): |
641 | 253 | executable) in tree.iter_changes(base_tree): | 253 | if change.name[1] in BANNED_FILENAMES: |
639 | 254 | if name[1] in BANNED_FILENAMES: | ||
642 | 255 | continue | 254 | continue |
645 | 256 | if kind[1] == "file": | 255 | if change.kind[1] == "file": |
646 | 257 | sha1 = tree.get_file_sha1(path[1]) | 256 | sha1 = tree.get_file_sha1(change.path[1]) |
647 | 258 | blob_id = None | 257 | blob_id = None |
648 | 259 | try: | 258 | try: |
649 | 260 | (pfile_id, prevision) = find_unchanged_parent_ie( | 259 | (pfile_id, prevision) = find_unchanged_parent_ie( |
651 | 261 | file_id, kind[1], sha1, other_parent_trees) | 260 | change.file_id, change.kind[1], sha1, other_parent_trees) |
652 | 262 | except KeyError: | 261 | except KeyError: |
653 | 263 | pass | 262 | pass |
654 | 264 | else: | 263 | else: |
655 | @@ -271,35 +270,35 @@ | |||
656 | 271 | if not changed_content: | 270 | if not changed_content: |
657 | 272 | # no-change merge ? | 271 | # no-change merge ? |
658 | 273 | blob = Blob() | 272 | blob = Blob() |
660 | 274 | blob.data = tree.get_file_text(path[1]) | 273 | blob.data = tree.get_file_text(change.path[1]) |
661 | 275 | blob_id = blob.id | 274 | blob_id = blob.id |
662 | 276 | if blob_id is None: | 275 | if blob_id is None: |
664 | 277 | new_blobs.append((path[1], file_id)) | 276 | new_blobs.append((change.path[1], change.file_id)) |
665 | 278 | else: | 277 | else: |
666 | 279 | shamap[path[1]] = blob_id | 278 | shamap[path[1]] = blob_id |
667 | 280 | if add_cache_entry is not None: | 279 | if add_cache_entry is not None: |
668 | 281 | add_cache_entry( | 280 | add_cache_entry( |
669 | 282 | ("blob", blob_id), | 281 | ("blob", blob_id), |
673 | 283 | (file_id, tree.get_file_revision(path[1])), path[1]) | 282 | (file_id, tree.get_file_revision(change.path[1])), change.path[1]) |
674 | 284 | elif kind[1] == "symlink": | 283 | elif change.kind[1] == "symlink": |
675 | 285 | target = tree.get_symlink_target(path[1]) | 284 | target = tree.get_symlink_target(change.path[1]) |
676 | 286 | blob = symlink_to_blob(target) | 285 | blob = symlink_to_blob(target) |
678 | 287 | shamap[path[1]] = blob.id | 286 | shamap[change.path[1]] = blob.id |
679 | 288 | if add_cache_entry is not None: | 287 | if add_cache_entry is not None: |
680 | 289 | add_cache_entry( | 288 | add_cache_entry( |
682 | 290 | blob, (file_id, tree.get_file_revision(path[1])), path[1]) | 289 | blob, (change.file_id, tree.get_file_revision(change.path[1])), change.path[1]) |
683 | 291 | try: | 290 | try: |
684 | 292 | find_unchanged_parent_ie( | 291 | find_unchanged_parent_ie( |
686 | 293 | file_id, kind[1], target, other_parent_trees) | 292 | change.file_id, change.kind[1], target, other_parent_trees) |
687 | 294 | except KeyError: | 293 | except KeyError: |
696 | 295 | if changed_content: | 294 | if change.changed_content: |
697 | 296 | yield (path[1], blob, | 295 | yield (change.path[1], blob, |
698 | 297 | (file_id, tree.get_file_revision(path[1]))) | 296 | (change.file_id, tree.get_file_revision(change.path[1]))) |
699 | 298 | elif kind[1] is None: | 297 | elif change.kind[1] is None: |
700 | 299 | shamap[path[1]] = None | 298 | shamap[change.path[1]] = None |
701 | 300 | elif kind[1] != 'directory': | 299 | elif change.kind[1] != 'directory': |
702 | 301 | raise AssertionError(kind[1]) | 300 | raise AssertionError(change.kind[1]) |
703 | 302 | for p in path: | 301 | for p in change.path: |
704 | 303 | if p is None: | 302 | if p is None: |
705 | 304 | continue | 303 | continue |
706 | 305 | dirty_dirs.add(osutils.dirname(p)) | 304 | dirty_dirs.add(osutils.dirname(p)) |
707 | 306 | 305 | ||
708 | === modified file 'breezy/git/workingtree.py' | |||
709 | --- breezy/git/workingtree.py 2019-06-04 00:08:59 +0000 | |||
710 | +++ breezy/git/workingtree.py 2019-06-15 17:35:57 +0000 | |||
711 | @@ -350,23 +350,22 @@ | |||
712 | 350 | 350 | ||
713 | 351 | # Bail out if we are going to delete files we shouldn't | 351 | # Bail out if we are going to delete files we shouldn't |
714 | 352 | if not keep_files and not force: | 352 | if not keep_files and not force: |
721 | 353 | for (file_id, path, content_change, versioned, parent_id, name, | 353 | for change in self.iter_changes( |
722 | 354 | kind, executable) in self.iter_changes( | 354 | self.basis_tree(), include_unchanged=True, |
723 | 355 | self.basis_tree(), include_unchanged=True, | 355 | require_versioned=False, want_unversioned=True, |
724 | 356 | require_versioned=False, want_unversioned=True, | 356 | specific_files=files): |
725 | 357 | specific_files=files): | 357 | if change.versioned[0] is False: |
720 | 358 | if versioned[0] is False: | ||
726 | 359 | # The record is unknown or newly added | 358 | # The record is unknown or newly added |
728 | 360 | files_to_backup.append(path[1]) | 359 | files_to_backup.append(change.path[1]) |
729 | 361 | files_to_backup.extend( | 360 | files_to_backup.extend( |
733 | 362 | osutils.parent_directories(path[1])) | 361 | osutils.parent_directories(change.path[1])) |
734 | 363 | elif (content_change and (kind[1] is not None) | 362 | elif (change.changed_content and (change.kind[1] is not None) |
735 | 364 | and osutils.is_inside_any(files, path[1])): | 363 | and osutils.is_inside_any(files, change.path[1])): |
736 | 365 | # Versioned and changed, but not deleted, and still | 364 | # Versioned and changed, but not deleted, and still |
737 | 366 | # in one of the dirs to be deleted. | 365 | # in one of the dirs to be deleted. |
739 | 367 | files_to_backup.append(path[1]) | 366 | files_to_backup.append(change.path[1]) |
740 | 368 | files_to_backup.extend( | 367 | files_to_backup.extend( |
742 | 369 | osutils.parent_directories(path[1])) | 368 | osutils.parent_directories(change.path[1])) |
743 | 370 | 369 | ||
744 | 371 | for f in files: | 370 | for f in files: |
745 | 372 | if f == '': | 371 | if f == '': |
746 | 373 | 372 | ||
747 | === modified file 'breezy/merge.py' | |||
748 | --- breezy/merge.py 2019-06-03 05:21:20 +0000 | |||
749 | +++ breezy/merge.py 2019-06-15 17:35:57 +0000 | |||
750 | @@ -852,14 +852,13 @@ | |||
751 | 852 | self.interesting_files, trees=[self.other_tree]) | 852 | self.interesting_files, trees=[self.other_tree]) |
752 | 853 | this_entries = dict(self.this_tree.iter_entries_by_dir( | 853 | this_entries = dict(self.this_tree.iter_entries_by_dir( |
753 | 854 | specific_files=this_interesting_files)) | 854 | specific_files=this_interesting_files)) |
757 | 855 | for (file_id, paths, changed, versioned, parents, names, kind, | 855 | for change in iterator: |
758 | 856 | executable) in iterator: | 856 | if change.path[0] is not None: |
756 | 857 | if paths[0] is not None: | ||
759 | 858 | this_path = _mod_tree.find_previous_path( | 857 | this_path = _mod_tree.find_previous_path( |
761 | 859 | self.base_tree, self.this_tree, paths[0]) | 858 | self.base_tree, self.this_tree, change.path[0]) |
762 | 860 | else: | 859 | else: |
763 | 861 | this_path = _mod_tree.find_previous_path( | 860 | this_path = _mod_tree.find_previous_path( |
765 | 862 | self.other_tree, self.this_tree, paths[1]) | 861 | self.other_tree, self.this_tree, change.path[1]) |
766 | 863 | this_entry = this_entries.get(this_path) | 862 | this_entry = this_entries.get(this_path) |
767 | 864 | if this_entry is not None: | 863 | if this_entry is not None: |
768 | 865 | this_name = this_entry.name | 864 | this_name = this_entry.name |
769 | @@ -869,12 +868,13 @@ | |||
770 | 869 | this_name = None | 868 | this_name = None |
771 | 870 | this_parent = None | 869 | this_parent = None |
772 | 871 | this_executable = None | 870 | this_executable = None |
779 | 872 | parents3 = parents + (this_parent,) | 871 | parents3 = change.parent_id + (this_parent,) |
780 | 873 | names3 = names + (this_name,) | 872 | names3 = change.name + (this_name,) |
781 | 874 | paths3 = paths + (this_path, ) | 873 | paths3 = change.path + (this_path, ) |
782 | 875 | executable3 = executable + (this_executable,) | 874 | executable3 = change.executable + (this_executable,) |
783 | 876 | result.append((file_id, changed, paths3, | 875 | result.append( |
784 | 877 | parents3, names3, executable3)) | 876 | (change.file_id, change.changed_content, paths3, |
785 | 877 | parents3, names3, executable3)) | ||
786 | 878 | return result | 878 | return result |
787 | 879 | 879 | ||
788 | 880 | def _entries_lca(self): | 880 | def _entries_lca(self): |
789 | 881 | 881 | ||
790 | === modified file 'breezy/mutabletree.py' | |||
791 | --- breezy/mutabletree.py 2019-06-03 23:45:30 +0000 | |||
792 | +++ breezy/mutabletree.py 2019-06-15 17:35:57 +0000 | |||
793 | @@ -202,7 +202,7 @@ | |||
794 | 202 | try: | 202 | try: |
795 | 203 | change = next(changes) | 203 | change = next(changes) |
796 | 204 | # Exclude root (talk about black magic... --vila 20090629) | 204 | # Exclude root (talk about black magic... --vila 20090629) |
798 | 205 | if change[4] == (None, None): | 205 | if change.parent_id == (None, None): |
799 | 206 | change = next(changes) | 206 | change = next(changes) |
800 | 207 | return True | 207 | return True |
801 | 208 | except StopIteration: | 208 | except StopIteration: |
802 | 209 | 209 | ||
803 | === modified file 'breezy/plugins/fastimport/revision_store.py' | |||
804 | --- breezy/plugins/fastimport/revision_store.py 2018-11-25 20:44:56 +0000 | |||
805 | +++ breezy/plugins/fastimport/revision_store.py 2019-06-15 17:35:57 +0000 | |||
806 | @@ -25,6 +25,7 @@ | |||
807 | 25 | osutils, | 25 | osutils, |
808 | 26 | revision as _mod_revision, | 26 | revision as _mod_revision, |
809 | 27 | ) | 27 | ) |
810 | 28 | from ...tree import TreeChange | ||
811 | 28 | from ...bzr import ( | 29 | from ...bzr import ( |
812 | 29 | inventory, | 30 | inventory, |
813 | 30 | ) | 31 | ) |
814 | @@ -118,49 +119,53 @@ | |||
815 | 118 | old_ie = None | 119 | old_ie = None |
816 | 119 | if ie is None: | 120 | if ie is None: |
817 | 120 | raise AssertionError('How is both old and new None?') | 121 | raise AssertionError('How is both old and new None?') |
836 | 121 | change = (file_id, | 122 | change = TreeChange( |
837 | 122 | (old_path, new_path), | 123 | file_id, |
838 | 123 | False, | 124 | (old_path, new_path), |
839 | 124 | (False, False), | 125 | False, |
840 | 125 | (None, None), | 126 | (False, False), |
841 | 126 | (None, None), | 127 | (None, None), |
842 | 127 | (None, None), | 128 | (None, None), |
843 | 128 | (None, None), | 129 | (None, None), |
844 | 129 | ) | 130 | (None, None), |
845 | 130 | change = (file_id, | 131 | ) |
846 | 131 | (old_path, new_path), | 132 | change = TreeChange( |
847 | 132 | True, | 133 | file_id, |
848 | 133 | (False, True), | 134 | (old_path, new_path), |
849 | 134 | (None, ie.parent_id), | 135 | True, |
850 | 135 | (None, ie.name), | 136 | (False, True), |
851 | 136 | (None, ie.kind), | 137 | (None, ie.parent_id), |
852 | 137 | (None, ie.executable), | 138 | (None, ie.name), |
853 | 138 | ) | 139 | (None, ie.kind), |
854 | 140 | (None, ie.executable), | ||
855 | 141 | ) | ||
856 | 139 | else: | 142 | else: |
857 | 140 | if ie is None: | 143 | if ie is None: |
867 | 141 | change = (file_id, | 144 | change = TreeChange( |
868 | 142 | (old_path, new_path), | 145 | file_id, |
869 | 143 | True, | 146 | (old_path, new_path), |
870 | 144 | (True, False), | 147 | True, |
871 | 145 | (old_ie.parent_id, None), | 148 | (True, False), |
872 | 146 | (old_ie.name, None), | 149 | (old_ie.parent_id, None), |
873 | 147 | (old_ie.kind, None), | 150 | (old_ie.name, None), |
874 | 148 | (old_ie.executable, None), | 151 | (old_ie.kind, None), |
875 | 149 | ) | 152 | (old_ie.executable, None), |
876 | 153 | ) | ||
877 | 150 | else: | 154 | else: |
878 | 151 | content_modified = (ie.text_sha1 != old_ie.text_sha1 or | 155 | content_modified = (ie.text_sha1 != old_ie.text_sha1 or |
879 | 152 | ie.text_size != old_ie.text_size) | 156 | ie.text_size != old_ie.text_size) |
880 | 153 | # TODO: ie.kind != old_ie.kind | 157 | # TODO: ie.kind != old_ie.kind |
881 | 154 | # TODO: symlinks changing targets, content_modified? | 158 | # TODO: symlinks changing targets, content_modified? |
891 | 155 | change = (file_id, | 159 | change = TreeChange( |
892 | 156 | (old_path, new_path), | 160 | file_id, |
893 | 157 | content_modified, | 161 | (old_path, new_path), |
894 | 158 | (True, True), | 162 | content_modified, |
895 | 159 | (old_ie.parent_id, ie.parent_id), | 163 | (True, True), |
896 | 160 | (old_ie.name, ie.name), | 164 | (old_ie.parent_id, ie.parent_id), |
897 | 161 | (old_ie.kind, ie.kind), | 165 | (old_ie.name, ie.name), |
898 | 162 | (old_ie.executable, ie.executable), | 166 | (old_ie.kind, ie.kind), |
899 | 163 | ) | 167 | (old_ie.executable, ie.executable), |
900 | 168 | ) | ||
901 | 164 | yield change | 169 | yield change |
902 | 165 | 170 | ||
903 | 166 | 171 | ||
904 | 167 | 172 | ||
905 | === modified file 'breezy/plugins/launchpad/lp_propose.py' | |||
906 | --- breezy/plugins/launchpad/lp_propose.py 2019-01-28 21:00:58 +0000 | |||
907 | +++ breezy/plugins/launchpad/lp_propose.py 2019-06-15 17:35:57 +0000 | |||
908 | @@ -224,7 +224,6 @@ | |||
909 | 224 | 224 | ||
910 | 225 | def modified_files(old_tree, new_tree): | 225 | def modified_files(old_tree, new_tree): |
911 | 226 | """Return a list of paths in the new tree with modified contents.""" | 226 | """Return a list of paths in the new tree with modified contents.""" |
915 | 227 | for f, (op, path), c, v, p, n, (ok, k), e in new_tree.iter_changes( | 227 | for change in new_tree.iter_changes(old_tree): |
916 | 228 | old_tree): | 228 | if change.changed_content and change.kind[1] == 'file': |
914 | 229 | if c and k == 'file': | ||
917 | 230 | yield str(path) | 229 | yield str(path) |
918 | 231 | 230 | ||
919 | === modified file 'breezy/plugins/propose/launchpad.py' | |||
920 | --- breezy/plugins/propose/launchpad.py 2019-06-15 14:25:08 +0000 | |||
921 | +++ breezy/plugins/propose/launchpad.py 2019-06-15 17:35:57 +0000 | |||
922 | @@ -687,7 +687,6 @@ | |||
923 | 687 | 687 | ||
924 | 688 | def modified_files(old_tree, new_tree): | 688 | def modified_files(old_tree, new_tree): |
925 | 689 | """Return a list of paths in the new tree with modified contents.""" | 689 | """Return a list of paths in the new tree with modified contents.""" |
929 | 690 | for f, (op, path), c, v, p, n, (ok, k), e in new_tree.iter_changes( | 690 | for change in new_tree.iter_changes(old_tree): |
930 | 691 | old_tree): | 691 | if change.changed_content and change.kind[1] == 'file': |
928 | 692 | if c and k == 'file': | ||
931 | 693 | yield str(path) | 692 | yield str(path) |
932 | 694 | 693 | ||
933 | === modified file 'breezy/rename_map.py' | |||
934 | --- breezy/rename_map.py 2018-11-11 04:08:32 +0000 | |||
935 | +++ breezy/rename_map.py 2019-06-15 17:35:57 +0000 | |||
936 | @@ -177,24 +177,24 @@ | |||
937 | 177 | with ui_factory.nested_progress_bar() as task: | 177 | with ui_factory.nested_progress_bar() as task: |
938 | 178 | iterator = self.tree.iter_changes(basis, want_unversioned=True, | 178 | iterator = self.tree.iter_changes(basis, want_unversioned=True, |
939 | 179 | pb=task) | 179 | pb=task) |
944 | 180 | for (file_id, paths, changed_content, versioned, parent, name, | 180 | for change in iterator: |
945 | 181 | kind, executable) in iterator: | 181 | if change.kind[1] is None and change.versioned[1]: |
946 | 182 | if kind[1] is None and versioned[1]: | 182 | if not self.tree.has_filename( |
947 | 183 | if not self.tree.has_filename(self.tree.id2path(parent[0])): | 183 | self.tree.id2path(change.parent_id[0])): |
948 | 184 | missing_parents.setdefault( | 184 | missing_parents.setdefault( |
952 | 185 | parent[0], set()).add(file_id) | 185 | change.parent_id[0], set()).add(change.file_id) |
953 | 186 | if kind[0] == 'file': | 186 | if change.kind[0] == 'file': |
954 | 187 | missing_files.add(file_id) | 187 | missing_files.add(change.file_id) |
955 | 188 | else: | 188 | else: |
956 | 189 | # other kinds are not handled | 189 | # other kinds are not handled |
957 | 190 | pass | 190 | pass |
960 | 191 | if versioned == (False, False): | 191 | if change.versioned == (False, False): |
961 | 192 | if self.tree.is_ignored(paths[1]): | 192 | if self.tree.is_ignored(change.path[1]): |
962 | 193 | continue | 193 | continue |
967 | 194 | if kind[1] == 'file': | 194 | if change.kind[1] == 'file': |
968 | 195 | candidate_files.add(paths[1]) | 195 | candidate_files.add(change.path[1]) |
969 | 196 | if kind[1] == 'directory': | 196 | if change.kind[1] == 'directory': |
970 | 197 | for _dir, children in self.tree.walkdirs(paths[1]): | 197 | for _dir, children in self.tree.walkdirs(change.path[1]): |
971 | 198 | for child in children: | 198 | for child in children: |
972 | 199 | if child[2] == 'file': | 199 | if child[2] == 'file': |
973 | 200 | candidate_files.add(child[0]) | 200 | candidate_files.add(child[0]) |
974 | 201 | 201 | ||
975 | === modified file 'breezy/shelf.py' | |||
976 | --- breezy/shelf.py 2018-11-17 16:53:10 +0000 | |||
977 | +++ breezy/shelf.py 2019-06-15 17:35:57 +0000 | |||
978 | @@ -98,39 +98,38 @@ | |||
979 | 98 | ('modify text', file_id) | 98 | ('modify text', file_id) |
980 | 99 | ('modify target', file_id, target_target, work_target) | 99 | ('modify target', file_id, target_target, work_target) |
981 | 100 | """ | 100 | """ |
984 | 101 | for (file_id, paths, changed, versioned, parents, names, kind, | 101 | for change in self.iter_changes: |
983 | 102 | executable) in self.iter_changes: | ||
985 | 103 | # don't shelve add of tree root. Working tree should never | 102 | # don't shelve add of tree root. Working tree should never |
986 | 104 | # lack roots, and bzr misbehaves when they do. | 103 | # lack roots, and bzr misbehaves when they do. |
987 | 105 | # FIXME ADHB (2009-08-09): should still shelve adds of tree roots | 104 | # FIXME ADHB (2009-08-09): should still shelve adds of tree roots |
988 | 106 | # when a tree root was deleted / renamed. | 105 | # when a tree root was deleted / renamed. |
990 | 107 | if kind[0] is None and names[1] == '': | 106 | if change.kind[0] is None and change.name[1] == '': |
991 | 108 | continue | 107 | continue |
992 | 109 | # Also don't shelve deletion of tree root. | 108 | # Also don't shelve deletion of tree root. |
994 | 110 | if kind[1] is None and names[0] == '': | 109 | if change.kind[1] is None and change.name[0] == '': |
995 | 111 | continue | 110 | continue |
1004 | 112 | if kind[0] is None or versioned[0] is False: | 111 | if change.kind[0] is None or change.versioned[0] is False: |
1005 | 113 | self.creation[file_id] = (kind[1], names[1], parents[1], | 112 | self.creation[change.file_id] = ( |
1006 | 114 | versioned) | 113 | change.kind[1], change.name[1], change.parent_id[1], change.versioned) |
1007 | 115 | yield ('add file', file_id, kind[1], paths[1]) | 114 | yield ('add file', change.file_id, change.kind[1], change.path[1]) |
1008 | 116 | elif kind[1] is None or versioned[0] is False: | 115 | elif change.kind[1] is None or change.versioned[0] is False: |
1009 | 117 | self.deletion[file_id] = (kind[0], names[0], parents[0], | 116 | self.deletion[change.file_id] = ( |
1010 | 118 | versioned) | 117 | change.kind[0], change.name[0], change.parent_id[0], change.versioned) |
1011 | 119 | yield ('delete file', file_id, kind[0], paths[0]) | 118 | yield ('delete file', change.file_id, change.kind[0], change.path[0]) |
1012 | 120 | else: | 119 | else: |
1016 | 121 | if names[0] != names[1] or parents[0] != parents[1]: | 120 | if change.name[0] != change.name[1] or change.parent_id[0] != change.parent_id[1]: |
1017 | 122 | self.renames[file_id] = (names, parents) | 121 | self.renames[change.file_id] = (change.name, change.parent_id) |
1018 | 123 | yield ('rename', file_id) + paths | 122 | yield ('rename', change.file_id) + change.path |
1019 | 124 | 123 | ||
1026 | 125 | if kind[0] != kind[1]: | 124 | if change.kind[0] != change.kind[1]: |
1027 | 126 | yield ('change kind', file_id, kind[0], kind[1], paths[0]) | 125 | yield ('change kind', change.file_id, change.kind[0], change.kind[1], change.path[0]) |
1028 | 127 | elif kind[0] == 'symlink': | 126 | elif change.kind[0] == 'symlink': |
1029 | 128 | t_target = self.target_tree.get_symlink_target(paths[0]) | 127 | t_target = self.target_tree.get_symlink_target(change.path[0]) |
1030 | 129 | w_target = self.work_tree.get_symlink_target(paths[1]) | 128 | w_target = self.work_tree.get_symlink_target(change.path[1]) |
1031 | 130 | yield ('modify target', file_id, paths[0], t_target, | 129 | yield ('modify target', change.file_id, change.path[0], t_target, |
1032 | 131 | w_target) | 130 | w_target) |
1035 | 132 | elif changed: | 131 | elif change.changed_content: |
1036 | 133 | yield ('modify text', file_id) | 132 | yield ('modify text', change.file_id) |
1037 | 134 | 133 | ||
1038 | 135 | def shelve_change(self, change): | 134 | def shelve_change(self, change): |
1039 | 136 | """Shelve a change in the iter_shelvable format.""" | 135 | """Shelve a change in the iter_shelvable format.""" |
1040 | 137 | 136 | ||
1041 | === modified file 'breezy/tests/per_intertree/test_compare.py' | |||
1042 | --- breezy/tests/per_intertree/test_compare.py 2018-12-18 20:55:37 +0000 | |||
1043 | +++ breezy/tests/per_intertree/test_compare.py 2019-06-15 17:35:57 +0000 | |||
1044 | @@ -26,6 +26,7 @@ | |||
1045 | 26 | transform, | 26 | transform, |
1046 | 27 | ) | 27 | ) |
1047 | 28 | from breezy.osutils import has_symlinks | 28 | from breezy.osutils import has_symlinks |
1048 | 29 | from breezy.tree import TreeChange | ||
1049 | 29 | from breezy.tests.per_intertree import TestCaseWithTwoTrees | 30 | from breezy.tests.per_intertree import TestCaseWithTwoTrees |
1050 | 30 | from breezy.tests import ( | 31 | from breezy.tests import ( |
1051 | 31 | features, | 32 | features, |
1052 | @@ -50,10 +51,9 @@ | |||
1053 | 50 | 51 | ||
1054 | 51 | def _change_key(change): | 52 | def _change_key(change): |
1055 | 52 | """Return a valid key for sorting Tree.iter_changes entries.""" | 53 | """Return a valid key for sorting Tree.iter_changes entries.""" |
1060 | 53 | (file_id, paths, content_changed, versioned, parent, name, kind, | 54 | return (change.file_id or b'', (change.path[0] or '', change.path[1] or ''), |
1061 | 54 | executable) = change | 55 | change.versioned, change.parent_id, change.name, change.kind, |
1062 | 55 | return (file_id or b'', (paths[0] or '', paths[1] or ''), versioned, | 56 | change.executable) |
1059 | 56 | parent, name, kind, executable) | ||
1063 | 57 | 57 | ||
1064 | 58 | 58 | ||
1065 | 59 | class TestCompare(TestCaseWithTwoTrees): | 59 | class TestCompare(TestCaseWithTwoTrees): |
1066 | @@ -553,9 +553,10 @@ | |||
1067 | 553 | 553 | ||
1068 | 554 | def added(self, tree, file_id): | 554 | def added(self, tree, file_id): |
1069 | 555 | path, entry = self.get_path_entry(tree, file_id) | 555 | path, entry = self.get_path_entry(tree, file_id) |
1073 | 556 | return (file_id, (None, path), True, (False, True), (None, entry.parent_id), | 556 | return TreeChange( |
1074 | 557 | (None, entry.name), (None, entry.kind), | 557 | file_id, (None, path), True, (False, True), (None, entry.parent_id), |
1075 | 558 | (None, entry.executable)) | 558 | (None, entry.name), (None, entry.kind), |
1076 | 559 | (None, entry.executable)) | ||
1077 | 559 | 560 | ||
1078 | 560 | @staticmethod | 561 | @staticmethod |
1079 | 561 | def get_path_entry(tree, file_id): | 562 | def get_path_entry(tree, file_id): |
1080 | @@ -569,43 +570,48 @@ | |||
1081 | 569 | 570 | ||
1082 | 570 | def content_changed(self, tree, file_id): | 571 | def content_changed(self, tree, file_id): |
1083 | 571 | path, entry = self.get_path_entry(tree, file_id) | 572 | path, entry = self.get_path_entry(tree, file_id) |
1088 | 572 | return (file_id, (path, path), True, (True, True), | 573 | return TreeChange( |
1089 | 573 | (entry.parent_id, entry.parent_id), | 574 | file_id, (path, path), True, (True, True), |
1090 | 574 | (entry.name, entry.name), (entry.kind, entry.kind), | 575 | (entry.parent_id, entry.parent_id), |
1091 | 575 | (entry.executable, entry.executable)) | 576 | (entry.name, entry.name), (entry.kind, entry.kind), |
1092 | 577 | (entry.executable, entry.executable)) | ||
1093 | 576 | 578 | ||
1094 | 577 | def kind_changed(self, from_tree, to_tree, file_id): | 579 | def kind_changed(self, from_tree, to_tree, file_id): |
1095 | 578 | from_path, old_entry = self.get_path_entry(from_tree, file_id) | 580 | from_path, old_entry = self.get_path_entry(from_tree, file_id) |
1096 | 579 | path, new_entry = self.get_path_entry(to_tree, file_id) | 581 | path, new_entry = self.get_path_entry(to_tree, file_id) |
1102 | 580 | return (file_id, (from_path, path), True, (True, True), | 582 | return TreeChange( |
1103 | 581 | (old_entry.parent_id, new_entry.parent_id), | 583 | file_id, (from_path, path), True, (True, True), |
1104 | 582 | (old_entry.name, new_entry.name), | 584 | (old_entry.parent_id, new_entry.parent_id), |
1105 | 583 | (old_entry.kind, new_entry.kind), | 585 | (old_entry.name, new_entry.name), |
1106 | 584 | (old_entry.executable, new_entry.executable)) | 586 | (old_entry.kind, new_entry.kind), |
1107 | 587 | (old_entry.executable, new_entry.executable)) | ||
1108 | 585 | 588 | ||
1109 | 586 | def missing(self, file_id, from_path, to_path, parent_id, kind): | 589 | def missing(self, file_id, from_path, to_path, parent_id, kind): |
1110 | 587 | _, from_basename = os.path.split(from_path) | 590 | _, from_basename = os.path.split(from_path) |
1111 | 588 | _, to_basename = os.path.split(to_path) | 591 | _, to_basename = os.path.split(to_path) |
1112 | 589 | # missing files have both paths, but no kind. | 592 | # missing files have both paths, but no kind. |
1116 | 590 | return (file_id, (from_path, to_path), True, (True, True), | 593 | return TreeChange( |
1117 | 591 | (parent_id, parent_id), | 594 | file_id, (from_path, to_path), True, (True, True), |
1118 | 592 | (from_basename, to_basename), (kind, None), (False, False)) | 595 | (parent_id, parent_id), |
1119 | 596 | (from_basename, to_basename), (kind, None), (False, False)) | ||
1120 | 593 | 597 | ||
1121 | 594 | def deleted(self, tree, file_id): | 598 | def deleted(self, tree, file_id): |
1122 | 595 | entry = tree.root_inventory.get_entry(file_id) | 599 | entry = tree.root_inventory.get_entry(file_id) |
1123 | 596 | path = tree.id2path(file_id) | 600 | path = tree.id2path(file_id) |
1127 | 597 | return (file_id, (path, None), True, (True, False), (entry.parent_id, None), | 601 | return TreeChange( |
1128 | 598 | (entry.name, None), (entry.kind, None), | 602 | file_id, (path, None), True, (True, False), (entry.parent_id, None), |
1129 | 599 | (entry.executable, None)) | 603 | (entry.name, None), (entry.kind, None), |
1130 | 604 | (entry.executable, None)) | ||
1131 | 600 | 605 | ||
1132 | 601 | def renamed(self, from_tree, to_tree, file_id, content_changed): | 606 | def renamed(self, from_tree, to_tree, file_id, content_changed): |
1133 | 602 | from_path, from_entry = self.get_path_entry(from_tree, file_id) | 607 | from_path, from_entry = self.get_path_entry(from_tree, file_id) |
1134 | 603 | to_path, to_entry = self.get_path_entry(to_tree, file_id) | 608 | to_path, to_entry = self.get_path_entry(to_tree, file_id) |
1140 | 604 | return (file_id, (from_path, to_path), content_changed, (True, True), | 609 | return TreeChange( |
1141 | 605 | (from_entry.parent_id, to_entry.parent_id), | 610 | file_id, (from_path, to_path), content_changed, (True, True), |
1142 | 606 | (from_entry.name, to_entry.name), | 611 | (from_entry.parent_id, to_entry.parent_id), |
1143 | 607 | (from_entry.kind, to_entry.kind), | 612 | (from_entry.name, to_entry.name), |
1144 | 608 | (from_entry.executable, to_entry.executable)) | 613 | (from_entry.kind, to_entry.kind), |
1145 | 614 | (from_entry.executable, to_entry.executable)) | ||
1146 | 609 | 615 | ||
1147 | 610 | def unchanged(self, tree, file_id): | 616 | def unchanged(self, tree, file_id): |
1148 | 611 | path, entry = self.get_path_entry(tree, file_id) | 617 | path, entry = self.get_path_entry(tree, file_id) |
1149 | @@ -613,17 +619,19 @@ | |||
1150 | 613 | name = entry.name | 619 | name = entry.name |
1151 | 614 | kind = entry.kind | 620 | kind = entry.kind |
1152 | 615 | executable = entry.executable | 621 | executable = entry.executable |
1156 | 616 | return (file_id, (path, path), False, (True, True), | 622 | return TreeChange( |
1157 | 617 | (parent, parent), (name, name), (kind, kind), | 623 | file_id, (path, path), False, (True, True), |
1158 | 618 | (executable, executable)) | 624 | (parent, parent), (name, name), (kind, kind), |
1159 | 625 | (executable, executable)) | ||
1160 | 619 | 626 | ||
1161 | 620 | def unversioned(self, tree, path): | 627 | def unversioned(self, tree, path): |
1162 | 621 | """Create an unversioned result.""" | 628 | """Create an unversioned result.""" |
1163 | 622 | _, basename = os.path.split(path) | 629 | _, basename = os.path.split(path) |
1164 | 623 | kind = tree._comparison_data(None, path)[0] | 630 | kind = tree._comparison_data(None, path)[0] |
1168 | 624 | return (None, (None, path), True, (False, False), (None, None), | 631 | return TreeChange( |
1169 | 625 | (None, basename), (None, kind), | 632 | None, (None, path), True, (False, False), (None, None), |
1170 | 626 | (None, False)) | 633 | (None, basename), (None, kind), |
1171 | 634 | (None, False)) | ||
1172 | 627 | 635 | ||
1173 | 628 | def sorted(self, changes): | 636 | def sorted(self, changes): |
1174 | 629 | return sorted(changes, key=_change_key) | 637 | return sorted(changes, key=_change_key) |
1175 | @@ -1086,8 +1094,9 @@ | |||
1176 | 1086 | tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) | 1094 | tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
1177 | 1087 | self.not_applicable_if_missing_in('file', tree1) | 1095 | self.not_applicable_if_missing_in('file', tree1) |
1178 | 1088 | root_id = tree1.path2id('') | 1096 | root_id = tree1.path2id('') |
1181 | 1089 | expected = [(b'file-id', ('file', None), False, (True, False), | 1097 | expected = [ |
1182 | 1090 | (root_id, None), ('file', None), (None, None), (False, None))] | 1098 | TreeChange(b'file-id', ('file', None), False, (True, False), |
1183 | 1099 | (root_id, None), ('file', None), (None, None), (False, None))] | ||
1184 | 1091 | self.assertEqual(expected, self.do_iter_changes(tree1, tree2)) | 1100 | self.assertEqual(expected, self.do_iter_changes(tree1, tree2)) |
1185 | 1092 | 1101 | ||
1186 | 1093 | def test_only_in_target_and_missing(self): | 1102 | def test_only_in_target_and_missing(self): |
1187 | @@ -1100,8 +1109,9 @@ | |||
1188 | 1100 | tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) | 1109 | tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
1189 | 1101 | self.not_applicable_if_missing_in('file', tree2) | 1110 | self.not_applicable_if_missing_in('file', tree2) |
1190 | 1102 | root_id = tree1.path2id('') | 1111 | root_id = tree1.path2id('') |
1193 | 1103 | expected = [(b'file-id', (None, 'file'), False, (False, True), | 1112 | expected = [ |
1194 | 1104 | (None, root_id), (None, 'file'), (None, None), (None, False))] | 1113 | TreeChange(b'file-id', (None, 'file'), False, (False, True), |
1195 | 1114 | (None, root_id), (None, 'file'), (None, None), (None, False))] | ||
1196 | 1105 | self.assertEqual(expected, self.do_iter_changes(tree1, tree2)) | 1115 | self.assertEqual(expected, self.do_iter_changes(tree1, tree2)) |
1197 | 1106 | 1116 | ||
1198 | 1107 | def test_only_in_target_missing_subtree_specific_bug_367632(self): | 1117 | def test_only_in_target_missing_subtree_specific_bug_367632(self): |
1199 | @@ -1116,10 +1126,12 @@ | |||
1200 | 1116 | self.not_applicable_if_missing_in('a-dir', tree2) | 1126 | self.not_applicable_if_missing_in('a-dir', tree2) |
1201 | 1117 | root_id = tree1.path2id('') | 1127 | root_id = tree1.path2id('') |
1202 | 1118 | expected = [ | 1128 | expected = [ |
1207 | 1119 | (b'dir-id', (None, 'a-dir'), False, (False, True), | 1129 | TreeChange( |
1208 | 1120 | (None, root_id), (None, 'a-dir'), (None, None), (None, False)), | 1130 | b'dir-id', (None, 'a-dir'), False, (False, True), |
1209 | 1121 | (b'file-id', (None, 'a-dir/a-file'), False, (False, True), | 1131 | (None, root_id), (None, 'a-dir'), (None, None), (None, False)), |
1210 | 1122 | (None, b'dir-id'), (None, 'a-file'), (None, None), (None, False)) | 1132 | TreeChange( |
1211 | 1133 | b'file-id', (None, 'a-dir/a-file'), False, (False, True), | ||
1212 | 1134 | (None, b'dir-id'), (None, 'a-file'), (None, None), (None, False)) | ||
1213 | 1123 | ] | 1135 | ] |
1214 | 1124 | # bug 367632 showed that specifying the root broke some code paths, | 1136 | # bug 367632 showed that specifying the root broke some code paths, |
1215 | 1125 | # so we check this contract with and without it. | 1137 | # so we check this contract with and without it. |
1216 | @@ -1136,10 +1148,11 @@ | |||
1217 | 1136 | tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) | 1148 | tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
1218 | 1137 | self.assertEqual(sorted([self.unchanged(tree1, b'root-id'), | 1149 | self.assertEqual(sorted([self.unchanged(tree1, b'root-id'), |
1219 | 1138 | self.unchanged(tree1, b'b-id'), | 1150 | self.unchanged(tree1, b'b-id'), |
1224 | 1139 | (b'a-id', ('a', 'd'), True, (True, True), | 1151 | TreeChange( |
1225 | 1140 | (b'root-id', b'root-id'), ('a', | 1152 | b'a-id', ('a', 'd'), True, (True, True), |
1226 | 1141 | 'd'), ('file', 'file'), | 1153 | (b'root-id', b'root-id'), ('a', 'd'), |
1227 | 1142 | (False, False)), self.unchanged(tree1, b'c-id')]), | 1154 | ('file', 'file'), |
1228 | 1155 | (False, False)), self.unchanged(tree1, b'c-id')]), | ||
1229 | 1143 | self.do_iter_changes(tree1, tree2, include_unchanged=True)) | 1156 | self.do_iter_changes(tree1, tree2, include_unchanged=True)) |
1230 | 1144 | 1157 | ||
1231 | 1145 | def test_compare_subtrees(self): | 1158 | def test_compare_subtrees(self): |
1232 | @@ -1163,22 +1176,24 @@ | |||
1233 | 1163 | self.assertEqual([], list(tree2.iter_changes(tree1))) | 1176 | self.assertEqual([], list(tree2.iter_changes(tree1))) |
1234 | 1164 | subtree1.commit('commit', rev_id=b'commit-a') | 1177 | subtree1.commit('commit', rev_id=b'commit-a') |
1235 | 1165 | self.assertEqual([ | 1178 | self.assertEqual([ |
1252 | 1166 | (b'root-id', | 1179 | TreeChange( |
1253 | 1167 | (u'', u''), | 1180 | b'root-id', |
1254 | 1168 | False, | 1181 | (u'', u''), |
1255 | 1169 | (True, True), | 1182 | False, |
1256 | 1170 | (None, None), | 1183 | (True, True), |
1257 | 1171 | (u'', u''), | 1184 | (None, None), |
1258 | 1172 | ('directory', 'directory'), | 1185 | (u'', u''), |
1259 | 1173 | (False, False)), | 1186 | ('directory', 'directory'), |
1260 | 1174 | (b'subtree-id', | 1187 | (False, False)), |
1261 | 1175 | ('sub', 'sub',), | 1188 | TreeChange( |
1262 | 1176 | False, | 1189 | b'subtree-id', |
1263 | 1177 | (True, True), | 1190 | ('sub', 'sub',), |
1264 | 1178 | (b'root-id', b'root-id'), | 1191 | False, |
1265 | 1179 | ('sub', 'sub'), | 1192 | (True, True), |
1266 | 1180 | ('tree-reference', 'tree-reference'), | 1193 | (b'root-id', b'root-id'), |
1267 | 1181 | (False, False))], | 1194 | ('sub', 'sub'), |
1268 | 1195 | ('tree-reference', 'tree-reference'), | ||
1269 | 1196 | (False, False))], | ||
1270 | 1182 | list(tree2.iter_changes(tree1, | 1197 | list(tree2.iter_changes(tree1, |
1271 | 1183 | include_unchanged=True))) | 1198 | include_unchanged=True))) |
1272 | 1184 | 1199 | ||
1273 | 1185 | 1200 | ||
1274 | === modified file 'breezy/tests/per_repository/test_check.py' | |||
1275 | --- breezy/tests/per_repository/test_check.py 2018-11-11 04:08:32 +0000 | |||
1276 | +++ breezy/tests/per_repository/test_check.py 2019-06-15 17:35:57 +0000 | |||
1277 | @@ -20,6 +20,7 @@ | |||
1278 | 20 | from breezy import ( | 20 | from breezy import ( |
1279 | 21 | revision as _mod_revision, | 21 | revision as _mod_revision, |
1280 | 22 | ) | 22 | ) |
1281 | 23 | from breezy.tree import TreeChange | ||
1282 | 23 | from breezy.tests.per_repository import TestCaseWithRepository | 24 | from breezy.tests.per_repository import TestCaseWithRepository |
1283 | 24 | 25 | ||
1284 | 25 | 26 | ||
1285 | @@ -32,8 +33,9 @@ | |||
1286 | 32 | self.overrideEnv('BRZ_EMAIL', 'foo@sample.com') | 33 | self.overrideEnv('BRZ_EMAIL', 'foo@sample.com') |
1287 | 33 | builder = branch.get_commit_builder([], branch.get_config_stack()) | 34 | builder = branch.get_commit_builder([], branch.get_config_stack()) |
1288 | 34 | list(builder.record_iter_changes(None, _mod_revision.NULL_REVISION, [ | 35 | list(builder.record_iter_changes(None, _mod_revision.NULL_REVISION, [ |
1291 | 35 | (b'TREE_ROOT', (None, ''), True, (False, True), (None, None), | 36 | TreeChange( |
1292 | 36 | (None, ''), (None, 'directory'), (None, False))])) | 37 | b'TREE_ROOT', (None, ''), True, (False, True), (None, None), |
1293 | 38 | (None, ''), (None, 'directory'), (None, False))])) | ||
1294 | 37 | builder.finish_inventory() | 39 | builder.finish_inventory() |
1295 | 38 | rev_id = builder.commit('first post') | 40 | rev_id = builder.commit('first post') |
1296 | 39 | result = branch.repository.check(None, check_repo=True) | 41 | result = branch.repository.check(None, check_repo=True) |
1297 | 40 | 42 | ||
1298 | === modified file 'breezy/tests/per_repository/test_commit_builder.py' | |||
1299 | --- breezy/tests/per_repository/test_commit_builder.py 2018-11-25 20:44:56 +0000 | |||
1300 | +++ breezy/tests/per_repository/test_commit_builder.py 2019-06-15 17:35:57 +0000 | |||
1301 | @@ -26,6 +26,7 @@ | |||
1302 | 26 | revision as _mod_revision, | 26 | revision as _mod_revision, |
1303 | 27 | tests, | 27 | tests, |
1304 | 28 | ) | 28 | ) |
1305 | 29 | from breezy.tree import TreeChange | ||
1306 | 29 | from breezy.bzr import ( | 30 | from breezy.bzr import ( |
1307 | 30 | inventorytree, | 31 | inventorytree, |
1308 | 31 | ) | 32 | ) |
1309 | @@ -193,10 +194,11 @@ | |||
1310 | 193 | with tree.lock_write(): | 194 | with tree.lock_write(): |
1311 | 194 | builder = tree.branch.get_commit_builder([rev_id]) | 195 | builder = tree.branch.get_commit_builder([rev_id]) |
1312 | 195 | try: | 196 | try: |
1317 | 196 | delete_change = (foo_id, ('foo', None), True, (True, False), | 197 | delete_change = TreeChange( |
1318 | 197 | (tree.path2id(''), None), ('foo', | 198 | foo_id, ('foo', None), True, (True, False), |
1319 | 198 | None), ('file', None), | 199 | (tree.path2id(''), None), |
1320 | 199 | (False, None)) | 200 | ('foo', None), ('file', None), |
1321 | 201 | (False, None)) | ||
1322 | 200 | list(builder.record_iter_changes(tree, rev_id, | 202 | list(builder.record_iter_changes(tree, rev_id, |
1323 | 201 | [delete_change])) | 203 | [delete_change])) |
1324 | 202 | self.assertEqual(("foo", None, foo_id, None), | 204 | self.assertEqual(("foo", None, foo_id, None), |
1325 | 203 | 205 | ||
1326 | === modified file 'breezy/tests/test__dirstate_helpers.py' | |||
1327 | --- breezy/tests/test__dirstate_helpers.py 2019-06-03 21:25:01 +0000 | |||
1328 | +++ breezy/tests/test__dirstate_helpers.py 2019-06-15 17:35:57 +0000 | |||
1329 | @@ -1260,7 +1260,7 @@ | |||
1330 | 1260 | state._sha1_provider = UppercaseSHA1Provider() | 1260 | state._sha1_provider = UppercaseSHA1Provider() |
1331 | 1261 | # If we used the standard provider, it would look like nothing has | 1261 | # If we used the standard provider, it would look like nothing has |
1332 | 1262 | # changed | 1262 | # changed |
1334 | 1263 | file_ids_changed = [change[0] for change | 1263 | file_ids_changed = [change.file_id for change |
1335 | 1264 | in tree.iter_changes(tree.basis_tree())] | 1264 | in tree.iter_changes(tree.basis_tree())] |
1336 | 1265 | self.assertEqual([b'a-file-id'], file_ids_changed) | 1265 | self.assertEqual([b'a-file-id'], file_ids_changed) |
1337 | 1266 | 1266 | ||
1338 | @@ -1291,12 +1291,9 @@ | |||
1339 | 1291 | self.overrideAttr(dirstate, '_process_entry', self._process_entry) | 1291 | self.overrideAttr(dirstate, '_process_entry', self._process_entry) |
1340 | 1292 | 1292 | ||
1341 | 1293 | def assertChangedFileIds(self, expected, tree): | 1293 | def assertChangedFileIds(self, expected, tree): |
1345 | 1294 | tree.lock_read() | 1294 | with tree.lock_read(): |
1346 | 1295 | try: | 1295 | file_ids = [info.file_id for info |
1344 | 1296 | file_ids = [info[0] for info | ||
1347 | 1297 | in tree.iter_changes(tree.basis_tree())] | 1296 | in tree.iter_changes(tree.basis_tree())] |
1348 | 1298 | finally: | ||
1349 | 1299 | tree.unlock() | ||
1350 | 1300 | self.assertEqual(sorted(expected), sorted(file_ids)) | 1297 | self.assertEqual(sorted(expected), sorted(file_ids)) |
1351 | 1301 | 1298 | ||
1352 | 1302 | def test_exceptions_raised(self): | 1299 | def test_exceptions_raised(self): |
1353 | 1303 | 1300 | ||
1354 | === modified file 'breezy/tests/test_commit.py' | |||
1355 | --- breezy/tests/test_commit.py 2019-06-03 23:24:45 +0000 | |||
1356 | +++ breezy/tests/test_commit.py 2019-06-15 17:35:57 +0000 | |||
1357 | @@ -38,6 +38,7 @@ | |||
1358 | 38 | BzrError, | 38 | BzrError, |
1359 | 39 | LockContention, | 39 | LockContention, |
1360 | 40 | ) | 40 | ) |
1361 | 41 | from ..tree import TreeChange | ||
1362 | 41 | from . import ( | 42 | from . import ( |
1363 | 42 | TestCase, | 43 | TestCase, |
1364 | 43 | TestCaseWithTransport, | 44 | TestCaseWithTransport, |
1365 | @@ -894,30 +895,34 @@ | |||
1366 | 894 | 895 | ||
1367 | 895 | def test_add_file_not_excluded(self): | 896 | def test_add_file_not_excluded(self): |
1368 | 896 | changes = [ | 897 | changes = [ |
1372 | 897 | ('fid', (None, 'newpath'), | 898 | TreeChange( |
1373 | 898 | 0, (False, False), ('pid', 'pid'), ('newpath', 'newpath'), | 899 | 'fid', (None, 'newpath'), |
1374 | 899 | ('file', 'file'), (True, True))] | 900 | 0, (False, False), ('pid', 'pid'), ('newpath', 'newpath'), |
1375 | 901 | ('file', 'file'), (True, True))] | ||
1376 | 900 | self.assertEqual(changes, list( | 902 | self.assertEqual(changes, list( |
1377 | 901 | filter_excluded(changes, ['otherpath']))) | 903 | filter_excluded(changes, ['otherpath']))) |
1378 | 902 | 904 | ||
1379 | 903 | def test_add_file_excluded(self): | 905 | def test_add_file_excluded(self): |
1380 | 904 | changes = [ | 906 | changes = [ |
1384 | 905 | ('fid', (None, 'newpath'), | 907 | TreeChange( |
1385 | 906 | 0, (False, False), ('pid', 'pid'), ('newpath', 'newpath'), | 908 | 'fid', (None, 'newpath'), |
1386 | 907 | ('file', 'file'), (True, True))] | 909 | 0, (False, False), ('pid', 'pid'), ('newpath', 'newpath'), |
1387 | 910 | ('file', 'file'), (True, True))] | ||
1388 | 908 | self.assertEqual([], list(filter_excluded(changes, ['newpath']))) | 911 | self.assertEqual([], list(filter_excluded(changes, ['newpath']))) |
1389 | 909 | 912 | ||
1390 | 910 | def test_delete_file_excluded(self): | 913 | def test_delete_file_excluded(self): |
1391 | 911 | changes = [ | 914 | changes = [ |
1395 | 912 | ('fid', ('somepath', None), | 915 | TreeChange( |
1396 | 913 | 0, (False, None), ('pid', None), ('newpath', None), | 916 | 'fid', ('somepath', None), |
1397 | 914 | ('file', None), (True, None))] | 917 | 0, (False, None), ('pid', None), ('newpath', None), |
1398 | 918 | ('file', None), (True, None))] | ||
1399 | 915 | self.assertEqual([], list(filter_excluded(changes, ['somepath']))) | 919 | self.assertEqual([], list(filter_excluded(changes, ['somepath']))) |
1400 | 916 | 920 | ||
1401 | 917 | def test_move_from_or_to_excluded(self): | 921 | def test_move_from_or_to_excluded(self): |
1402 | 918 | changes = [ | 922 | changes = [ |
1406 | 919 | ('fid', ('oldpath', 'newpath'), | 923 | TreeChange( |
1407 | 920 | 0, (False, False), ('pid', 'pid'), ('oldpath', 'newpath'), | 924 | 'fid', ('oldpath', 'newpath'), |
1408 | 921 | ('file', 'file'), (True, True))] | 925 | 0, (False, False), ('pid', 'pid'), ('oldpath', 'newpath'), |
1409 | 926 | ('file', 'file'), (True, True))] | ||
1410 | 922 | self.assertEqual([], list(filter_excluded(changes, ['oldpath']))) | 927 | self.assertEqual([], list(filter_excluded(changes, ['oldpath']))) |
1411 | 923 | self.assertEqual([], list(filter_excluded(changes, ['newpath']))) | 928 | self.assertEqual([], list(filter_excluded(changes, ['newpath']))) |
1412 | 924 | 929 | ||
1413 | === modified file 'breezy/tests/test_transform.py' | |||
1414 | --- breezy/tests/test_transform.py 2019-06-03 23:45:30 +0000 | |||
1415 | +++ breezy/tests/test_transform.py 2019-06-15 17:35:57 +0000 | |||
1416 | @@ -2838,7 +2838,7 @@ | |||
1417 | 2838 | self.addCleanup(preview.finalize) | 2838 | self.addCleanup(preview.finalize) |
1418 | 2839 | preview.delete_versioned(preview.trans_id_tree_path('foo')) | 2839 | preview.delete_versioned(preview.trans_id_tree_path('foo')) |
1419 | 2840 | preview_tree = preview.get_preview_tree() | 2840 | preview_tree = preview.get_preview_tree() |
1421 | 2841 | out = StringIO() | 2841 | out = BytesIO() |
1422 | 2842 | log = BytesIO() | 2842 | log = BytesIO() |
1423 | 2843 | trace.push_log_file(log) | 2843 | trace.push_log_file(log) |
1424 | 2844 | os_symlink = getattr(os, 'symlink', None) | 2844 | os_symlink = getattr(os, 'symlink', None) |
1425 | @@ -2847,8 +2847,7 @@ | |||
1426 | 2847 | show_diff_trees(revision_tree, preview_tree, out) | 2847 | show_diff_trees(revision_tree, preview_tree, out) |
1427 | 2848 | lines = out.getvalue().splitlines() | 2848 | lines = out.getvalue().splitlines() |
1428 | 2849 | finally: | 2849 | finally: |
1431 | 2850 | if os_symlink: | 2850 | os.symlink = os_symlink |
1430 | 2851 | os.symlink = os_symlink | ||
1432 | 2852 | self.assertContainsRe( | 2851 | self.assertContainsRe( |
1433 | 2853 | log.getvalue(), | 2852 | log.getvalue(), |
1434 | 2854 | b'Ignoring "foo" as symlinks are not supported on this filesystem') | 2853 | b'Ignoring "foo" as symlinks are not supported on this filesystem') |
1435 | 2855 | 2854 | ||
1436 | === modified file 'breezy/transform.py' | |||
1437 | --- breezy/transform.py 2019-03-04 01:44:35 +0000 | |||
1438 | +++ breezy/transform.py 2019-06-15 17:35:57 +0000 | |||
1439 | @@ -71,6 +71,7 @@ | |||
1440 | 71 | ) | 71 | ) |
1441 | 72 | from .tree import ( | 72 | from .tree import ( |
1442 | 73 | find_previous_path, | 73 | find_previous_path, |
1443 | 74 | TreeChange, | ||
1444 | 74 | ) | 75 | ) |
1445 | 75 | 76 | ||
1446 | 76 | 77 | ||
1447 | @@ -1002,16 +1003,17 @@ | |||
1448 | 1002 | and from_parent == to_parent and from_name == to_name | 1003 | and from_parent == to_parent and from_name == to_name |
1449 | 1003 | and from_executable == to_executable): | 1004 | and from_executable == to_executable): |
1450 | 1004 | continue | 1005 | continue |
1457 | 1005 | results.append((file_id, (from_path, to_path), modified, | 1006 | results.append( |
1458 | 1006 | (from_versioned, to_versioned), | 1007 | TreeChange( |
1459 | 1007 | (from_parent, to_parent), | 1008 | file_id, (from_path, to_path), modified, |
1460 | 1008 | (from_name, to_name), | 1009 | (from_versioned, to_versioned), |
1461 | 1009 | (from_kind, to_kind), | 1010 | (from_parent, to_parent), |
1462 | 1010 | (from_executable, to_executable))) | 1011 | (from_name, to_name), |
1463 | 1012 | (from_kind, to_kind), | ||
1464 | 1013 | (from_executable, to_executable))) | ||
1465 | 1011 | 1014 | ||
1469 | 1012 | def path_key(t): | 1015 | def path_key(c): |
1470 | 1013 | paths = t[1] | 1016 | return (c.path[0] or '', c.path[1] or '') |
1468 | 1014 | return (paths[0] or '', paths[1] or '') | ||
1471 | 1015 | return iter(sorted(results, key=path_key)) | 1017 | return iter(sorted(results, key=path_key)) |
1472 | 1016 | 1018 | ||
1473 | 1017 | def get_preview_tree(self): | 1019 | def get_preview_tree(self): |
1474 | @@ -1991,7 +1993,7 @@ | |||
1475 | 1991 | self._all_children_cache = {} | 1993 | self._all_children_cache = {} |
1476 | 1992 | self._path2trans_id_cache = {} | 1994 | self._path2trans_id_cache = {} |
1477 | 1993 | self._final_name_cache = {} | 1995 | self._final_name_cache = {} |
1479 | 1994 | self._iter_changes_cache = dict((c[0], c) for c in | 1996 | self._iter_changes_cache = dict((c.file_id, c) for c in |
1480 | 1995 | self._transform.iter_changes()) | 1997 | self._transform.iter_changes()) |
1481 | 1996 | 1998 | ||
1482 | 1997 | def _content_change(self, file_id): | 1999 | def _content_change(self, file_id): |
1483 | @@ -2413,8 +2415,8 @@ | |||
1484 | 2413 | if changes is None: | 2415 | if changes is None: |
1485 | 2414 | get_old = True | 2416 | get_old = True |
1486 | 2415 | else: | 2417 | else: |
1489 | 2416 | changed_content, versioned, kind = (changes[2], changes[3], | 2418 | changed_content, versioned, kind = ( |
1490 | 2417 | changes[6]) | 2419 | changes.changed_content, changes.versioned, changes.kind) |
1491 | 2418 | if kind[1] is None: | 2420 | if kind[1] is None: |
1492 | 2419 | return None | 2421 | return None |
1493 | 2420 | get_old = (kind[0] == 'file' and versioned[0]) | 2422 | get_old = (kind[0] == 'file' and versioned[0]) |
1494 | @@ -2693,8 +2695,9 @@ | |||
1495 | 2693 | new_desired_files = desired_files | 2695 | new_desired_files = desired_files |
1496 | 2694 | else: | 2696 | else: |
1497 | 2695 | iter = accelerator_tree.iter_changes(tree, include_unchanged=True) | 2697 | iter = accelerator_tree.iter_changes(tree, include_unchanged=True) |
1500 | 2696 | unchanged = [(p[0], p[1]) for (f, p, c, v, d, n, k, e) | 2698 | unchanged = [ |
1501 | 2697 | in iter if not (c or e[0] != e[1])] | 2699 | change.path for change in iter |
1502 | 2700 | if not (change.changed_content or change.executable[0] != change.executable[1])] | ||
1503 | 2698 | if accelerator_tree.supports_content_filtering(): | 2701 | if accelerator_tree.supports_content_filtering(): |
1504 | 2699 | unchanged = [(tp, ap) for (tp, ap) in unchanged | 2702 | unchanged = [(tp, ap) for (tp, ap) in unchanged |
1505 | 2700 | if not next(accelerator_tree.iter_search_rules([ap]))] | 2703 | if not next(accelerator_tree.iter_search_rules([ap]))] |
1506 | @@ -2907,19 +2910,19 @@ | |||
1507 | 2907 | skip_root = False | 2910 | skip_root = False |
1508 | 2908 | try: | 2911 | try: |
1509 | 2909 | deferred_files = [] | 2912 | deferred_files = [] |
1518 | 2910 | for id_num, (file_id, path, changed_content, versioned, parent, name, | 2913 | for id_num, change in enumerate(change_list): |
1519 | 2911 | kind, executable) in enumerate(change_list): | 2914 | file_id = change.file_id |
1520 | 2912 | target_path, wt_path = path | 2915 | target_path, wt_path = change.path |
1521 | 2913 | target_versioned, wt_versioned = versioned | 2916 | target_versioned, wt_versioned = change.versioned |
1522 | 2914 | target_parent, wt_parent = parent | 2917 | target_parent, wt_parent = change.parent_id |
1523 | 2915 | target_name, wt_name = name | 2918 | target_name, wt_name = change.name |
1524 | 2916 | target_kind, wt_kind = kind | 2919 | target_kind, wt_kind = change.kind |
1525 | 2917 | target_executable, wt_executable = executable | 2920 | target_executable, wt_executable = change.executable |
1526 | 2918 | if skip_root and wt_parent is None: | 2921 | if skip_root and wt_parent is None: |
1527 | 2919 | continue | 2922 | continue |
1528 | 2920 | trans_id = tt.trans_id_file_id(file_id) | 2923 | trans_id = tt.trans_id_file_id(file_id) |
1529 | 2921 | mode_id = None | 2924 | mode_id = None |
1531 | 2922 | if changed_content: | 2925 | if change.changed_content: |
1532 | 2923 | keep_content = False | 2926 | keep_content = False |
1533 | 2924 | if wt_kind == 'file' and (backups or target_kind is None): | 2927 | if wt_kind == 'file' and (backups or target_kind is None): |
1534 | 2925 | wt_sha1 = working_tree.get_file_sha1(wt_path) | 2928 | wt_sha1 = working_tree.get_file_sha1(wt_path) |
1535 | @@ -3231,18 +3234,16 @@ | |||
1536 | 3231 | """ | 3234 | """ |
1537 | 3232 | tt = TreeTransform(target_tree) | 3235 | tt = TreeTransform(target_tree) |
1538 | 3233 | try: | 3236 | try: |
1549 | 3234 | for (file_id, paths, changed_content, versioned, parent, name, kind, | 3237 | for change in target_tree.iter_changes(source_tree, include_unchanged=True): |
1550 | 3235 | executable) in target_tree.iter_changes(source_tree, | 3238 | if change.changed_content: |
1551 | 3236 | include_unchanged=True): | 3239 | continue |
1552 | 3237 | if changed_content: | 3240 | if change.kind != ('file', 'file'): |
1553 | 3238 | continue | 3241 | continue |
1554 | 3239 | if kind != ('file', 'file'): | 3242 | if change.executable[0] != change.executable[1]: |
1555 | 3240 | continue | 3243 | continue |
1556 | 3241 | if executable[0] != executable[1]: | 3244 | trans_id = tt.trans_id_tree_path(change.path[1]) |
1547 | 3242 | continue | ||
1548 | 3243 | trans_id = tt.trans_id_tree_path(paths[1]) | ||
1557 | 3244 | tt.delete_contents(trans_id) | 3245 | tt.delete_contents(trans_id) |
1559 | 3245 | tt.create_hardlink(source_tree.abspath(paths[0]), trans_id) | 3246 | tt.create_hardlink(source_tree.abspath(change.path[0]), trans_id) |
1560 | 3246 | tt.apply() | 3247 | tt.apply() |
1561 | 3247 | finally: | 3248 | finally: |
1562 | 3248 | tt.finalize() | 3249 | tt.finalize() |
1563 | 3249 | 3250 | ||
1564 | === modified file 'breezy/tree.py' | |||
1565 | --- breezy/tree.py 2019-06-15 15:17:02 +0000 | |||
1566 | +++ breezy/tree.py 2019-06-15 17:35:57 +0000 | |||
1567 | @@ -153,11 +153,21 @@ | |||
1568 | 153 | return tuple(self) == other | 153 | return tuple(self) == other |
1569 | 154 | return False | 154 | return False |
1570 | 155 | 155 | ||
1571 | 156 | def __lt__(self, other): | ||
1572 | 157 | return tuple(self) < tuple(other) | ||
1573 | 158 | |||
1574 | 156 | def __getitem__(self, i): | 159 | def __getitem__(self, i): |
1575 | 157 | if isinstance(i, slice): | 160 | if isinstance(i, slice): |
1576 | 158 | return tuple(self).__getitem__(i) | 161 | return tuple(self).__getitem__(i) |
1577 | 159 | return getattr(self, self.__slots__[i]) | 162 | return getattr(self, self.__slots__[i]) |
1578 | 160 | 163 | ||
1579 | 164 | def discard_new(self): | ||
1580 | 165 | return self.__class__( | ||
1581 | 166 | self.file_id, (self.path[0], None), self.changed_content, | ||
1582 | 167 | (self.versioned[0], None), (self.parent_id[0], None), | ||
1583 | 168 | (self.name[0], None), (self.kind[0], None), | ||
1584 | 169 | (self.executable[0], None)) | ||
1585 | 170 | |||
1586 | 161 | 171 | ||
1587 | 162 | class Tree(object): | 172 | class Tree(object): |
1588 | 163 | """Abstract file tree. | 173 | """Abstract file tree. |
1589 | @@ -1094,18 +1104,18 @@ | |||
1590 | 1094 | new_parent_id = result[4][1] | 1104 | new_parent_id = result[4][1] |
1591 | 1095 | precise_file_ids.add(new_parent_id) | 1105 | precise_file_ids.add(new_parent_id) |
1592 | 1096 | if changes: | 1106 | if changes: |
1595 | 1097 | if (result[6][0] == 'directory' and | 1107 | if (result.kind[0] == 'directory' and |
1596 | 1098 | result[6][1] != 'directory'): | 1108 | result.kind[1] != 'directory'): |
1597 | 1099 | # This stopped being a directory, the old children have | 1109 | # This stopped being a directory, the old children have |
1598 | 1100 | # to be included. | 1110 | # to be included. |
1599 | 1101 | if source_entry is None: | 1111 | if source_entry is None: |
1600 | 1102 | # Reusing a discarded change. | 1112 | # Reusing a discarded change. |
1601 | 1103 | source_entry = self._get_entry( | 1113 | source_entry = self._get_entry( |
1603 | 1104 | self.source, result[1][0]) | 1114 | self.source, result.path[0]) |
1604 | 1105 | precise_file_ids.update( | 1115 | precise_file_ids.update( |
1605 | 1106 | child.file_id | 1116 | child.file_id |
1608 | 1107 | for child in self.source.iter_child_entries(result[1][0])) | 1117 | for child in self.source.iter_child_entries(result.path[0])) |
1609 | 1108 | changed_file_ids.add(result[0]) | 1118 | changed_file_ids.add(result.file_id) |
1610 | 1109 | yield result | 1119 | yield result |
1611 | 1110 | 1120 | ||
1612 | 1111 | def file_content_matches( | 1121 | def file_content_matches( |
Thanks! As discussed, probably makes sense to flatten this a bit more in future, but this is much more readable as is.