Rev 2468: Update the Tree.filter_unversioned_files docstring to reflect what the existing implementations actually do, and change the WorkingTree4 implementation to match a newly created test for it. in file:///home/robertc/source/baz/dirstate/

Robert Collins robertc at robertcollins.net
Thu Mar 1 06:19:47 GMT 2007


At file:///home/robertc/source/baz/dirstate/

------------------------------------------------------------
revno: 2468
revision-id: robertc at robertcollins.net-20070301061944-y1jw05ufqdpw4yx5
parent: robertc at robertcollins.net-20070301054630-ff4zf6s3odxfic71
committer: Robert Collins <robertc at robertcollins.net>
branch nick: dirstate
timestamp: Thu 2007-03-01 17:19:44 +1100
message:
  Update the Tree.filter_unversioned_files docstring to reflect what the existing implementations actually do, and change the WorkingTree4 implementation to match a newly created test for it.
modified:
  bzrlib/tests/workingtree_implementations/test_workingtree.py test_workingtree.py-20060203003124-817757d3e31444fb
  bzrlib/tree.py                 tree.py-20050309040759-9d5f2496be663e77
  bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
=== modified file 'bzrlib/tests/workingtree_implementations/test_workingtree.py'
--- a/bzrlib/tests/workingtree_implementations/test_workingtree.py	2007-03-01 05:18:07 +0000
+++ b/bzrlib/tests/workingtree_implementations/test_workingtree.py	2007-03-01 06:19:44 +0000
@@ -742,6 +742,7 @@
             tree.unlock()
 
     def test_path2id(self):
+        # smoke test for path2id
         tree = self.make_branch_and_tree('.')
         self.build_tree(['foo'])
         tree.add(['foo'], ['foo-id'])
@@ -750,3 +751,17 @@
         # though its probably a bad idea, it makes things work. Perhaps
         # it should raise a deprecation warning?
         self.assertEqual('foo-id', tree.path2id('foo/'))
+
+    def test_filter_unversioned_files(self):
+        # smoke test for filter_unversioned_files
+        tree = self.make_branch_and_tree('.')
+        paths = ['here-and-versioned', 'here-and-not-versioned',
+            'not-here-and-versioned', 'not-here-and-not-versioned']
+        tree.add(['here-and-versioned', 'not-here-and-versioned'],
+            kinds=['file', 'file'])
+        self.build_tree(['here-and-versioned', 'here-and-not-versioned'])
+        tree.lock_read()
+        self.addCleanup(tree.unlock)
+        self.assertEqual(
+            set(['not-here-and-not-versioned', 'here-and-not-versioned']),
+            tree.filter_unversioned_files(paths))

=== modified file 'bzrlib/tree.py'
--- a/bzrlib/tree.py	2007-03-01 05:46:30 +0000
+++ b/bzrlib/tree.py	2007-03-01 06:19:44 +0000
@@ -293,7 +293,7 @@
         pass
 
     def filter_unversioned_files(self, paths):
-        """Filter out paths that are not versioned.
+        """Filter out paths that are versioned.
 
         :return: set of paths.
         """

=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py	2007-03-01 05:18:07 +0000
+++ b/bzrlib/workingtree_4.py	2007-03-01 06:19:44 +0000
@@ -242,7 +242,7 @@
         return self._dirstate
 
     def filter_unversioned_files(self, paths):
-        """Filter out paths that are not versioned.
+        """Filter out paths that are versioned.
 
         :return: set of paths.
         """
@@ -257,7 +257,7 @@
             dirname, basename = os.path.split(path.encode('utf8'))
             _, _, _, path_is_versioned = state._get_block_entry_index(
                 dirname, basename, 0)
-            if path_is_versioned:
+            if not path_is_versioned:
                 result.add(path)
         return result
 
@@ -1489,7 +1489,7 @@
                     all_versioned = False
                     break
             if not all_versioned:
-                raise errors.PathsNotVersionedError(paths)
+                raise errors.PathsNotVersionedError(specific_files)
         # -- remove redundancy in supplied specific_files to prevent over-scanning --
         search_specific_files = set()
         for path in specific_files:
@@ -1866,12 +1866,15 @@
                         new_executable = bool(
                             stat.S_ISREG(current_path_info[3].st_mode)
                             and stat.S_IEXEC & current_path_info[3].st_mode)
-                        yield (None, current_path_info[0], True,
-                               (False, False),
-                               (None, None),
-                               (None, current_path_info[1]),
-                               (None, current_path_info[2]),
-                               (None, new_executable))
+                        pass # unversioned file support not added to the
+                        # _iter_changes api yet - breaks status amongst other
+                        # things.
+#                        yield (None, current_path_info[0], True,
+#                               (False, False),
+#                               (None, None),
+#                               (None, current_path_info[1]),
+#                               (None, current_path_info[2]),
+#                               (None, new_executable))
                     elif current_path_info is None:
                         # no path is fine: the per entry code will handle it.
                         for result in _process_entry(current_entry, current_path_info):



More information about the bazaar-commits mailing list