Rev 4677: Handle the case when the specific_fileids don't exist in this revision. in http://bazaar.launchpad.net/~jameinel/bzr/2.0.1-faster-log-dir-bug374730

John Arbash Meinel john at arbash-meinel.com
Thu Sep 24 21:09:50 BST 2009


At http://bazaar.launchpad.net/~jameinel/bzr/2.0.1-faster-log-dir-bug374730

------------------------------------------------------------
revno: 4677
revision-id: john at arbash-meinel.com-20090924200936-g1iyerqko1bb6tel
parent: john at arbash-meinel.com-20090924200343-ku1e3gdasstvzoj7
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.0.1-faster-log-dir-bug374730
timestamp: Thu 2009-09-24 15:09:36 -0500
message:
  Handle the case when the specific_fileids don't exist in this revision.
-------------- next part --------------
=== modified file 'bzrlib/inventory.py'
--- a/bzrlib/inventory.py	2009-09-24 19:36:15 +0000
+++ b/bzrlib/inventory.py	2009-09-24 20:09:36 +0000
@@ -1647,10 +1647,17 @@
         other = Inventory(self.root_id)
         other.root.revision = self.root.revision
         other.revision_id = self.revision_id
-        if not interesting: # empty filter
+        if not interesting or not parent_to_children:
+            # empty filter, or filtering entrys that don't exist
+            # (if even 1 existed, then we would have populated
+            # parent_to_children with at least the tree root.)
             return other
         cache = self._fileid_to_entry_cache
-        remaining_children = collections.deque(parent_to_children[self.root_id])
+        try:
+            remaining_children = collections.deque(parent_to_children[self.root_id])
+        except:
+            import pdb; pdb.set_trace()
+            raise
         while remaining_children:
             file_id = remaining_children.popleft()
             ie = cache[file_id]

=== modified file 'bzrlib/tests/per_inventory/basics.py'
--- a/bzrlib/tests/per_inventory/basics.py	2009-09-24 18:51:41 +0000
+++ b/bzrlib/tests/per_inventory/basics.py	2009-09-24 20:09:36 +0000
@@ -332,3 +332,10 @@
             ('src/sub/a', 'a-id'),
             ('src/zz.c', 'zzc-id'),
             ], [(path, ie.file_id) for path, ie in new_inv.iter_entries()])
+
+    def test_inv_filter_entry_not_present(self):
+        inv = self.prepare_inv_with_nested_dirs()
+        new_inv = inv.filter(['not-present-id'])
+        self.assertEqual([
+            ('', 'tree-root'),
+            ], [(path, ie.file_id) for path, ie in new_inv.iter_entries()])



More information about the bazaar-commits mailing list