Merge lp:~jelmer/brz/transform into lp:brz/3.1

Proposed by Jelmer Vernooij on 2020-07-04
Status: Merged
Approved by: Jelmer Vernooij on 2020-07-04
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
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve on 2020-07-04
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.
Jelmer Vernooij (jelmer) :
review: Approve
lp:~jelmer/brz/transform updated on 2020-07-04
7574. By Jelmer Vernooij on 2020-07-04

Add a code of conduct.

Merged from https://code.launchpad.net/~jelmer/brz/code-of-conduct/+merge/386850

7575. By Jelmer Vernooij on 2020-07-04

Improve the API for Transform.

Merged from https://code.launchpad.net/~jelmer/brz/transform/+merge/386855

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'breezy/conflicts.py'
--- breezy/conflicts.py 2020-07-04 00:38:37 +0000
+++ breezy/conflicts.py 2020-07-04 14:59:08 +0000
@@ -518,7 +518,7 @@
518 tree = self._revision_tree(tt._tree, revid)518 tree = self._revision_tree(tt._tree, revid)
519 transform.create_from_tree(519 transform.create_from_tree(
520 tt, tid, tree, tree.id2path(file_id))520 tt, tid, tree, tree.id2path(file_id))
521 tt.version_file(file_id, tid)521 tt.version_file(tid, file_id=file_id)
522 else:522 else:
523 tid = tt.trans_id_file_id(file_id)523 tid = tt.trans_id_file_id(file_id)
524 # Adjust the path for the retained file id524 # Adjust the path for the retained file id
@@ -672,7 +672,7 @@
672 item_parent_tid, item_tid)672 item_parent_tid, item_tid)
673 # Associate the file_id to the right content673 # Associate the file_id to the right content
674 tt.unversion_file(item_tid)674 tt.unversion_file(item_tid)
675 tt.version_file(self.file_id, winner_tid)675 tt.version_file(winner_tid, file_id=self.file_id)
676 tt.apply()676 tt.apply()
677677
678 def action_auto(self, tree):678 def action_auto(self, tree):
679679
=== modified file 'breezy/git/workingtree.py'
--- breezy/git/workingtree.py 2020-07-04 00:38:37 +0000
+++ breezy/git/workingtree.py 2020-07-04 14:59:08 +0000
@@ -56,7 +56,6 @@
56 controldir as _mod_controldir,56 controldir as _mod_controldir,
57 globbing,57 globbing,
58 lock,58 lock,
59 merge,
60 osutils,59 osutils,
61 revision as _mod_revision,60 revision as _mod_revision,
62 trace,61 trace,
@@ -1208,6 +1207,7 @@
1208 show_base=False):1207 show_base=False):
1209 basis_tree = self.revision_tree(old_revision)1208 basis_tree = self.revision_tree(old_revision)
1210 if new_revision != old_revision:1209 if new_revision != old_revision:
1210 from .. import merge
1211 with basis_tree.lock_read():1211 with basis_tree.lock_read():
1212 new_basis_tree = self.branch.basis_tree()1212 new_basis_tree = self.branch.basis_tree()
1213 merge.merge_inner(1213 merge.merge_inner(
@@ -1316,6 +1316,7 @@
13161316
1317 def copy_content_into(self, tree, revision_id=None):1317 def copy_content_into(self, tree, revision_id=None):
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."""
1319 from .. import merge
1319 with self.lock_read():1320 with self.lock_read():
1320 if revision_id is None:1321 if revision_id is None:
1321 merge.transform_tree(tree, self)1322 merge.transform_tree(tree, self)
13221323
=== modified file 'breezy/merge.py'
--- breezy/merge.py 2020-07-04 01:15:59 +0000
+++ breezy/merge.py 2020-07-04 14:59:08 +0000
@@ -1288,7 +1288,7 @@
1288 keep_this = True1288 keep_this = True
1289 # versioning the merged file will trigger a duplicate1289 # versioning the merged file will trigger a duplicate
1290 # conflict1290 # conflict
1291 self.tt.version_file(file_id, trans_id)1291 self.tt.version_file(trans_id, file_id=file_id)
1292 transform.create_from_tree(1292 transform.create_from_tree(
1293 self.tt, trans_id, self.other_tree,1293 self.tt, trans_id, self.other_tree,
1294 other_path,1294 other_path,
@@ -1335,7 +1335,7 @@
1335 else:1335 else:
1336 raise AssertionError('unknown hook_status: %r' % (hook_status,))1336 raise AssertionError('unknown hook_status: %r' % (hook_status,))
1337 if not this_path and result == "modified":1337 if not this_path and result == "modified":
1338 self.tt.version_file(file_id, trans_id)1338 self.tt.version_file(trans_id, file_id=file_id)
1339 if not keep_this:1339 if not keep_this:
1340 # The merge has been performed and produced a new content, so the1340 # The merge has been performed and produced a new content, so the
1341 # old contents should not be retained.1341 # old contents should not be retained.
@@ -1486,7 +1486,7 @@
1486 filter_tree_path)1486 filter_tree_path)
1487 file_group.append(trans_id)1487 file_group.append(trans_id)
1488 if set_version and not versioned:1488 if set_version and not versioned:
1489 self.tt.version_file(file_id, trans_id)1489 self.tt.version_file(trans_id, file_id=file_id)
1490 versioned = True1490 versioned = True
1491 return file_group1491 return file_group
14921492
14931493
=== modified file 'breezy/shelf.py'
--- breezy/shelf.py 2020-07-04 01:15:59 +0000
+++ breezy/shelf.py 2020-07-04 14:59:08 +0000
@@ -268,7 +268,7 @@
268 to_transform, s_trans_id, tree,268 to_transform, s_trans_id, tree,
269 tree.id2path(file_id))269 tree.id2path(file_id))
270 if version:270 if version:
271 to_transform.version_file(file_id, s_trans_id)271 to_transform.version_file(s_trans_id, file_id=file_id)
272272
273 def _inverse_lines(self, new_lines, file_id):273 def _inverse_lines(self, new_lines, file_id):
274 """Produce a version with only those changes removed from new_lines."""274 """Produce a version with only those changes removed from new_lines."""
275275
=== modified file 'breezy/tests/per_workingtree/test_transform.py'
--- breezy/tests/per_workingtree/test_transform.py 2020-07-04 12:18:47 +0000
+++ breezy/tests/per_workingtree/test_transform.py 2020-07-04 14:59:08 +0000
@@ -135,20 +135,20 @@
135 self.assertIs(None, transform.final_kind(trans_id))135 self.assertIs(None, transform.final_kind(trans_id))
136 transform.create_file([b'contents'], trans_id)136 transform.create_file([b'contents'], trans_id)
137 transform.set_executability(True, trans_id)137 transform.set_executability(True, trans_id)
138 transform.version_file(b'my_pretties', trans_id)138 transform.version_file(trans_id, file_id=b'my_pretties')
139 self.assertRaises(DuplicateKey, transform.version_file,139 self.assertRaises(DuplicateKey, transform.version_file,
140 b'my_pretties', trans_id)140 trans_id, file_id=b'my_pretties')
141 self.assertEqual(transform.final_file_id(trans_id), b'my_pretties')141 self.assertEqual(transform.final_file_id(trans_id), b'my_pretties')
142 self.assertEqual(transform.final_parent(trans_id), root)142 self.assertEqual(transform.final_parent(trans_id), root)
143 self.assertIs(transform.final_parent(root), ROOT_PARENT)143 self.assertIs(transform.final_parent(root), ROOT_PARENT)
144 self.assertIs(transform.get_tree_parent(root), ROOT_PARENT)144 self.assertIs(transform.get_tree_parent(root), ROOT_PARENT)
145 oz_id = transform.create_path('oz', root)145 oz_id = transform.create_path('oz', root)
146 transform.create_directory(oz_id)146 transform.create_directory(oz_id)
147 transform.version_file(b'ozzie', oz_id)147 transform.version_file(oz_id, file_id=b'ozzie')
148 trans_id2 = transform.create_path('name2', root)148 trans_id2 = transform.create_path('name2', root)
149 transform.create_file([b'contents'], trans_id2)149 transform.create_file([b'contents'], trans_id2)
150 transform.set_executability(False, trans_id2)150 transform.set_executability(False, trans_id2)
151 transform.version_file(b'my_pretties2', trans_id2)151 transform.version_file(trans_id2, file_id=b'my_pretties2')
152 modified_paths = transform.apply().modified_paths152 modified_paths = transform.apply().modified_paths
153 with self.wt.get_file('name') as f:153 with self.wt.get_file('name') as f:
154 self.assertEqual(b'contents', f.read())154 self.assertEqual(b'contents', f.read())
@@ -419,7 +419,7 @@
419 self.assertEqual(transform.find_conflicts(),419 self.assertEqual(transform.find_conflicts(),
420 [('unversioned parent', lion_id),420 [('unversioned parent', lion_id),
421 ('missing parent', lion_id)])421 ('missing parent', lion_id)])
422 transform.version_file(b"Courage", lion_id)422 transform.version_file(lion_id, file_id=b"Courage")
423 self.assertEqual(transform.find_conflicts(),423 self.assertEqual(transform.find_conflicts(),
424 [('missing parent', lion_id),424 [('missing parent', lion_id),
425 ('versioning no contents', lion_id)])425 ('versioning no contents', lion_id)])
@@ -436,7 +436,7 @@
436 transform.set_executability(True, oz_id)436 transform.set_executability(True, oz_id)
437 self.assertEqual(transform.find_conflicts(),437 self.assertEqual(transform.find_conflicts(),
438 [('unversioned executability', oz_id)])438 [('unversioned executability', oz_id)])
439 transform.version_file(b'oz-id', oz_id)439 transform.version_file(oz_id, file_id=b'oz-id')
440 self.assertEqual(transform.find_conflicts(),440 self.assertEqual(transform.find_conflicts(),
441 [('non-file executability', oz_id)])441 [('non-file executability', oz_id)])
442 transform.set_executability(None, oz_id)442 transform.set_executability(None, oz_id)
@@ -764,7 +764,7 @@
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')
765 wiz_id = transform.create_path(link_name2, oz_id)765 wiz_id = transform.create_path(link_name2, oz_id)
766 transform.create_symlink(link_target2, wiz_id)766 transform.create_symlink(link_target2, wiz_id)
767 transform.version_file(b'wiz-id2', wiz_id)767 transform.version_file(wiz_id, file_id=b'wiz-id2')
768 transform.set_executability(True, wiz_id)768 transform.set_executability(True, wiz_id)
769 self.assertEqual(transform.find_conflicts(),769 self.assertEqual(transform.find_conflicts(),
770 [('non-file executability', wiz_id)])770 [('non-file executability', wiz_id)])
@@ -987,7 +987,7 @@
987 transform, root = self.transform()987 transform, root = self.transform()
988 transform.adjust_root_path('oldroot', fun)988 transform.adjust_root_path('oldroot', fun)
989 new_root = transform.trans_id_tree_path('')989 new_root = transform.trans_id_tree_path('')
990 transform.version_file(b'new-root', new_root)990 transform.version_file(new_root, file_id=b'new-root')
991 transform.apply()991 transform.apply()
992992
993 def test_renames(self):993 def test_renames(self):
@@ -1148,7 +1148,7 @@
1148 transform, root = self.transform()1148 transform, root = self.transform()
1149 try:1149 try:
1150 old = transform.trans_id_tree_path('old')1150 old = transform.trans_id_tree_path('old')
1151 transform.version_file(b'id-1', old)1151 transform.version_file(old, file_id=b'id-1')
1152 self.assertEqual([(b'id-1', (None, 'old'), False, (False, True),1152 self.assertEqual([(b'id-1', (None, 'old'), False, (False, True),
1153 (b'eert_toor', b'eert_toor'),1153 (b'eert_toor', b'eert_toor'),
1154 ('old', 'old'), ('file', 'file'),1154 ('old', 'old'), ('file', 'file'),
@@ -1197,7 +1197,7 @@
1197 # move file_id to a different file1197 # move file_id to a different file
1198 self.assertEqual([], list(transform.iter_changes()))1198 self.assertEqual([], list(transform.iter_changes()))
1199 transform.unversion_file(old)1199 transform.unversion_file(old)
1200 transform.version_file(b'id-1', new)1200 transform.version_file(new, file_id=b'id-1')
1201 transform.adjust_path('old', root, new)1201 transform.adjust_path('old', root, new)
1202 self.assertEqual([(b'id-1', ('old', 'old'), True, (True, True),1202 self.assertEqual([(b'id-1', ('old', 'old'), True, (True, True),
1203 (b'eert_toor', b'eert_toor'),1203 (b'eert_toor', b'eert_toor'),
@@ -1308,7 +1308,7 @@
1308 transform.create_directory(subdir)1308 transform.create_directory(subdir)
1309 transform.set_executability(False, old)1309 transform.set_executability(False, old)
1310 transform.unversion_file(old)1310 transform.unversion_file(old)
1311 transform.version_file(b'id-1', old)1311 transform.version_file(old, file_id=b'id-1')
1312 transform.adjust_path('old', root, old)1312 transform.adjust_path('old', root, old)
1313 self.assertEqual([], list(transform.iter_changes()))1313 self.assertEqual([], list(transform.iter_changes()))
1314 finally:1314 finally:
@@ -1550,7 +1550,7 @@
1550 tt.create_directory(foo_trans_id)1550 tt.create_directory(foo_trans_id)
1551 bar_trans_id = tt.trans_id_tree_path("foo/bar")1551 bar_trans_id = tt.trans_id_tree_path("foo/bar")
1552 tt.create_file([b"aa\n"], bar_trans_id)1552 tt.create_file([b"aa\n"], bar_trans_id)
1553 tt.version_file(b"bar-1", bar_trans_id)1553 tt.version_file(bar_trans_id, file_id=b"bar-1")
1554 tt.apply()1554 tt.apply()
1555 self.assertPathExists("foo/bar")1555 self.assertPathExists("foo/bar")
1556 with wt.lock_read():1556 with wt.lock_read():
15571557
=== modified file 'breezy/tests/test_import_tariff.py'
--- breezy/tests/test_import_tariff.py 2020-06-22 02:05:31 +0000
+++ breezy/tests/test_import_tariff.py 2020-07-04 14:59:08 +0000
@@ -228,6 +228,7 @@
228 'breezy.gpg',228 'breezy.gpg',
229 'breezy.info',229 'breezy.info',
230 'breezy.bzr.knit',230 'breezy.bzr.knit',
231 'breezy.merge',
231 'breezy.merge3',232 'breezy.merge3',
232 'breezy.merge_directive',233 'breezy.merge_directive',
233 'breezy.msgeditor',234 'breezy.msgeditor',
234235
=== modified file 'breezy/tests/test_transform.py'
--- breezy/tests/test_transform.py 2020-07-04 12:23:16 +0000
+++ breezy/tests/test_transform.py 2020-07-04 14:59:08 +0000
@@ -124,7 +124,7 @@
124 tree.add('foo', b'foo-id')124 tree.add('foo', b'foo-id')
125 with tree.preview_transform() as tt:125 with tree.preview_transform() as tt:
126 tt.unversion_file(tt.root)126 tt.unversion_file(tt.root)
127 tt.version_file(b'new-id', tt.root)127 tt.version_file(tt.root, file_id=b'new-id')
128 foo_trans_id = tt.trans_id_tree_path('foo')128 foo_trans_id = tt.trans_id_tree_path('foo')
129 foo_tuple = ('foo', foo_trans_id)129 foo_tuple = ('foo', foo_trans_id)
130 root_tuple = ('', tt.root)130 root_tuple = ('', tt.root)
@@ -136,7 +136,7 @@
136 tree.add('foo', b'foo-id')136 tree.add('foo', b'foo-id')
137 with tree.preview_transform() as tt:137 with tree.preview_transform() as tt:
138 tt.unversion_file(tt.root)138 tt.unversion_file(tt.root)
139 tt.version_file(tree.path2id(''), tt.root)139 tt.version_file(tt.root, file_id=tree.path2id(''))
140 tt.trans_id_tree_path('foo')140 tt.trans_id_tree_path('foo')
141 self.assertEqual([], tt._inventory_altered())141 self.assertEqual([], tt._inventory_altered())
142142
@@ -1374,7 +1374,7 @@
1374 preview.unversion_file(preview.trans_id_file_id(b'b-id'))1374 preview.unversion_file(preview.trans_id_file_id(b'b-id'))
1375 c_trans_id = preview.trans_id_file_id(b'c-id')1375 c_trans_id = preview.trans_id_file_id(b'c-id')
1376 preview.unversion_file(c_trans_id)1376 preview.unversion_file(c_trans_id)
1377 preview.version_file(b'c-id', c_trans_id)1377 preview.version_file(c_trans_id, file_id=b'c-id')
1378 preview_tree = preview.get_preview_tree()1378 preview_tree = preview.get_preview_tree()
1379 self.assertEqual({b'a-id', b'c-id', tree.path2id('')},1379 self.assertEqual({b'a-id', b'c-id', tree.path2id('')},
1380 preview_tree.all_file_ids())1380 preview_tree.all_file_ids())
13811381
=== modified file 'breezy/transform.py'
--- breezy/transform.py 2020-07-04 00:38:37 +0000
+++ breezy/transform.py 2020-07-04 14:59:08 +0000
@@ -23,8 +23,10 @@
2323
24from . import (24from . import (
25 config as _mod_config,25 config as _mod_config,
26 controldir,
26 errors,27 errors,
27 lazy_import,28 lazy_import,
29 osutils,
28 registry,30 registry,
29 trace,31 trace,
30 tree,32 tree,
@@ -32,25 +34,22 @@
32lazy_import.lazy_import(globals(), """34lazy_import.lazy_import(globals(), """
33from breezy import (35from breezy import (
34 annotate,36 annotate,
35 bencode,
36 cleanup,37 cleanup,
37 controldir,
38 commit,38 commit,
39 conflicts,39 conflicts,
40 delta,
41 lock,40 lock,
42 multiparent,41 multiparent,
43 osutils,
44 revision as _mod_revision,42 revision as _mod_revision,
45 ui,43 ui,
46 urlutils,44 urlutils,
47 )45 )
46from breezy.i18n import gettext
48from breezy.bzr import (47from breezy.bzr import (
49 inventory,48 inventory,
50 inventorytree,49 inventorytree,
51 )50 )
52from breezy.i18n import gettext
53""")51""")
52
54from .errors import (DuplicateKey,53from .errors import (DuplicateKey,
55 CantMoveRoot,54 CantMoveRoot,
56 BzrError, InternalBzrError)55 BzrError, InternalBzrError)
@@ -188,6 +187,23 @@
188 """Support Context Manager API."""187 """Support Context Manager API."""
189 self.finalize()188 self.finalize()
190189
190 def iter_tree_children(self, trans_id):
191 """Iterate through the entry's tree children, if any.
192
193 :param trans_id: trans id to iterate
194 :returns: Iterator over paths
195 """
196 raise NotImplementedError(self.iter_tree_children)
197
198 def _read_symlink_target(self, trans_id):
199 raise NotImplementedError(self._read_symlink_target)
200
201 def canonical_path(self, path):
202 return path
203
204 def tree_kind(self, trans_id):
205 raise NotImplementedError(self.tree_kind)
206
191 def finalize(self):207 def finalize(self):
192 """Release the working tree lock, if held.208 """Release the working tree lock, if held.
193209
@@ -247,7 +263,7 @@
247 file_id = self.final_file_id(child_id)263 file_id = self.final_file_id(child_id)
248 if file_id is not None:264 if file_id is not None:
249 self.unversion_file(child_id)265 self.unversion_file(child_id)
250 self.version_file(file_id, child_id)266 self.version_file(child_id, file_id=file_id)
251267
252 # the physical root needs a new transaction id268 # the physical root needs a new transaction id
253 self._tree_path_ids.pop("")269 self._tree_path_ids.pop("")
@@ -257,7 +273,7 @@
257 parent = self._new_root273 parent = self._new_root
258 self.adjust_path(name, parent, old_root)274 self.adjust_path(name, parent, old_root)
259 self.create_directory(old_root)275 self.create_directory(old_root)
260 self.version_file(old_root_file_id, old_root)276 self.version_file(old_root, file_id=old_root_file_id)
261 self.unversion_file(self._new_root)277 self.unversion_file(self._new_root)
262278
263 def fixup_new_roots(self):279 def fixup_new_roots(self):
@@ -297,7 +313,7 @@
297 and self._new_root not in self._removed_id):313 and self._new_root not in self._removed_id):
298 self.unversion_file(self._new_root)314 self.unversion_file(self._new_root)
299 if file_id is not None:315 if file_id is not None:
300 self.version_file(file_id, self._new_root)316 self.version_file(self._new_root, file_id=file_id)
301317
302 # Now move children of new root into old root directory.318 # Now move children of new root into old root directory.
303 # Ensure all children are registered with the transaction, but don't319 # Ensure all children are registered with the transaction, but don't
@@ -391,7 +407,7 @@
391 """Set the reference associated with a directory"""407 """Set the reference associated with a directory"""
392 unique_add(self._new_reference_revision, trans_id, revision_id)408 unique_add(self._new_reference_revision, trans_id, revision_id)
393409
394 def version_file(self, file_id, trans_id):410 def version_file(self, trans_id, file_id=None):
395 """Schedule a file to become versioned."""411 """Schedule a file to become versioned."""
396 if file_id is None:412 if file_id is None:
397 raise ValueError()413 raise ValueError()
@@ -819,7 +835,7 @@
819 """Helper function to create a new filesystem entry."""835 """Helper function to create a new filesystem entry."""
820 trans_id = self.create_path(name, parent_id)836 trans_id = self.create_path(name, parent_id)
821 if file_id is not None:837 if file_id is not None:
822 self.version_file(file_id, trans_id)838 self.version_file(trans_id, file_id=file_id)
823 return trans_id839 return trans_id
824840
825 def new_file(self, name, parent_id, contents, file_id=None,841 def new_file(self, name, parent_id, contents, file_id=None,
@@ -897,7 +913,7 @@
897 # The child is removed as part of the transform. Since it was913 # The child is removed as part of the transform. Since it was
898 # versioned before, it's not an orphan914 # versioned before, it's not an orphan
899 continue915 continue
900 elif self.final_file_id(child_tid) is None:916 if self.final_file_id(child_tid) is None:
901 # The child is not versioned917 # The child is not versioned
902 orphans.append(child_tid)918 orphans.append(child_tid)
903 else:919 else:
@@ -1144,6 +1160,7 @@
11441160
1145 :param serializer: A Serialiser like pack.ContainerSerializer.1161 :param serializer: A Serialiser like pack.ContainerSerializer.
1146 """1162 """
1163 from . import bencode
1147 new_name = {k.encode('utf-8'): v.encode('utf-8')1164 new_name = {k.encode('utf-8'): v.encode('utf-8')
1148 for k, v in viewitems(self._new_name)}1165 for k, v in viewitems(self._new_name)}
1149 new_parent = {k.encode('utf-8'): v.encode('utf-8')1166 new_parent = {k.encode('utf-8'): v.encode('utf-8')
@@ -1195,6 +1212,7 @@
1195 :param records: An iterable of (names, content) tuples, as per1212 :param records: An iterable of (names, content) tuples, as per
1196 pack.ContainerPushParser.1213 pack.ContainerPushParser.
1197 """1214 """
1215 from . import bencode
1198 names, content = next(records)1216 names, content = next(records)
1199 attribs = bencode.bdecode(content)1217 attribs = bencode.bdecode(content)
1200 self._id_number = attribs[b'_id_number']1218 self._id_number = attribs[b'_id_number']
@@ -1403,6 +1421,9 @@
1403 descendants.update(self._limbo_descendants(descendant))1421 descendants.update(self._limbo_descendants(descendant))
1404 return descendants1422 return descendants
14051423
1424 def _set_mode(self, trans_id, mode_id, typefunc):
1425 raise NotImplementedError(self._set_mode)
1426
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):
1407 """Schedule creation of a new file.1428 """Schedule creation of a new file.
14081429
@@ -2014,9 +2035,6 @@
2014 limbodir = osutils.mkdtemp(prefix='bzr-limbo-')2035 limbodir = osutils.mkdtemp(prefix='bzr-limbo-')
2015 DiskTreeTransform.__init__(self, tree, limbodir, pb, case_sensitive)2036 DiskTreeTransform.__init__(self, tree, limbodir, pb, case_sensitive)
20162037
2017 def canonical_path(self, path):
2018 return path
2019
2020 def tree_kind(self, trans_id):2038 def tree_kind(self, trans_id):
2021 path = self._tree_id_paths.get(trans_id)2039 path = self._tree_id_paths.get(trans_id)
2022 if path is None:2040 if path is None:
@@ -2709,7 +2727,7 @@
2709 # getting the file text, and get them all at once.2727 # getting the file text, and get them all at once.
2710 trans_id = tt.create_path(entry.name, parent_id)2728 trans_id = tt.create_path(entry.name, parent_id)
2711 file_trans_id[file_id] = trans_id2729 file_trans_id[file_id] = trans_id
2712 tt.version_file(file_id, trans_id)2730 tt.version_file(trans_id, file_id=file_id)
2713 executable = tree.is_executable(tree_path)2731 executable = tree.is_executable(tree_path)
2714 if executable:2732 if executable:
2715 tt.set_executability(executable, trans_id)2733 tt.set_executability(executable, trans_id)
@@ -2925,6 +2943,7 @@
2925 conflicts, merge_modified = _prepare_revert_transform(2943 conflicts, merge_modified = _prepare_revert_transform(
2926 working_tree, target_tree, tt, filenames, backups, pp)2944 working_tree, target_tree, tt, filenames, backups, pp)
2927 if change_reporter:2945 if change_reporter:
2946 from . import delta
2928 change_reporter = delta._ChangeReporter(2947 change_reporter = delta._ChangeReporter(
2929 unversioned_filter=working_tree.is_ignored)2948 unversioned_filter=working_tree.is_ignored)
2930 delta.report_changes(tt.iter_changes(), change_reporter)2949 delta.report_changes(tt.iter_changes(), change_reporter)
@@ -3013,7 +3032,7 @@
3013 new_trans_id = tt.create_path(wt_name, parent_trans_id)3032 new_trans_id = tt.create_path(wt_name, parent_trans_id)
3014 if wt_versioned and target_versioned:3033 if wt_versioned and target_versioned:
3015 tt.unversion_file(trans_id)3034 tt.unversion_file(trans_id)
3016 tt.version_file(file_id, new_trans_id)3035 tt.version_file(new_trans_id, file_id=file_id)
3017 # New contents should have the same unix perms as old3036 # New contents should have the same unix perms as old
3018 # contents3037 # contents
3019 mode_id = trans_id3038 mode_id = trans_id
@@ -3051,7 +3070,7 @@
3051 elif target_kind is not None:3070 elif target_kind is not None:
3052 raise AssertionError(target_kind)3071 raise AssertionError(target_kind)
3053 if not wt_versioned and target_versioned:3072 if not wt_versioned and target_versioned:
3054 tt.version_file(file_id, trans_id)3073 tt.version_file(trans_id, file_id=file_id)
3055 if wt_versioned and not target_versioned:3074 if wt_versioned and not target_versioned:
3056 tt.unversion_file(trans_id)3075 tt.unversion_file(trans_id)
3057 if (target_name is not None3076 if (target_name is not None
@@ -3196,7 +3215,7 @@
3196 if path_tree and path_tree.path2id('') == file_id:3215 if path_tree and path_tree.path2id('') == file_id:
3197 # This is the root entry, skip it3216 # This is the root entry, skip it
3198 continue3217 continue
3199 tt.version_file(file_id, conflict[1])3218 tt.version_file(conflict[1], file_id=file_id)
3200 new_conflicts.add((c_type, 'Versioned directory', conflict[1]))3219 new_conflicts.add((c_type, 'Versioned directory', conflict[1]))
3201 elif c_type == 'non-directory parent':3220 elif c_type == 'non-directory parent':
3202 parent_id = conflict[1]3221 parent_id = conflict[1]
32033222
=== modified file 'breezy/upstream_import.py'
--- breezy/upstream_import.py 2020-07-04 00:38:37 +0000
+++ breezy/upstream_import.py 2020-07-04 14:59:08 +0000
@@ -290,7 +290,7 @@
290 if tt.tree_file_id(trans_id) is None:290 if tt.tree_file_id(trans_id) is None:
291 name = basename(member.name.rstrip('/'))291 name = basename(member.name.rstrip('/'))
292 file_id = generate_ids.gen_file_id(name)292 file_id = generate_ids.gen_file_id(name)
293 tt.version_file(file_id, trans_id)293 tt.version_file(trans_id, file_id=file_id)
294294
295 for relative_path in implied_parents.difference(added):295 for relative_path in implied_parents.difference(added):
296 if relative_path == "":296 if relative_path == "":
@@ -299,7 +299,7 @@
299 path = tree.abspath(relative_path)299 path = tree.abspath(relative_path)
300 do_directory(tt, trans_id, tree, relative_path, path)300 do_directory(tt, trans_id, tree, relative_path, path)
301 if tt.tree_file_id(trans_id) is None:301 if tt.tree_file_id(trans_id) is None:
302 tt.version_file(trans_id, trans_id)302 tt.version_file(trans_id, file_id=trans_id)
303 added.add(relative_path)303 added.add(relative_path)
304304
305 for path in removed.difference(added):305 for path in removed.difference(added):

Subscribers

People subscribed via source and target branches