Rev 4752: (vila) Ensure we don't try to remove entries twice from the in-memory in file:///home/pqm/archives/thelove/bzr/2.0/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Tue Jul 13 13:04:15 BST 2010
At file:///home/pqm/archives/thelove/bzr/2.0/
------------------------------------------------------------
revno: 4752 [merge]
revision-id: pqm at pqm.ubuntu.com-20100713120413-c0euzhlqz4aenrye
parent: pqm at pqm.ubuntu.com-20100528201811-icg1xs1r43knuodl
parent: v.ladeuil+lp at free.fr-20100713103039-96ypyh212i7soruz
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.0
timestamp: Tue 2010-07-13 13:04:13 +0100
message:
(vila) Ensure we don't try to remove entries twice from the in-memory
inventory. (Vincent Ladeuil)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/tests/test_workingtree_4.py test_workingtree_4.p-20070223025758-531n3tznl3zacv2o-1
bzrlib/workingtree_4.py workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
=== modified file 'NEWS'
--- a/NEWS 2010-05-28 17:59:55 +0000
+++ b/NEWS 2010-07-13 10:21:19 +0000
@@ -26,6 +26,9 @@
permissions as ``.bzr`` directory on a POSIX OS.
(Parth Malwankar, #262450)
+* Don't traceback trying to unversion children files of an already
+ unversioned directory. (Vincent Ladeuil, #494221)
+
* Raise ValueError instead of a string exception.
(John Arbash Meinel, #586926)
=== modified file 'bzrlib/tests/test_workingtree_4.py'
--- a/bzrlib/tests/test_workingtree_4.py 2009-08-26 03:20:32 +0000
+++ b/bzrlib/tests/test_workingtree_4.py 2010-07-13 10:30:39 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005, 2006 Canonical Ltd
+# Copyright (C) 2007-2010 Canonical Ltd
# Authors: Robert Collins <robert.collins at canonical.com>
#
# This program is free software; you can redistribute it and/or modify
@@ -761,3 +761,23 @@
('', [(('', 'dir', 'dir-id'), ['d', 'd'])]),
('dir', [(('dir', 'file', 'file-id'), ['a', 'f'])]),
], self.get_simple_dirblocks(state))
+
+
+class TestInventoryCoherency(TestCaseWithTransport):
+
+ def test_inventory_is_synced_when_unversioning_a_dir(self):
+ """Unversioning the root of a subtree unversions the entire subtree."""
+ tree = self.make_branch_and_tree('.')
+ self.build_tree(['a/', 'a/b', 'c/'])
+ tree.add(['a', 'a/b', 'c'], ['a-id', 'b-id', 'c-id'])
+ # within a lock unversion should take effect
+ tree.lock_write()
+ self.addCleanup(tree.unlock)
+ # Force access to the in memory inventory to trigger bug #494221: try
+ # maintaining the in-memory inventory
+ inv = tree.inventory
+ self.assertTrue(inv.has_id('a-id'))
+ self.assertTrue(inv.has_id('b-id'))
+ tree.unversion(['a-id', 'b-id'])
+ self.assertFalse(inv.has_id('a-id'))
+ self.assertFalse(inv.has_id('b-id'))
=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py 2009-09-30 21:38:49 +0000
+++ b/bzrlib/workingtree_4.py 2010-07-13 10:21:19 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005, 2006, 2007, 2008, 2009 Canonical Ltd
+# Copyright (C) 2007-2010 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -1236,7 +1236,8 @@
# have to change the legacy inventory too.
if self._inventory is not None:
for file_id in file_ids:
- self._inventory.remove_recursive_id(file_id)
+ if self._inventory.has_id(file_id):
+ self._inventory.remove_recursive_id(file_id)
@needs_tree_write_lock
def rename_one(self, from_rel, to_rel, after=False):
More information about the bazaar-commits
mailing list