Rev 6031: (vila) Fix CHKInventory's filtering when mixing changes and moves in in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Mon Jul 18 13:03:06 UTC 2011
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 6031 [merge]
revision-id: pqm at pqm.ubuntu.com-20110718130303-4djmfqi2rh6k05aw
parent: pqm at pqm.ubuntu.com-20110716104745-8n8mgnn7ld7dcf8w
parent: v.ladeuil+lp at free.fr-20110718122134-ohmbiqfozp6ln85s
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2011-07-18 13:03:03 +0000
message:
(vila) Fix CHKInventory's filtering when mixing changes and moves in
subfolders (Bastian Bowe)
modified:
bzrlib/inventory.py inventory.py-20050309040759-6648b84ca2005b37
bzrlib/tests/test_inv.py testinv.py-20050722220913-1dc326138d1a5892
doc/en/release-notes/bzr-2.5.txt bzr2.5.txt-20110708125756-587p0hpw7oke4h05-1
=== modified file 'bzrlib/inventory.py'
--- a/bzrlib/inventory.py 2011-06-14 02:21:41 +0000
+++ b/bzrlib/inventory.py 2011-07-13 14:30:50 +0000
@@ -1490,8 +1490,8 @@
if entry.kind == 'directory':
directories_to_expand.add(entry.file_id)
interesting.add(entry.parent_id)
- children_of_parent_id.setdefault(entry.parent_id, []
- ).append(entry.file_id)
+ children_of_parent_id.setdefault(entry.parent_id, set()
+ ).add(entry.file_id)
# Now, interesting has all of the direct parents, but not the
# parents of those parents. It also may have some duplicates with
@@ -1505,8 +1505,8 @@
next_parents = set()
for entry in self._getitems(remaining_parents):
next_parents.add(entry.parent_id)
- children_of_parent_id.setdefault(entry.parent_id, []
- ).append(entry.file_id)
+ children_of_parent_id.setdefault(entry.parent_id, set()
+ ).add(entry.file_id)
# Remove any search tips we've already processed
remaining_parents = next_parents.difference(interesting)
interesting.update(remaining_parents)
@@ -1525,8 +1525,8 @@
for entry in self._getitems(next_file_ids):
if entry.kind == 'directory':
directories_to_expand.add(entry.file_id)
- children_of_parent_id.setdefault(entry.parent_id, []
- ).append(entry.file_id)
+ children_of_parent_id.setdefault(entry.parent_id, set()
+ ).add(entry.file_id)
return interesting, children_of_parent_id
def filter(self, specific_fileids):
=== modified file 'bzrlib/tests/test_inv.py'
--- a/bzrlib/tests/test_inv.py 2011-05-19 14:42:05 +0000
+++ b/bzrlib/tests/test_inv.py 2011-07-13 14:23:59 +0000
@@ -1393,6 +1393,26 @@
self.assertEqual([u'ch\xefld'],
sorted(ie_dir._children.keys()))
+ def test_filter_change_in_renamed_subfolder(self):
+ inv = Inventory('tree-root')
+ src_ie = inv.add_path('src', 'directory', 'src-id')
+ inv.add_path('src/sub/', 'directory', 'sub-id')
+ a_ie = inv.add_path('src/sub/a', 'file', 'a-id')
+ a_ie.text_sha1 = osutils.sha_string('content\n')
+ a_ie.text_size = len('content\n')
+ chk_bytes = self.get_chk_bytes()
+ inv = CHKInventory.from_inventory(chk_bytes, inv)
+ inv = inv.create_by_apply_delta([
+ ("src/sub/a", "src/sub/a", "a-id", a_ie),
+ ("src", "src2", "src-id", src_ie),
+ ], 'new-rev-2')
+ new_inv = inv.filter(['a-id', 'src-id'])
+ self.assertEqual([
+ ('', 'tree-root'),
+ ('src', 'src-id'),
+ ('src/sub', 'sub-id'),
+ ('src/sub/a', 'a-id'),
+ ], [(path, ie.file_id) for path, ie in new_inv.iter_entries()])
class TestCHKInventoryExpand(tests.TestCaseWithMemoryTransport):
=== modified file 'doc/en/release-notes/bzr-2.5.txt'
--- a/doc/en/release-notes/bzr-2.5.txt 2011-07-15 15:12:52 +0000
+++ b/doc/en/release-notes/bzr-2.5.txt 2011-07-18 12:21:34 +0000
@@ -41,6 +41,11 @@
.. Fixes for situations where bzr would previously crash or give incorrect
or undesirable results.
+* A call to CHKInventory's filter-method will not result in a
+ DuplicateFileId error, if you move a subfolder and change a file in
+ that subfolder.
+ (Bastian Bowe, #809901)
+
* TreeTransformBase.fixup_new_roots no longer forces trees to have a root, so
operations that use it, like merge, can now create trees without a root.
(Aaron Bentley)
More information about the bazaar-commits
mailing list