Rev 2937: Fix Inventory.copy() and add a test for it. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Wed Oct 24 18:19:22 BST 2007
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 2937
revision-id: pqm at pqm.ubuntu.com-20071024171920-7ow21d7v5crrxdc4
parent: pqm at pqm.ubuntu.com-20071024124917-xb75eckyxx6vkrlg
parent: jelmer at samba.org-20071024152918-n107qoussymup0q6
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2007-10-24 18:19:20 +0100
message:
Fix Inventory.copy() and add a test for it.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/inventory.py inventory.py-20050309040759-6648b84ca2005b37
bzrlib/tests/inventory_implementations/basics.py basics.py-20070903044446-kdjwbiu1p1zi9phs-1
------------------------------------------------------------
revno: 2935.2.1
merged: jelmer at samba.org-20071024152918-n107qoussymup0q6
parent: pqm at pqm.ubuntu.com-20071024090631-gwml8hkp57feuoy3
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: bzr.dev
timestamp: Wed 2007-10-24 17:29:18 +0200
message:
Fix Inventory.copy() and add a test for it.
=== modified file 'NEWS'
--- a/NEWS 2007-10-24 12:06:29 +0000
+++ b/NEWS 2007-10-24 17:19:20 +0000
@@ -147,6 +147,8 @@
some other exceptions on Python 2.5.
(Martin Pool, #144633)
+ * Fix ``Inventory.copy()`` and add test for it. (Jelmer Vernooij)
+
* Handles default value for ListOption in cmd_commit.
(Vincent Ladeuil, #140432)
=== modified file 'bzrlib/inventory.py'
--- a/bzrlib/inventory.py 2007-10-16 17:37:43 +0000
+++ b/bzrlib/inventory.py 2007-10-24 15:29:18 +0000
@@ -951,7 +951,7 @@
other = Inventory(entries.next()[1].file_id)
# copy recursively so we know directories will be added before
# their children. There are more efficient ways than this...
- for path, entry in entries():
+ for path, entry in entries:
other.add(entry.copy())
return other
=== modified file 'bzrlib/tests/inventory_implementations/basics.py'
--- a/bzrlib/tests/inventory_implementations/basics.py 2007-09-20 07:03:33 +0000
+++ b/bzrlib/tests/inventory_implementations/basics.py 2007-10-24 15:29:18 +0000
@@ -65,6 +65,16 @@
self.assertEqual('hello-id', ie.file_id)
self.assertEqual('file', ie.kind)
+ def test_copy(self):
+ """Make sure copy() works and creates a deep copy."""
+ inv = self.make_inventory(root_id='some-tree-root')
+ ie = inv.add_path('hello', 'file', 'hello-id')
+ inv2 = inv.copy()
+ inv.root.file_id = 'some-new-root'
+ ie.name = 'file2'
+ self.assertEqual('some-tree-root', inv2.root.file_id)
+ self.assertEqual('hello', inv2['hello-id'].name)
+
def test_is_root(self):
"""Ensure our root-checking code is accurate."""
inv = self.make_inventory('TREE_ROOT')
More information about the bazaar-commits
mailing list