Rev 5904: (jelmer) Only reset the ignores on the unlock of the last lock on a tree, in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Fri May 20 14:19:53 UTC 2011


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

------------------------------------------------------------
revno: 5904 [merge]
revision-id: pqm at pqm.ubuntu.com-20110520141950-6xozwjkmcb90y45l
parent: pqm at pqm.ubuntu.com-20110520132835-3rf01eu5mbkz3zos
parent: jelmer at samba.org-20110520105109-lokefx7tejjixkol
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2011-05-20 14:19:50 +0000
message:
  (jelmer) Only reset the ignores on the unlock of the last lock on a tree,
   not every unlock. (Jelmer Vernooij)
modified:
  bzrlib/plugins/weave_fmt/workingtree.py workingtree_2.py-20110303111903-b6uksp28mf3oo3vp-1
  bzrlib/tests/test_workingtree_4.py test_workingtree_4.p-20070223025758-531n3tznl3zacv2o-1
  bzrlib/workingtree_3.py        workingtree_3.py-20110503234428-nwa1nw7zfdd0hrw8-1
  bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
=== modified file 'bzrlib/plugins/weave_fmt/workingtree.py'
--- a/bzrlib/plugins/weave_fmt/workingtree.py	2011-05-04 22:38:14 +0000
+++ b/bzrlib/plugins/weave_fmt/workingtree.py	2011-05-20 10:51:09 +0000
@@ -174,11 +174,10 @@
             raise
 
     def unlock(self):
-        # do non-implementation specific cleanup
-        self._cleanup()
-
         # we share control files:
         if self._control_files._lock_count == 3:
+            # do non-implementation specific cleanup
+            self._cleanup()
             # _inventory_is_modified is always False during a read lock.
             if self._inventory_is_modified:
                 self.flush()

=== modified file 'bzrlib/tests/test_workingtree_4.py'
--- a/bzrlib/tests/test_workingtree_4.py	2011-05-20 12:37:24 +0000
+++ b/bzrlib/tests/test_workingtree_4.py	2011-05-20 14:19:50 +0000
@@ -57,6 +57,22 @@
         finally:
             state.unlock()
 
+    def test_resets_ignores_on_last_unlock(self):
+        # Only the last unlock call will actually reset the
+        # ignores. (bug #785671)
+        tree = self.make_workingtree()
+        tree.lock_read()
+        try:
+            tree.lock_read()
+            try:
+                tree.is_ignored("foo")
+            finally:
+                tree.unlock()
+            self.assertIsNot(None, tree._ignoreglobster)
+        finally:
+            tree.unlock()
+        self.assertIs(None, tree._ignoreglobster)
+
     def test_uses_lockdir(self):
         """WorkingTreeFormat4 uses its own LockDir:
 

=== modified file 'bzrlib/workingtree_3.py'
--- a/bzrlib/workingtree_3.py	2011-05-03 23:54:46 +0000
+++ b/bzrlib/workingtree_3.py	2011-05-20 10:49:09 +0000
@@ -72,9 +72,9 @@
         return [('trees', self.last_revision())]
 
     def unlock(self):
-        # do non-implementation specific cleanup
-        self._cleanup()
         if self._control_files._lock_count == 1:
+           # do non-implementation specific cleanup
+            self._cleanup()
             # _inventory_is_modified is always False during a read lock.
             if self._inventory_is_modified:
                 self.flush()

=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py	2011-05-19 18:20:37 +0000
+++ b/bzrlib/workingtree_4.py	2011-05-20 10:49:09 +0000
@@ -1193,10 +1193,10 @@
 
     def unlock(self):
         """Unlock in format 4 trees needs to write the entire dirstate."""
-        # do non-implementation specific cleanup
-        self._cleanup()
-
         if self._control_files._lock_count == 1:
+            # do non-implementation specific cleanup
+            self._cleanup()
+
             # eventually we should do signature checking during read locks for
             # dirstate updates.
             if self._control_files._lock_mode == 'w':




More information about the bazaar-commits mailing list