Rev 5345: (vila) Merge 2.2 into bzr.dev including fixes for bug #525571 and bug in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Jul 13 23:43:12 BST 2010


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

------------------------------------------------------------
revno: 5345 [merge]
revision-id: pqm at pqm.ubuntu.com-20100713224310-irt5swwo7ajwg7e5
parent: pqm at pqm.ubuntu.com-20100713202023-2wuutybpulnqxlo9
parent: v.ladeuil+lp at free.fr-20100713212503-jwsjxmzyrcrqa0xf
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2010-07-13 23:43:10 +0100
message:
  (vila) Merge 2.2 into bzr.dev including fixes for bug #525571 and bug
  	#494221
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/config.py               config.py-20051011043216-070c74f4e9e338e8
  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-13 07:44:02 +0000
+++ b/NEWS	2010-07-13 21:25:03 +0000
@@ -51,6 +51,13 @@
 Bug Fixes
 *********
 
+* Configuration files in ``${BZR_HOME}`` are now written in an atomic
+  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)
+
 Improvements
 ************
 
@@ -1019,6 +1026,13 @@
 Bug Fixes
 *********
 
+* Configuration files in ``${BZR_HOME}`` are now written in an atomic
+  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)
 
@@ -1532,6 +1546,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/config.py'
--- a/bzrlib/config.py	2010-06-02 04:50:35 +0000
+++ b/bzrlib/config.py	2010-07-13 16:10:20 +0000
@@ -74,6 +74,7 @@
 
 import bzrlib
 from bzrlib import (
+    atomicfile,
     debug,
     errors,
     mail_client,
@@ -478,12 +479,10 @@
         return self.get_user_option('nickname')
 
     def _write_config_file(self):
-        f = file(self._get_filename(), "wb")
-        try:
-            osutils.copy_ownership_from_path(f.name)
-            self._get_parser().write(f)
-        finally:
-            f.close()
+        atomic_file = atomicfile.AtomicFile(self._get_filename())
+        self._get_parser().write(atomic_file)
+        atomic_file.commit()
+        atomic_file.close()
 
 
 class GlobalConfig(IniBasedConfig):

=== modified file 'bzrlib/tests/test_workingtree_4.py'
--- a/bzrlib/tests/test_workingtree_4.py	2010-02-04 16:06:36 +0000
+++ b/bzrlib/tests/test_workingtree_4.py	2010-07-13 16:10:20 +0000
@@ -757,3 +757,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-05-20 18:23:17 +0000
+++ b/bzrlib/workingtree_4.py	2010-07-13 16:10:20 +0000
@@ -1247,7 +1247,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