Rev 4851: (vila) Merge 2.0 into 2.1 including fix for bug #494221 in file:///home/pqm/archives/thelove/bzr/2.1/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Jul 13 15:09:31 BST 2010


At file:///home/pqm/archives/thelove/bzr/2.1/

------------------------------------------------------------
revno: 4851 [merge]
revision-id: pqm at pqm.ubuntu.com-20100713140929-it8pi3wmf2z52vog
parent: pqm at pqm.ubuntu.com-20100712103549-xsbgzawpwahtlxc1
parent: v.ladeuil+lp at free.fr-20100713132538-5ws89zzbtmi4fh8l
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.1
timestamp: Tue 2010-07-13 15:09:29 +0100
message:
  (vila) Merge 2.0 into 2.1 including fix for bug #494221
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-07-02 13:55:21 +0000
+++ b/NEWS	2010-07-13 13:25:38 +0000
@@ -24,6 +24,9 @@
   way which should help avoid problems with concurrent writers.
   (Vincent Ladeuil, #525571)
 
+* 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)
 
@@ -506,6 +509,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-11-18 15:47:16 +0000
+++ b/bzrlib/tests/test_workingtree_4.py	2010-07-13 13:25:38 +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	2010-02-17 17:11:16 +0000
+++ b/bzrlib/workingtree_4.py	2010-07-13 13:25:38 +0000
@@ -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