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/transform |
Merge into: | lp:brz/3.1 |
Diff against target: |
460 lines (+63/-42) 9 files modified
breezy/conflicts.py (+2/-2) breezy/git/workingtree.py (+2/-1) breezy/merge.py (+3/-3) breezy/shelf.py (+1/-1) breezy/tests/per_workingtree/test_transform.py (+12/-12) breezy/tests/test_import_tariff.py (+1/-0) breezy/tests/test_transform.py (+3/-3) breezy/transform.py (+37/-18) breezy/upstream_import.py (+2/-2) |
To merge this branch: | bzr merge lp:~jelmer/brz/transform |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jelmer Vernooij | Approve | ||
Review via email: mp+386855@code.launchpad.net |
Commit message
Improve the API for Transform.
Description of the change
Improve the API for Transform.
To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) : | # |
review:
Approve
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote : | # |
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote : | # |
Running landing tests failed
https:/
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'breezy/conflicts.py' | |||
2 | --- breezy/conflicts.py 2020-07-04 00:38:37 +0000 | |||
3 | +++ breezy/conflicts.py 2020-07-04 14:59:08 +0000 | |||
4 | @@ -518,7 +518,7 @@ | |||
5 | 518 | tree = self._revision_tree(tt._tree, revid) | 518 | tree = self._revision_tree(tt._tree, revid) |
6 | 519 | transform.create_from_tree( | 519 | transform.create_from_tree( |
7 | 520 | tt, tid, tree, tree.id2path(file_id)) | 520 | tt, tid, tree, tree.id2path(file_id)) |
9 | 521 | tt.version_file(file_id, tid) | 521 | tt.version_file(tid, file_id=file_id) |
10 | 522 | else: | 522 | else: |
11 | 523 | tid = tt.trans_id_file_id(file_id) | 523 | tid = tt.trans_id_file_id(file_id) |
12 | 524 | # Adjust the path for the retained file id | 524 | # Adjust the path for the retained file id |
13 | @@ -672,7 +672,7 @@ | |||
14 | 672 | item_parent_tid, item_tid) | 672 | item_parent_tid, item_tid) |
15 | 673 | # Associate the file_id to the right content | 673 | # Associate the file_id to the right content |
16 | 674 | tt.unversion_file(item_tid) | 674 | tt.unversion_file(item_tid) |
18 | 675 | tt.version_file(self.file_id, winner_tid) | 675 | tt.version_file(winner_tid, file_id=self.file_id) |
19 | 676 | tt.apply() | 676 | tt.apply() |
20 | 677 | 677 | ||
21 | 678 | def action_auto(self, tree): | 678 | def action_auto(self, tree): |
22 | 679 | 679 | ||
23 | === modified file 'breezy/git/workingtree.py' | |||
24 | --- breezy/git/workingtree.py 2020-07-04 00:38:37 +0000 | |||
25 | +++ breezy/git/workingtree.py 2020-07-04 14:59:08 +0000 | |||
26 | @@ -56,7 +56,6 @@ | |||
27 | 56 | controldir as _mod_controldir, | 56 | controldir as _mod_controldir, |
28 | 57 | globbing, | 57 | globbing, |
29 | 58 | lock, | 58 | lock, |
30 | 59 | merge, | ||
31 | 60 | osutils, | 59 | osutils, |
32 | 61 | revision as _mod_revision, | 60 | revision as _mod_revision, |
33 | 62 | trace, | 61 | trace, |
34 | @@ -1208,6 +1207,7 @@ | |||
35 | 1208 | show_base=False): | 1207 | show_base=False): |
36 | 1209 | basis_tree = self.revision_tree(old_revision) | 1208 | basis_tree = self.revision_tree(old_revision) |
37 | 1210 | if new_revision != old_revision: | 1209 | if new_revision != old_revision: |
38 | 1210 | from .. import merge | ||
39 | 1211 | with basis_tree.lock_read(): | 1211 | with basis_tree.lock_read(): |
40 | 1212 | new_basis_tree = self.branch.basis_tree() | 1212 | new_basis_tree = self.branch.basis_tree() |
41 | 1213 | merge.merge_inner( | 1213 | merge.merge_inner( |
42 | @@ -1316,6 +1316,7 @@ | |||
43 | 1316 | 1316 | ||
44 | 1317 | def copy_content_into(self, tree, revision_id=None): | 1317 | def copy_content_into(self, tree, revision_id=None): |
45 | 1318 | """Copy the current content and user files of this tree into tree.""" | 1318 | """Copy the current content and user files of this tree into tree.""" |
46 | 1319 | from .. import merge | ||
47 | 1319 | with self.lock_read(): | 1320 | with self.lock_read(): |
48 | 1320 | if revision_id is None: | 1321 | if revision_id is None: |
49 | 1321 | merge.transform_tree(tree, self) | 1322 | merge.transform_tree(tree, self) |
50 | 1322 | 1323 | ||
51 | === modified file 'breezy/merge.py' | |||
52 | --- breezy/merge.py 2020-07-04 01:15:59 +0000 | |||
53 | +++ breezy/merge.py 2020-07-04 14:59:08 +0000 | |||
54 | @@ -1288,7 +1288,7 @@ | |||
55 | 1288 | keep_this = True | 1288 | keep_this = True |
56 | 1289 | # versioning the merged file will trigger a duplicate | 1289 | # versioning the merged file will trigger a duplicate |
57 | 1290 | # conflict | 1290 | # conflict |
59 | 1291 | self.tt.version_file(file_id, trans_id) | 1291 | self.tt.version_file(trans_id, file_id=file_id) |
60 | 1292 | transform.create_from_tree( | 1292 | transform.create_from_tree( |
61 | 1293 | self.tt, trans_id, self.other_tree, | 1293 | self.tt, trans_id, self.other_tree, |
62 | 1294 | other_path, | 1294 | other_path, |
63 | @@ -1335,7 +1335,7 @@ | |||
64 | 1335 | else: | 1335 | else: |
65 | 1336 | raise AssertionError('unknown hook_status: %r' % (hook_status,)) | 1336 | raise AssertionError('unknown hook_status: %r' % (hook_status,)) |
66 | 1337 | if not this_path and result == "modified": | 1337 | if not this_path and result == "modified": |
68 | 1338 | self.tt.version_file(file_id, trans_id) | 1338 | self.tt.version_file(trans_id, file_id=file_id) |
69 | 1339 | if not keep_this: | 1339 | if not keep_this: |
70 | 1340 | # The merge has been performed and produced a new content, so the | 1340 | # The merge has been performed and produced a new content, so the |
71 | 1341 | # old contents should not be retained. | 1341 | # old contents should not be retained. |
72 | @@ -1486,7 +1486,7 @@ | |||
73 | 1486 | filter_tree_path) | 1486 | filter_tree_path) |
74 | 1487 | file_group.append(trans_id) | 1487 | file_group.append(trans_id) |
75 | 1488 | if set_version and not versioned: | 1488 | if set_version and not versioned: |
77 | 1489 | self.tt.version_file(file_id, trans_id) | 1489 | self.tt.version_file(trans_id, file_id=file_id) |
78 | 1490 | versioned = True | 1490 | versioned = True |
79 | 1491 | return file_group | 1491 | return file_group |
80 | 1492 | 1492 | ||
81 | 1493 | 1493 | ||
82 | === modified file 'breezy/shelf.py' | |||
83 | --- breezy/shelf.py 2020-07-04 01:15:59 +0000 | |||
84 | +++ breezy/shelf.py 2020-07-04 14:59:08 +0000 | |||
85 | @@ -268,7 +268,7 @@ | |||
86 | 268 | to_transform, s_trans_id, tree, | 268 | to_transform, s_trans_id, tree, |
87 | 269 | tree.id2path(file_id)) | 269 | tree.id2path(file_id)) |
88 | 270 | if version: | 270 | if version: |
90 | 271 | to_transform.version_file(file_id, s_trans_id) | 271 | to_transform.version_file(s_trans_id, file_id=file_id) |
91 | 272 | 272 | ||
92 | 273 | def _inverse_lines(self, new_lines, file_id): | 273 | def _inverse_lines(self, new_lines, file_id): |
93 | 274 | """Produce a version with only those changes removed from new_lines.""" | 274 | """Produce a version with only those changes removed from new_lines.""" |
94 | 275 | 275 | ||
95 | === modified file 'breezy/tests/per_workingtree/test_transform.py' | |||
96 | --- breezy/tests/per_workingtree/test_transform.py 2020-07-04 12:18:47 +0000 | |||
97 | +++ breezy/tests/per_workingtree/test_transform.py 2020-07-04 14:59:08 +0000 | |||
98 | @@ -135,20 +135,20 @@ | |||
99 | 135 | self.assertIs(None, transform.final_kind(trans_id)) | 135 | self.assertIs(None, transform.final_kind(trans_id)) |
100 | 136 | transform.create_file([b'contents'], trans_id) | 136 | transform.create_file([b'contents'], trans_id) |
101 | 137 | transform.set_executability(True, trans_id) | 137 | transform.set_executability(True, trans_id) |
103 | 138 | transform.version_file(b'my_pretties', trans_id) | 138 | transform.version_file(trans_id, file_id=b'my_pretties') |
104 | 139 | self.assertRaises(DuplicateKey, transform.version_file, | 139 | self.assertRaises(DuplicateKey, transform.version_file, |
106 | 140 | b'my_pretties', trans_id) | 140 | trans_id, file_id=b'my_pretties') |
107 | 141 | self.assertEqual(transform.final_file_id(trans_id), b'my_pretties') | 141 | self.assertEqual(transform.final_file_id(trans_id), b'my_pretties') |
108 | 142 | self.assertEqual(transform.final_parent(trans_id), root) | 142 | self.assertEqual(transform.final_parent(trans_id), root) |
109 | 143 | self.assertIs(transform.final_parent(root), ROOT_PARENT) | 143 | self.assertIs(transform.final_parent(root), ROOT_PARENT) |
110 | 144 | self.assertIs(transform.get_tree_parent(root), ROOT_PARENT) | 144 | self.assertIs(transform.get_tree_parent(root), ROOT_PARENT) |
111 | 145 | oz_id = transform.create_path('oz', root) | 145 | oz_id = transform.create_path('oz', root) |
112 | 146 | transform.create_directory(oz_id) | 146 | transform.create_directory(oz_id) |
114 | 147 | transform.version_file(b'ozzie', oz_id) | 147 | transform.version_file(oz_id, file_id=b'ozzie') |
115 | 148 | trans_id2 = transform.create_path('name2', root) | 148 | trans_id2 = transform.create_path('name2', root) |
116 | 149 | transform.create_file([b'contents'], trans_id2) | 149 | transform.create_file([b'contents'], trans_id2) |
117 | 150 | transform.set_executability(False, trans_id2) | 150 | transform.set_executability(False, trans_id2) |
119 | 151 | transform.version_file(b'my_pretties2', trans_id2) | 151 | transform.version_file(trans_id2, file_id=b'my_pretties2') |
120 | 152 | modified_paths = transform.apply().modified_paths | 152 | modified_paths = transform.apply().modified_paths |
121 | 153 | with self.wt.get_file('name') as f: | 153 | with self.wt.get_file('name') as f: |
122 | 154 | self.assertEqual(b'contents', f.read()) | 154 | self.assertEqual(b'contents', f.read()) |
123 | @@ -419,7 +419,7 @@ | |||
124 | 419 | self.assertEqual(transform.find_conflicts(), | 419 | self.assertEqual(transform.find_conflicts(), |
125 | 420 | [('unversioned parent', lion_id), | 420 | [('unversioned parent', lion_id), |
126 | 421 | ('missing parent', lion_id)]) | 421 | ('missing parent', lion_id)]) |
128 | 422 | transform.version_file(b"Courage", lion_id) | 422 | transform.version_file(lion_id, file_id=b"Courage") |
129 | 423 | self.assertEqual(transform.find_conflicts(), | 423 | self.assertEqual(transform.find_conflicts(), |
130 | 424 | [('missing parent', lion_id), | 424 | [('missing parent', lion_id), |
131 | 425 | ('versioning no contents', lion_id)]) | 425 | ('versioning no contents', lion_id)]) |
132 | @@ -436,7 +436,7 @@ | |||
133 | 436 | transform.set_executability(True, oz_id) | 436 | transform.set_executability(True, oz_id) |
134 | 437 | self.assertEqual(transform.find_conflicts(), | 437 | self.assertEqual(transform.find_conflicts(), |
135 | 438 | [('unversioned executability', oz_id)]) | 438 | [('unversioned executability', oz_id)]) |
137 | 439 | transform.version_file(b'oz-id', oz_id) | 439 | transform.version_file(oz_id, file_id=b'oz-id') |
138 | 440 | self.assertEqual(transform.find_conflicts(), | 440 | self.assertEqual(transform.find_conflicts(), |
139 | 441 | [('non-file executability', oz_id)]) | 441 | [('non-file executability', oz_id)]) |
140 | 442 | transform.set_executability(None, oz_id) | 442 | transform.set_executability(None, oz_id) |
141 | @@ -764,7 +764,7 @@ | |||
142 | 764 | transform.new_symlink(link_name1, oz_id, link_target1, b'wizard-id') | 764 | transform.new_symlink(link_name1, oz_id, link_target1, b'wizard-id') |
143 | 765 | wiz_id = transform.create_path(link_name2, oz_id) | 765 | wiz_id = transform.create_path(link_name2, oz_id) |
144 | 766 | transform.create_symlink(link_target2, wiz_id) | 766 | transform.create_symlink(link_target2, wiz_id) |
146 | 767 | transform.version_file(b'wiz-id2', wiz_id) | 767 | transform.version_file(wiz_id, file_id=b'wiz-id2') |
147 | 768 | transform.set_executability(True, wiz_id) | 768 | transform.set_executability(True, wiz_id) |
148 | 769 | self.assertEqual(transform.find_conflicts(), | 769 | self.assertEqual(transform.find_conflicts(), |
149 | 770 | [('non-file executability', wiz_id)]) | 770 | [('non-file executability', wiz_id)]) |
150 | @@ -987,7 +987,7 @@ | |||
151 | 987 | transform, root = self.transform() | 987 | transform, root = self.transform() |
152 | 988 | transform.adjust_root_path('oldroot', fun) | 988 | transform.adjust_root_path('oldroot', fun) |
153 | 989 | new_root = transform.trans_id_tree_path('') | 989 | new_root = transform.trans_id_tree_path('') |
155 | 990 | transform.version_file(b'new-root', new_root) | 990 | transform.version_file(new_root, file_id=b'new-root') |
156 | 991 | transform.apply() | 991 | transform.apply() |
157 | 992 | 992 | ||
158 | 993 | def test_renames(self): | 993 | def test_renames(self): |
159 | @@ -1148,7 +1148,7 @@ | |||
160 | 1148 | transform, root = self.transform() | 1148 | transform, root = self.transform() |
161 | 1149 | try: | 1149 | try: |
162 | 1150 | old = transform.trans_id_tree_path('old') | 1150 | old = transform.trans_id_tree_path('old') |
164 | 1151 | transform.version_file(b'id-1', old) | 1151 | transform.version_file(old, file_id=b'id-1') |
165 | 1152 | self.assertEqual([(b'id-1', (None, 'old'), False, (False, True), | 1152 | self.assertEqual([(b'id-1', (None, 'old'), False, (False, True), |
166 | 1153 | (b'eert_toor', b'eert_toor'), | 1153 | (b'eert_toor', b'eert_toor'), |
167 | 1154 | ('old', 'old'), ('file', 'file'), | 1154 | ('old', 'old'), ('file', 'file'), |
168 | @@ -1197,7 +1197,7 @@ | |||
169 | 1197 | # move file_id to a different file | 1197 | # move file_id to a different file |
170 | 1198 | self.assertEqual([], list(transform.iter_changes())) | 1198 | self.assertEqual([], list(transform.iter_changes())) |
171 | 1199 | transform.unversion_file(old) | 1199 | transform.unversion_file(old) |
173 | 1200 | transform.version_file(b'id-1', new) | 1200 | transform.version_file(new, file_id=b'id-1') |
174 | 1201 | transform.adjust_path('old', root, new) | 1201 | transform.adjust_path('old', root, new) |
175 | 1202 | self.assertEqual([(b'id-1', ('old', 'old'), True, (True, True), | 1202 | self.assertEqual([(b'id-1', ('old', 'old'), True, (True, True), |
176 | 1203 | (b'eert_toor', b'eert_toor'), | 1203 | (b'eert_toor', b'eert_toor'), |
177 | @@ -1308,7 +1308,7 @@ | |||
178 | 1308 | transform.create_directory(subdir) | 1308 | transform.create_directory(subdir) |
179 | 1309 | transform.set_executability(False, old) | 1309 | transform.set_executability(False, old) |
180 | 1310 | transform.unversion_file(old) | 1310 | transform.unversion_file(old) |
182 | 1311 | transform.version_file(b'id-1', old) | 1311 | transform.version_file(old, file_id=b'id-1') |
183 | 1312 | transform.adjust_path('old', root, old) | 1312 | transform.adjust_path('old', root, old) |
184 | 1313 | self.assertEqual([], list(transform.iter_changes())) | 1313 | self.assertEqual([], list(transform.iter_changes())) |
185 | 1314 | finally: | 1314 | finally: |
186 | @@ -1550,7 +1550,7 @@ | |||
187 | 1550 | tt.create_directory(foo_trans_id) | 1550 | tt.create_directory(foo_trans_id) |
188 | 1551 | bar_trans_id = tt.trans_id_tree_path("foo/bar") | 1551 | bar_trans_id = tt.trans_id_tree_path("foo/bar") |
189 | 1552 | tt.create_file([b"aa\n"], bar_trans_id) | 1552 | tt.create_file([b"aa\n"], bar_trans_id) |
191 | 1553 | tt.version_file(b"bar-1", bar_trans_id) | 1553 | tt.version_file(bar_trans_id, file_id=b"bar-1") |
192 | 1554 | tt.apply() | 1554 | tt.apply() |
193 | 1555 | self.assertPathExists("foo/bar") | 1555 | self.assertPathExists("foo/bar") |
194 | 1556 | with wt.lock_read(): | 1556 | with wt.lock_read(): |
195 | 1557 | 1557 | ||
196 | === modified file 'breezy/tests/test_import_tariff.py' | |||
197 | --- breezy/tests/test_import_tariff.py 2020-06-22 02:05:31 +0000 | |||
198 | +++ breezy/tests/test_import_tariff.py 2020-07-04 14:59:08 +0000 | |||
199 | @@ -228,6 +228,7 @@ | |||
200 | 228 | 'breezy.gpg', | 228 | 'breezy.gpg', |
201 | 229 | 'breezy.info', | 229 | 'breezy.info', |
202 | 230 | 'breezy.bzr.knit', | 230 | 'breezy.bzr.knit', |
203 | 231 | 'breezy.merge', | ||
204 | 231 | 'breezy.merge3', | 232 | 'breezy.merge3', |
205 | 232 | 'breezy.merge_directive', | 233 | 'breezy.merge_directive', |
206 | 233 | 'breezy.msgeditor', | 234 | 'breezy.msgeditor', |
207 | 234 | 235 | ||
208 | === modified file 'breezy/tests/test_transform.py' | |||
209 | --- breezy/tests/test_transform.py 2020-07-04 12:23:16 +0000 | |||
210 | +++ breezy/tests/test_transform.py 2020-07-04 14:59:08 +0000 | |||
211 | @@ -124,7 +124,7 @@ | |||
212 | 124 | tree.add('foo', b'foo-id') | 124 | tree.add('foo', b'foo-id') |
213 | 125 | with tree.preview_transform() as tt: | 125 | with tree.preview_transform() as tt: |
214 | 126 | tt.unversion_file(tt.root) | 126 | tt.unversion_file(tt.root) |
216 | 127 | tt.version_file(b'new-id', tt.root) | 127 | tt.version_file(tt.root, file_id=b'new-id') |
217 | 128 | foo_trans_id = tt.trans_id_tree_path('foo') | 128 | foo_trans_id = tt.trans_id_tree_path('foo') |
218 | 129 | foo_tuple = ('foo', foo_trans_id) | 129 | foo_tuple = ('foo', foo_trans_id) |
219 | 130 | root_tuple = ('', tt.root) | 130 | root_tuple = ('', tt.root) |
220 | @@ -136,7 +136,7 @@ | |||
221 | 136 | tree.add('foo', b'foo-id') | 136 | tree.add('foo', b'foo-id') |
222 | 137 | with tree.preview_transform() as tt: | 137 | with tree.preview_transform() as tt: |
223 | 138 | tt.unversion_file(tt.root) | 138 | tt.unversion_file(tt.root) |
225 | 139 | tt.version_file(tree.path2id(''), tt.root) | 139 | tt.version_file(tt.root, file_id=tree.path2id('')) |
226 | 140 | tt.trans_id_tree_path('foo') | 140 | tt.trans_id_tree_path('foo') |
227 | 141 | self.assertEqual([], tt._inventory_altered()) | 141 | self.assertEqual([], tt._inventory_altered()) |
228 | 142 | 142 | ||
229 | @@ -1374,7 +1374,7 @@ | |||
230 | 1374 | preview.unversion_file(preview.trans_id_file_id(b'b-id')) | 1374 | preview.unversion_file(preview.trans_id_file_id(b'b-id')) |
231 | 1375 | c_trans_id = preview.trans_id_file_id(b'c-id') | 1375 | c_trans_id = preview.trans_id_file_id(b'c-id') |
232 | 1376 | preview.unversion_file(c_trans_id) | 1376 | preview.unversion_file(c_trans_id) |
234 | 1377 | preview.version_file(b'c-id', c_trans_id) | 1377 | preview.version_file(c_trans_id, file_id=b'c-id') |
235 | 1378 | preview_tree = preview.get_preview_tree() | 1378 | preview_tree = preview.get_preview_tree() |
236 | 1379 | self.assertEqual({b'a-id', b'c-id', tree.path2id('')}, | 1379 | self.assertEqual({b'a-id', b'c-id', tree.path2id('')}, |
237 | 1380 | preview_tree.all_file_ids()) | 1380 | preview_tree.all_file_ids()) |
238 | 1381 | 1381 | ||
239 | === modified file 'breezy/transform.py' | |||
240 | --- breezy/transform.py 2020-07-04 00:38:37 +0000 | |||
241 | +++ breezy/transform.py 2020-07-04 14:59:08 +0000 | |||
242 | @@ -23,8 +23,10 @@ | |||
243 | 23 | 23 | ||
244 | 24 | from . import ( | 24 | from . import ( |
245 | 25 | config as _mod_config, | 25 | config as _mod_config, |
246 | 26 | controldir, | ||
247 | 26 | errors, | 27 | errors, |
248 | 27 | lazy_import, | 28 | lazy_import, |
249 | 29 | osutils, | ||
250 | 28 | registry, | 30 | registry, |
251 | 29 | trace, | 31 | trace, |
252 | 30 | tree, | 32 | tree, |
253 | @@ -32,25 +34,22 @@ | |||
254 | 32 | lazy_import.lazy_import(globals(), """ | 34 | lazy_import.lazy_import(globals(), """ |
255 | 33 | from breezy import ( | 35 | from breezy import ( |
256 | 34 | annotate, | 36 | annotate, |
257 | 35 | bencode, | ||
258 | 36 | cleanup, | 37 | cleanup, |
259 | 37 | controldir, | ||
260 | 38 | commit, | 38 | commit, |
261 | 39 | conflicts, | 39 | conflicts, |
262 | 40 | delta, | ||
263 | 41 | lock, | 40 | lock, |
264 | 42 | multiparent, | 41 | multiparent, |
265 | 43 | osutils, | ||
266 | 44 | revision as _mod_revision, | 42 | revision as _mod_revision, |
267 | 45 | ui, | 43 | ui, |
268 | 46 | urlutils, | 44 | urlutils, |
269 | 47 | ) | 45 | ) |
270 | 46 | from breezy.i18n import gettext | ||
271 | 48 | from breezy.bzr import ( | 47 | from breezy.bzr import ( |
272 | 49 | inventory, | 48 | inventory, |
273 | 50 | inventorytree, | 49 | inventorytree, |
274 | 51 | ) | 50 | ) |
275 | 52 | from breezy.i18n import gettext | ||
276 | 53 | """) | 51 | """) |
277 | 52 | |||
278 | 54 | from .errors import (DuplicateKey, | 53 | from .errors import (DuplicateKey, |
279 | 55 | CantMoveRoot, | 54 | CantMoveRoot, |
280 | 56 | BzrError, InternalBzrError) | 55 | BzrError, InternalBzrError) |
281 | @@ -188,6 +187,23 @@ | |||
282 | 188 | """Support Context Manager API.""" | 187 | """Support Context Manager API.""" |
283 | 189 | self.finalize() | 188 | self.finalize() |
284 | 190 | 189 | ||
285 | 190 | def iter_tree_children(self, trans_id): | ||
286 | 191 | """Iterate through the entry's tree children, if any. | ||
287 | 192 | |||
288 | 193 | :param trans_id: trans id to iterate | ||
289 | 194 | :returns: Iterator over paths | ||
290 | 195 | """ | ||
291 | 196 | raise NotImplementedError(self.iter_tree_children) | ||
292 | 197 | |||
293 | 198 | def _read_symlink_target(self, trans_id): | ||
294 | 199 | raise NotImplementedError(self._read_symlink_target) | ||
295 | 200 | |||
296 | 201 | def canonical_path(self, path): | ||
297 | 202 | return path | ||
298 | 203 | |||
299 | 204 | def tree_kind(self, trans_id): | ||
300 | 205 | raise NotImplementedError(self.tree_kind) | ||
301 | 206 | |||
302 | 191 | def finalize(self): | 207 | def finalize(self): |
303 | 192 | """Release the working tree lock, if held. | 208 | """Release the working tree lock, if held. |
304 | 193 | 209 | ||
305 | @@ -247,7 +263,7 @@ | |||
306 | 247 | file_id = self.final_file_id(child_id) | 263 | file_id = self.final_file_id(child_id) |
307 | 248 | if file_id is not None: | 264 | if file_id is not None: |
308 | 249 | self.unversion_file(child_id) | 265 | self.unversion_file(child_id) |
310 | 250 | self.version_file(file_id, child_id) | 266 | self.version_file(child_id, file_id=file_id) |
311 | 251 | 267 | ||
312 | 252 | # the physical root needs a new transaction id | 268 | # the physical root needs a new transaction id |
313 | 253 | self._tree_path_ids.pop("") | 269 | self._tree_path_ids.pop("") |
314 | @@ -257,7 +273,7 @@ | |||
315 | 257 | parent = self._new_root | 273 | parent = self._new_root |
316 | 258 | self.adjust_path(name, parent, old_root) | 274 | self.adjust_path(name, parent, old_root) |
317 | 259 | self.create_directory(old_root) | 275 | self.create_directory(old_root) |
319 | 260 | self.version_file(old_root_file_id, old_root) | 276 | self.version_file(old_root, file_id=old_root_file_id) |
320 | 261 | self.unversion_file(self._new_root) | 277 | self.unversion_file(self._new_root) |
321 | 262 | 278 | ||
322 | 263 | def fixup_new_roots(self): | 279 | def fixup_new_roots(self): |
323 | @@ -297,7 +313,7 @@ | |||
324 | 297 | and self._new_root not in self._removed_id): | 313 | and self._new_root not in self._removed_id): |
325 | 298 | self.unversion_file(self._new_root) | 314 | self.unversion_file(self._new_root) |
326 | 299 | if file_id is not None: | 315 | if file_id is not None: |
328 | 300 | self.version_file(file_id, self._new_root) | 316 | self.version_file(self._new_root, file_id=file_id) |
329 | 301 | 317 | ||
330 | 302 | # Now move children of new root into old root directory. | 318 | # Now move children of new root into old root directory. |
331 | 303 | # Ensure all children are registered with the transaction, but don't | 319 | # Ensure all children are registered with the transaction, but don't |
332 | @@ -391,7 +407,7 @@ | |||
333 | 391 | """Set the reference associated with a directory""" | 407 | """Set the reference associated with a directory""" |
334 | 392 | unique_add(self._new_reference_revision, trans_id, revision_id) | 408 | unique_add(self._new_reference_revision, trans_id, revision_id) |
335 | 393 | 409 | ||
337 | 394 | def version_file(self, file_id, trans_id): | 410 | def version_file(self, trans_id, file_id=None): |
338 | 395 | """Schedule a file to become versioned.""" | 411 | """Schedule a file to become versioned.""" |
339 | 396 | if file_id is None: | 412 | if file_id is None: |
340 | 397 | raise ValueError() | 413 | raise ValueError() |
341 | @@ -819,7 +835,7 @@ | |||
342 | 819 | """Helper function to create a new filesystem entry.""" | 835 | """Helper function to create a new filesystem entry.""" |
343 | 820 | trans_id = self.create_path(name, parent_id) | 836 | trans_id = self.create_path(name, parent_id) |
344 | 821 | if file_id is not None: | 837 | if file_id is not None: |
346 | 822 | self.version_file(file_id, trans_id) | 838 | self.version_file(trans_id, file_id=file_id) |
347 | 823 | return trans_id | 839 | return trans_id |
348 | 824 | 840 | ||
349 | 825 | def new_file(self, name, parent_id, contents, file_id=None, | 841 | def new_file(self, name, parent_id, contents, file_id=None, |
350 | @@ -897,7 +913,7 @@ | |||
351 | 897 | # The child is removed as part of the transform. Since it was | 913 | # The child is removed as part of the transform. Since it was |
352 | 898 | # versioned before, it's not an orphan | 914 | # versioned before, it's not an orphan |
353 | 899 | continue | 915 | continue |
355 | 900 | elif self.final_file_id(child_tid) is None: | 916 | if self.final_file_id(child_tid) is None: |
356 | 901 | # The child is not versioned | 917 | # The child is not versioned |
357 | 902 | orphans.append(child_tid) | 918 | orphans.append(child_tid) |
358 | 903 | else: | 919 | else: |
359 | @@ -1144,6 +1160,7 @@ | |||
360 | 1144 | 1160 | ||
361 | 1145 | :param serializer: A Serialiser like pack.ContainerSerializer. | 1161 | :param serializer: A Serialiser like pack.ContainerSerializer. |
362 | 1146 | """ | 1162 | """ |
363 | 1163 | from . import bencode | ||
364 | 1147 | new_name = {k.encode('utf-8'): v.encode('utf-8') | 1164 | new_name = {k.encode('utf-8'): v.encode('utf-8') |
365 | 1148 | for k, v in viewitems(self._new_name)} | 1165 | for k, v in viewitems(self._new_name)} |
366 | 1149 | new_parent = {k.encode('utf-8'): v.encode('utf-8') | 1166 | new_parent = {k.encode('utf-8'): v.encode('utf-8') |
367 | @@ -1195,6 +1212,7 @@ | |||
368 | 1195 | :param records: An iterable of (names, content) tuples, as per | 1212 | :param records: An iterable of (names, content) tuples, as per |
369 | 1196 | pack.ContainerPushParser. | 1213 | pack.ContainerPushParser. |
370 | 1197 | """ | 1214 | """ |
371 | 1215 | from . import bencode | ||
372 | 1198 | names, content = next(records) | 1216 | names, content = next(records) |
373 | 1199 | attribs = bencode.bdecode(content) | 1217 | attribs = bencode.bdecode(content) |
374 | 1200 | self._id_number = attribs[b'_id_number'] | 1218 | self._id_number = attribs[b'_id_number'] |
375 | @@ -1403,6 +1421,9 @@ | |||
376 | 1403 | descendants.update(self._limbo_descendants(descendant)) | 1421 | descendants.update(self._limbo_descendants(descendant)) |
377 | 1404 | return descendants | 1422 | return descendants |
378 | 1405 | 1423 | ||
379 | 1424 | def _set_mode(self, trans_id, mode_id, typefunc): | ||
380 | 1425 | raise NotImplementedError(self._set_mode) | ||
381 | 1426 | |||
382 | 1406 | def create_file(self, contents, trans_id, mode_id=None, sha1=None): | 1427 | def create_file(self, contents, trans_id, mode_id=None, sha1=None): |
383 | 1407 | """Schedule creation of a new file. | 1428 | """Schedule creation of a new file. |
384 | 1408 | 1429 | ||
385 | @@ -2014,9 +2035,6 @@ | |||
386 | 2014 | limbodir = osutils.mkdtemp(prefix='bzr-limbo-') | 2035 | limbodir = osutils.mkdtemp(prefix='bzr-limbo-') |
387 | 2015 | DiskTreeTransform.__init__(self, tree, limbodir, pb, case_sensitive) | 2036 | DiskTreeTransform.__init__(self, tree, limbodir, pb, case_sensitive) |
388 | 2016 | 2037 | ||
389 | 2017 | def canonical_path(self, path): | ||
390 | 2018 | return path | ||
391 | 2019 | |||
392 | 2020 | def tree_kind(self, trans_id): | 2038 | def tree_kind(self, trans_id): |
393 | 2021 | path = self._tree_id_paths.get(trans_id) | 2039 | path = self._tree_id_paths.get(trans_id) |
394 | 2022 | if path is None: | 2040 | if path is None: |
395 | @@ -2709,7 +2727,7 @@ | |||
396 | 2709 | # getting the file text, and get them all at once. | 2727 | # getting the file text, and get them all at once. |
397 | 2710 | trans_id = tt.create_path(entry.name, parent_id) | 2728 | trans_id = tt.create_path(entry.name, parent_id) |
398 | 2711 | file_trans_id[file_id] = trans_id | 2729 | file_trans_id[file_id] = trans_id |
400 | 2712 | tt.version_file(file_id, trans_id) | 2730 | tt.version_file(trans_id, file_id=file_id) |
401 | 2713 | executable = tree.is_executable(tree_path) | 2731 | executable = tree.is_executable(tree_path) |
402 | 2714 | if executable: | 2732 | if executable: |
403 | 2715 | tt.set_executability(executable, trans_id) | 2733 | tt.set_executability(executable, trans_id) |
404 | @@ -2925,6 +2943,7 @@ | |||
405 | 2925 | conflicts, merge_modified = _prepare_revert_transform( | 2943 | conflicts, merge_modified = _prepare_revert_transform( |
406 | 2926 | working_tree, target_tree, tt, filenames, backups, pp) | 2944 | working_tree, target_tree, tt, filenames, backups, pp) |
407 | 2927 | if change_reporter: | 2945 | if change_reporter: |
408 | 2946 | from . import delta | ||
409 | 2928 | change_reporter = delta._ChangeReporter( | 2947 | change_reporter = delta._ChangeReporter( |
410 | 2929 | unversioned_filter=working_tree.is_ignored) | 2948 | unversioned_filter=working_tree.is_ignored) |
411 | 2930 | delta.report_changes(tt.iter_changes(), change_reporter) | 2949 | delta.report_changes(tt.iter_changes(), change_reporter) |
412 | @@ -3013,7 +3032,7 @@ | |||
413 | 3013 | new_trans_id = tt.create_path(wt_name, parent_trans_id) | 3032 | new_trans_id = tt.create_path(wt_name, parent_trans_id) |
414 | 3014 | if wt_versioned and target_versioned: | 3033 | if wt_versioned and target_versioned: |
415 | 3015 | tt.unversion_file(trans_id) | 3034 | tt.unversion_file(trans_id) |
417 | 3016 | tt.version_file(file_id, new_trans_id) | 3035 | tt.version_file(new_trans_id, file_id=file_id) |
418 | 3017 | # New contents should have the same unix perms as old | 3036 | # New contents should have the same unix perms as old |
419 | 3018 | # contents | 3037 | # contents |
420 | 3019 | mode_id = trans_id | 3038 | mode_id = trans_id |
421 | @@ -3051,7 +3070,7 @@ | |||
422 | 3051 | elif target_kind is not None: | 3070 | elif target_kind is not None: |
423 | 3052 | raise AssertionError(target_kind) | 3071 | raise AssertionError(target_kind) |
424 | 3053 | if not wt_versioned and target_versioned: | 3072 | if not wt_versioned and target_versioned: |
426 | 3054 | tt.version_file(file_id, trans_id) | 3073 | tt.version_file(trans_id, file_id=file_id) |
427 | 3055 | if wt_versioned and not target_versioned: | 3074 | if wt_versioned and not target_versioned: |
428 | 3056 | tt.unversion_file(trans_id) | 3075 | tt.unversion_file(trans_id) |
429 | 3057 | if (target_name is not None | 3076 | if (target_name is not None |
430 | @@ -3196,7 +3215,7 @@ | |||
431 | 3196 | if path_tree and path_tree.path2id('') == file_id: | 3215 | if path_tree and path_tree.path2id('') == file_id: |
432 | 3197 | # This is the root entry, skip it | 3216 | # This is the root entry, skip it |
433 | 3198 | continue | 3217 | continue |
435 | 3199 | tt.version_file(file_id, conflict[1]) | 3218 | tt.version_file(conflict[1], file_id=file_id) |
436 | 3200 | new_conflicts.add((c_type, 'Versioned directory', conflict[1])) | 3219 | new_conflicts.add((c_type, 'Versioned directory', conflict[1])) |
437 | 3201 | elif c_type == 'non-directory parent': | 3220 | elif c_type == 'non-directory parent': |
438 | 3202 | parent_id = conflict[1] | 3221 | parent_id = conflict[1] |
439 | 3203 | 3222 | ||
440 | === modified file 'breezy/upstream_import.py' | |||
441 | --- breezy/upstream_import.py 2020-07-04 00:38:37 +0000 | |||
442 | +++ breezy/upstream_import.py 2020-07-04 14:59:08 +0000 | |||
443 | @@ -290,7 +290,7 @@ | |||
444 | 290 | if tt.tree_file_id(trans_id) is None: | 290 | if tt.tree_file_id(trans_id) is None: |
445 | 291 | name = basename(member.name.rstrip('/')) | 291 | name = basename(member.name.rstrip('/')) |
446 | 292 | file_id = generate_ids.gen_file_id(name) | 292 | file_id = generate_ids.gen_file_id(name) |
448 | 293 | tt.version_file(file_id, trans_id) | 293 | tt.version_file(trans_id, file_id=file_id) |
449 | 294 | 294 | ||
450 | 295 | for relative_path in implied_parents.difference(added): | 295 | for relative_path in implied_parents.difference(added): |
451 | 296 | if relative_path == "": | 296 | if relative_path == "": |
452 | @@ -299,7 +299,7 @@ | |||
453 | 299 | path = tree.abspath(relative_path) | 299 | path = tree.abspath(relative_path) |
454 | 300 | do_directory(tt, trans_id, tree, relative_path, path) | 300 | do_directory(tt, trans_id, tree, relative_path, path) |
455 | 301 | if tt.tree_file_id(trans_id) is None: | 301 | if tt.tree_file_id(trans_id) is None: |
457 | 302 | tt.version_file(trans_id, trans_id) | 302 | tt.version_file(trans_id, file_id=trans_id) |
458 | 303 | added.add(relative_path) | 303 | added.add(relative_path) |
459 | 304 | 304 | ||
460 | 305 | for path in removed.difference(added): | 305 | for path in removed.difference(added): |
Running landing tests failed /ci.breezy- vcs.org/ job/brz- 3.1/job/ brz-3.1- land/189/
https:/