Rev 5427: (jameinel) Fix bug #638034, in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Sep 15 23:33:25 BST 2010


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5427 [merge]
revision-id: pqm at pqm.ubuntu.com-20100915223323-wdun3rsvmw8bfu5a
parent: pqm at pqm.ubuntu.com-20100915120235-gjrl0gmv0vxbu7b0
parent: knittl89+bzr at googlemail.com-20100915210623-3jr0ltga8z9l7jd4
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2010-09-15 23:33:23 +0100
message:
  (jameinel) Fix bug #638034,
   Inventory.entries() should handle the empty inventory. (Daniel Knittl-Frank)
modified:
  bzrlib/inventory.py            inventory.py-20050309040759-6648b84ca2005b37
  bzrlib/tests/test_inv.py       testinv.py-20050722220913-1dc326138d1a5892
=== modified file 'bzrlib/inventory.py'
--- a/bzrlib/inventory.py	2010-08-17 06:45:33 +0000
+++ b/bzrlib/inventory.py	2010-09-14 13:12:20 +0000
@@ -836,7 +836,8 @@
                 if ie.kind == 'directory':
                     descend(ie, child_path)
 
-        descend(self.root, u'')
+        if self.root is not None:
+            descend(self.root, u'')
         return accum
 
     def directories(self):

=== modified file 'bzrlib/tests/test_inv.py'
--- a/bzrlib/tests/test_inv.py	2010-08-23 17:54:07 +0000
+++ b/bzrlib/tests/test_inv.py	2010-09-15 21:06:23 +0000
@@ -589,6 +589,11 @@
         self.assertFalse(inv.is_root('TREE_ROOT'))
         self.assertFalse(inv.is_root('booga'))
 
+    def test_entries_for_empty_inventory(self):
+        """Test that entries() will not fail for an empty inventory"""
+        inv = Inventory(root_id=None)
+        self.assertEqual([], inv.entries())
+
 
 class TestInventoryEntry(TestCase):
 




More information about the bazaar-commits mailing list