Rev 2976: Only one test failed, because it was incorrectly succeeding. in http://bzr.arbash-meinel.com/branches/bzr/0.93-dev/fast_diff_versus_empty

John Arbash Meinel john at arbash-meinel.com
Tue Nov 6 23:55:53 GMT 2007


At http://bzr.arbash-meinel.com/branches/bzr/0.93-dev/fast_diff_versus_empty

------------------------------------------------------------
revno: 2976
revision-id:john at arbash-meinel.com-20071106235537-7i20o3iwf7cb9alt
parent: john at arbash-meinel.com-20071106223311-3c3qj42y02pm9cs5
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: fast_diff_versus_empty
timestamp: Tue 2007-11-06 17:55:37 -0600
message:
  Only one test failed, because it was incorrectly succeeding.
  If the repository doesn't support nested trees, then the working tree shouldn't either.
  However, the test was only run based on the null: tree, which used a different code path.
  And that code path could *never* find nested trees.
  This changes it so that we always return False for _directory_is_tree_reference if the
  repository does not support it.
modified:
  bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
  bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
-------------- next part --------------
=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py	2007-11-03 09:39:11 +0000
+++ b/bzrlib/workingtree.py	2007-11-06 23:55:37 +0000
@@ -271,6 +271,8 @@
             # permitted to do this.
             self._set_inventory(_inventory, dirty=False)
 
+        self._setup_directory_is_tree_reference()
+
     branch = property(
         fget=lambda self: self._branch,
         doc="""The branch this WorkingTree is connected to.
@@ -980,7 +982,18 @@
             other_tree.unlock()
         other_tree.bzrdir.retire_bzrdir()
 
-    def _directory_is_tree_reference(self, relpath):
+    def _setup_directory_is_tree_reference(self):
+        if self._branch.repository._format.supports_tree_reference:
+            self._directory_is_tree_reference = \
+                self._directory_may_be_tree_reference
+        else:
+            self._directory_is_tree_reference = \
+                self._directory_is_never_tree_reference
+
+    def _directory_is_never_tree_reference(self, relpath):
+        return False
+
+    def _directory_may_be_tree_reference(self, relpath):
         # as a special case, if a directory contains control files then 
         # it's a tree reference, except that the root of the tree is not
         return relpath and osutils.isdir(self.abspath(relpath) + u"/.bzr")

=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py	2007-11-06 22:33:11 +0000
+++ b/bzrlib/workingtree_4.py	2007-11-06 23:55:37 +0000
@@ -151,6 +151,7 @@
         self._dirstate = None
         self._inventory = None
         #-------------
+        self._setup_directory_is_tree_reference()
 
     @needs_tree_write_lock
     def _add(self, files, ids, kinds):



More information about the bazaar-commits mailing list