Rev 2414: reference-trees in dirstate pass all tests. in http://sourcefrog.net/bzr/dirstate-plus-subtree

Martin Pool mbp at sourcefrog.net
Mon Feb 26 14:48:01 GMT 2007


At http://sourcefrog.net/bzr/dirstate-plus-subtree

------------------------------------------------------------
revno: 2414
revision-id: mbp at sourcefrog.net-20070226144759-5xfdve14d83esg7u
parent: mbp at sourcefrog.net-20070226142446-sfvznepsaggqnril
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: dirstate-plus-subtree
timestamp: Tue 2007-02-27 01:47:59 +1100
message:
  reference-trees in dirstate pass all tests.
  
  _iter_changes crudely changed not to be an iterator, so it can hold the
  lock for the whole time.
  
  Add DirStateRevisionTree.kind()
modified:
  bzrlib/tree.py                 tree.py-20050309040759-9d5f2496be663e77
  bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
  bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
=== modified file 'bzrlib/tree.py'
--- a/bzrlib/tree.py	2007-02-26 14:24:46 +0000
+++ b/bzrlib/tree.py	2007-02-26 14:47:59 +0000
@@ -163,7 +163,8 @@
                 yield path, entry
 
     def kind(self, file_id):
-        raise NotImplementedError("subclasses must implement kind")
+        raise NotImplementedError("Tree subclass %s must implement kind"
+            % self.__class__.__name__)
 
     def get_reference_revision(self, entry, path=None):
         raise NotImplementedError("Tree subclass %s must implement "

=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py	2007-02-26 04:44:45 +0000
+++ b/bzrlib/workingtree.py	2007-02-26 14:47:59 +0000
@@ -483,8 +483,8 @@
         """
         file_id = osutils.safe_file_id(file_id)
         basis = self.basis_tree()
-        changes = self._iter_changes(basis, True, [self.id2path(file_id)],
-            require_versioned=True).next()
+        changes = iter(self._iter_changes(basis, True, [self.id2path(file_id)],
+            require_versioned=True)).next()
         changed_content, kind = changes[2], changes[6]
         if not changed_content:
             return basis.annotate_iter(file_id)

=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py	2007-02-26 14:24:46 +0000
+++ b/bzrlib/workingtree_4.py	2007-02-26 14:47:59 +0000
@@ -442,6 +442,7 @@
                 result.append(key[2])
         return iter(result)
 
+    @needs_read_lock
     def kind(self, file_id):
         # The kind of a file is whatever it actually is on disk, except that 
         # tree-references need to be reported as such rather than as the
@@ -1338,6 +1339,10 @@
             return None
         return ie.executable
 
+    @needs_read_lock
+    def kind(self, file_id):
+        return self.inventory[file_id].kind
+
     def list_files(self, include_root=False):
         # We use a standard implementation, because DirStateRevisionTree is
         # dealing with one of the parents of the current state




More information about the bazaar-commits mailing list