Rev 2315: Add an explicit exception since tree.list_files() requires a lock (at least for dirstate in http://bazaar.launchpad.net/%7Ebzr/bzr/dirstate

John Arbash Meinel john at arbash-meinel.com
Thu Feb 15 17:19:37 GMT 2007


At http://bazaar.launchpad.net/%7Ebzr/bzr/dirstate

------------------------------------------------------------
revno: 2315
revision-id: john at arbash-meinel.com-20070215171830-7xzy2cxja9g6vclm
parent: robertc at robertcollins.net-20070215100815-sh7ng5cpouingmzz
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dirstate
timestamp: Thu 2007-02-15 11:18:30 -0600
message:
  Add an explicit exception since tree.list_files() requires a lock (at least for dirstate
modified:
  bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
-------------- next part --------------
=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py	2007-02-14 22:07:34 +0000
+++ b/bzrlib/workingtree.py	2007-02-15 17:18:30 +0000
@@ -879,6 +879,11 @@
 
         Skips the control directory.
         """
+        # list_files is an iterator, so @needs_read_lock doesn't work properly
+        # with it. So callers should be careful to always read_lock the tree.
+        if not self.is_locked():
+            raise errors.ObjectNotLocked(self)
+
         inv = self.inventory
         if include_root is True:
             yield ('', 'V', 'directory', inv.root.file_id, inv.root)



More information about the bazaar-commits mailing list