Rev 2332: Rename want_unversioned to want_unknown for InterTree.compare. in file:///home/robertc/source/baz/dirstate2/

Robert Collins robertc at robertcollins.net
Mon Mar 12 03:54:27 GMT 2007


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

------------------------------------------------------------
revno: 2332
revision-id: robertc at robertcollins.net-20070312035424-swyf5foev6otm12f
parent: robertc at robertcollins.net-20070310045030-gse5bj0dshxlfgox
committer: Robert Collins <robertc at robertcollins.net>
branch nick: dirstate2
timestamp: Mon 2007-03-12 14:54:24 +1100
message:
  Rename want_unversioned to want_unknown for InterTree.compare.
modified:
  bzrlib/delta.py                delta.py-20050729221636-54cf14ef94783d0a
  bzrlib/status.py               status.py-20050505062338-431bfa63ec9b19e6
  bzrlib/tests/intertree_implementations/test_compare.py test_compare.py-20060724101752-09ysswo1a92uqyoz-2
  bzrlib/tests/test_tree.py      test_tree.py-20060724065232-khgrr0vvmt6ih0mi-1
  bzrlib/tree.py                 tree.py-20050309040759-9d5f2496be663e77
  bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
=== modified file 'bzrlib/delta.py'
--- a/bzrlib/delta.py	2007-03-06 21:45:51 +0000
+++ b/bzrlib/delta.py	2007-03-12 03:54:24 +0000
@@ -211,7 +211,7 @@
 
 def _compare_trees(old_tree, new_tree, want_unchanged, specific_files,
                    include_root, extra_trees=None,
-                   want_unversioned=False):
+                   want_unknown=False):
     """Worker function that implements Tree.changes_from."""
     delta = TreeDelta()
     # mutter('start compare_trees')
@@ -219,7 +219,7 @@
     for (file_id, path, content_change, versioned, parent_id, name, kind,
          executable) in new_tree._iter_changes(old_tree, want_unchanged,
             specific_files, extra_trees=extra_trees,
-            want_unversioned=want_unversioned):
+            want_unknown=want_unknown):
         if versioned == (False, False):
             delta.unversioned.append((path[1], None, kind[1]))
             continue

=== modified file 'bzrlib/status.py'
--- a/bzrlib/status.py	2007-03-05 03:10:21 +0000
+++ b/bzrlib/status.py	2007-03-12 03:54:24 +0000
@@ -144,14 +144,14 @@
             _raise_if_nonexistent(specific_files, old, new)
             if short:
                 changes = new._iter_changes(old, show_unchanged, specific_files,
-                    require_versioned=False, want_unversioned=True)
+                    require_versioned=False, want_unknown=True)
                 reporter = _mod_delta.ChangeReporter(output_file=to_file,
                     unversioned_filter=new.is_ignored)
                 _mod_delta.report_changes(changes, reporter)
             else:
                 delta = new.changes_from(old, want_unchanged=show_unchanged,
                                       specific_files=specific_files,
-                                      want_unversioned=True)
+                                      want_unknown=True)
                 # filter out unknown files. We may want a tree method for
                 # this
                 delta.unversioned = [unversioned for unversioned in

=== modified file 'bzrlib/tests/intertree_implementations/test_compare.py'
--- a/bzrlib/tests/intertree_implementations/test_compare.py	2007-03-09 01:52:01 +0000
+++ b/bzrlib/tests/intertree_implementations/test_compare.py	2007-03-12 03:54:24 +0000
@@ -297,7 +297,7 @@
             specific_files=['d'],
             require_versioned=True)
 
-    def test_default_ignores_unversioned_files(self):
+    def test_default_ignores_unknown_files(self):
         tree1 = self.make_branch_and_tree('tree1')
         tree2 = self.make_to_branch_and_tree('tree2')
         tree2.set_root_id(tree1.get_root_id())
@@ -316,7 +316,7 @@
         self.assertEqual([], d.unchanged)
         self.assertEqual([], d.unversioned)
 
-    def test_unversioned_paths_in_tree(self):
+    def test_unknown_paths_in_tree(self):
         tree1 = self.make_branch_and_tree('tree1')
         tree2 = self.make_to_branch_and_tree('tree2')
         tree2.set_root_id(tree1.get_root_id())
@@ -327,7 +327,7 @@
         # except ???:
         #   links_supported = False
         tree1, tree2 = self.mutable_trees_to_test_trees(tree1, tree2)
-        d = self.intertree_class(tree1, tree2).compare(want_unversioned=True)
+        d = self.intertree_class(tree1, tree2).compare(want_unknown=True)
         self.assertEqual([], d.added)
         self.assertEqual([], d.modified)
         self.assertEqual([], d.removed)
@@ -476,8 +476,8 @@
                (parent, parent), (name, name), (kind, kind),
                (executable, executable))
 
-    def unversioned(self, tree, path):
-        """Create an unversioned result."""
+    def unknown(self, tree, path):
+        """Create an unknown result."""
         _, basename = os.path.split(path)
         kind = file_kind(tree.abspath(path))
         return (None, (None, path), True, (False, False), (None, None),
@@ -766,13 +766,13 @@
         self.addCleanup(tree2.unlock)
         # this should filter correctly from above
         self.assertEqual([self.added(tree2, 'subtree-id')],
-            self.do_iter_changes(tree1, tree2, want_unversioned=True))
+            self.do_iter_changes(tree1, tree2, want_unknown=True))
         # and when the path is named
         self.assertEqual([self.added(tree2, 'subtree-id')],
             self.do_iter_changes(tree1, tree2, specific_files=['sub'],
-                want_unversioned=True))
+                want_unknown=True))
 
-    def test_default_ignores_unversioned_files(self):
+    def test_default_ignores_unknown_files(self):
         tree1 = self.make_branch_and_tree('tree1')
         tree2 = self.make_to_branch_and_tree('tree2')
         tree2.set_root_id(tree1.get_root_id())
@@ -788,14 +788,14 @@
         self.addCleanup(tree2.unlock)
 
         # We should ignore the fact that 'b' exists in tree-2
-        # because the want_unversioned parameter was not given.
+        # because the want_unknown parameter was not given.
         expected = sorted([
             self.content_changed(tree2, 'a-id'),
             self.content_changed(tree2, 'c-id'),
             ])
         self.assertEqual(expected, self.do_iter_changes(tree1, tree2))
 
-    def test_unversioned_paths_in_tree(self):
+    def test_unknown_paths_in_tree(self):
         tree1 = self.make_branch_and_tree('tree1')
         tree2 = self.make_to_branch_and_tree('tree2')
         tree2.set_root_id(tree1.get_root_id())
@@ -811,16 +811,16 @@
         tree2.lock_read()
         self.addCleanup(tree2.unlock)
         expected = [
-            self.unversioned(tree2, 'file'),
-            self.unversioned(tree2, 'dir'),
+            self.unknown(tree2, 'file'),
+            self.unknown(tree2, 'dir'),
             ]
         if links_supported:
-            expected.append(self.unversioned(tree2, 'link'))
+            expected.append(self.unknown(tree2, 'link'))
         expected = sorted(expected)
         self.assertEqual(expected, self.do_iter_changes(tree1, tree2,
-            want_unversioned=True))
+            want_unknown=True))
 
-    def test_unversioned_paths_in_tree_specific_files(self):
+    def test_unknown_paths_in_tree_specific_files(self):
         tree1 = self.make_branch_and_tree('tree1')
         tree2 = self.make_to_branch_and_tree('tree2')
         self.build_tree(['tree2/file', 'tree2/dir/'])
@@ -835,20 +835,20 @@
         tree2.lock_read()
         self.addCleanup(tree2.unlock)
         expected = [
-            self.unversioned(tree2, 'file'),
-            self.unversioned(tree2, 'dir'),
+            self.unknown(tree2, 'file'),
+            self.unknown(tree2, 'dir'),
             ]
         specific_files=['file', 'dir']
         if links_supported:
-            expected.append(self.unversioned(tree2, 'link'))
+            expected.append(self.unknown(tree2, 'link'))
             specific_files.append('link')
         expected = sorted(expected)
         self.assertEqual(expected, self.do_iter_changes(tree1, tree2,
             specific_files=specific_files, require_versioned=False,
-            want_unversioned=True))
+            want_unknown=True))
 
-    def test_unversioned_paths_in_target_matching_source_old_names(self):
-        # its likely that naive implementations of unversioned file support
+    def test_unknown_paths_in_target_matching_source_old_names(self):
+        # its likely that naive implementations of unknown file support
         # will fail if the path was versioned, but is not any more, 
         # due to a rename, not due to unversioning it.
         # That is, if the old tree has a versioned file 'foo', and
@@ -880,35 +880,35 @@
         expected = [
             self.renamed(tree1, tree2, 'dir-id', False),
             self.renamed(tree1, tree2, 'file-id', True),
-            self.unversioned(tree2, 'file'),
-            self.unversioned(tree2, 'dir'),
+            self.unknown(tree2, 'file'),
+            self.unknown(tree2, 'dir'),
             ]
         specific_files=['file', 'dir']
         if links_supported:
             expected.append(self.renamed(tree1, tree2, 'link-id', False))
-            expected.append(self.unversioned(tree2, 'link'))
+            expected.append(self.unknown(tree2, 'link'))
             specific_files.append('link')
         expected = sorted(expected)
         # run once with, and once without specific files, to catch
         # potentially different code paths.
         self.assertEqual(expected, self.do_iter_changes(tree1, tree2,
             require_versioned=False,
-            want_unversioned=True))
+            want_unknown=True))
         self.assertEqual(expected, self.do_iter_changes(tree1, tree2,
             specific_files=specific_files, require_versioned=False,
-            want_unversioned=True))
+            want_unknown=True))
 
-    def test_unversioned_subtree_only_emits_root(self):
+    def test_unknown_subtree_only_emits_root(self):
         tree1 = self.make_branch_and_tree('tree1')
         tree2 = self.make_to_branch_and_tree('tree2')
         tree2.set_root_id(tree1.get_root_id())
         self.build_tree(['tree2/dir/', 'tree2/dir/file'])
         tree1, tree2 = self.mutable_trees_to_test_trees(tree1, tree2)
         expected = [
-            self.unversioned(tree2, 'dir'),
+            self.unknown(tree2, 'dir'),
             ]
         self.assertEqual(expected, self.do_iter_changes(tree1, tree2,
-            want_unversioned=True))
+            want_unknown=True))
 
     def make_trees_with_symlinks(self):
         tree1 = self.make_branch_and_tree('tree1')
@@ -969,14 +969,14 @@
             self.kind_changed(tree1, tree2, 'fromfile'),
             self.deleted(tree1, 'removed'),
             self.unchanged(tree2, 'unchanged'),
-            self.unversioned(tree2, 'unknown'),
+            self.unknown(tree2, 'unknown'),
             self.kind_changed(tree1, tree2, 'todir'),
             self.kind_changed(tree1, tree2, 'tofile'),
             ]
         expected = sorted(expected)
         self.assertEqual(expected,
             self.do_iter_changes(tree1, tree2, include_unchanged=True,
-                want_unversioned=True))
+                want_unknown=True))
 
     def test_versioned_symlinks_specific_files(self):
         tree1, tree2 = self.make_trees_with_symlinks()

=== modified file 'bzrlib/tests/test_tree.py'
--- a/bzrlib/tests/test_tree.py	2007-03-02 03:47:56 +0000
+++ b/bzrlib/tests/test_tree.py	2007-03-12 03:54:24 +0000
@@ -63,11 +63,11 @@
 
     def compare(self, want_unchanged=False, specific_files=None,
         extra_trees=None, require_versioned=False, include_root=False,
-        want_unversioned=False):
+        want_unknown=False):
         self.calls.append(
             ('compare', self.source, self.target, want_unchanged,
-             specific_files, extra_trees, require_versioned, 
-             include_root, want_unversioned)
+             specific_files, extra_trees, require_versioned,
+             include_root, want_unknown)
             )
     
     @classmethod
@@ -99,7 +99,7 @@
                 extra_trees='extra',
                 require_versioned='require',
                 include_root=True,
-                want_unversioned=True,
+                want_unknown=True,
                 )
         finally:
             InterTree._optimisers = old_optimisers

=== modified file 'bzrlib/tree.py'
--- a/bzrlib/tree.py	2007-03-07 03:09:14 +0000
+++ b/bzrlib/tree.py	2007-03-12 03:54:24 +0000
@@ -59,7 +59,7 @@
     
     def changes_from(self, other, want_unchanged=False, specific_files=None,
         extra_trees=None, require_versioned=False, include_root=False,
-        want_unversioned=False):
+        want_unknown=False):
         """Return a TreeDelta of the changes from other to this tree.
 
         :param other: A tree to compare with.
@@ -74,7 +74,7 @@
         :param require_versioned: An optional boolean (defaults to False). When
             supplied and True all the 'specific_files' must be versioned, or
             a PathsNotVersionedError will be thrown.
-        :param want_unversioned: Scan for unversioned paths.
+        :param want_unknown: Scan for unknown paths.
 
         The comparison will be performed by an InterTree object looked up on 
         self and other.
@@ -88,15 +88,15 @@
             extra_trees=extra_trees,
             require_versioned=require_versioned,
             include_root=include_root,
-            want_unversioned=want_unversioned,
+            want_unknown=want_unknown,
             )
 
     def _iter_changes(self, from_tree, include_unchanged=False,
                      specific_files=None, pb=None, extra_trees=None,
-                     require_versioned=True, want_unversioned=False):
+                     require_versioned=True, want_unknown=False):
         intertree = InterTree.get(from_tree, self)
         return intertree._iter_changes(include_unchanged, specific_files, pb,
-            extra_trees, require_versioned, want_unversioned=want_unversioned)
+            extra_trees, require_versioned, want_unknown=want_unknown)
     
     def conflicts(self):
         """Get a list of the conflicts in the tree.
@@ -556,7 +556,7 @@
     @needs_read_lock
     def compare(self, want_unchanged=False, specific_files=None,
         extra_trees=None, require_versioned=False, include_root=False,
-        want_unversioned=False):
+        want_unknown=False):
         """Return the changes from source to target.
 
         :return: A TreeDelta.
@@ -571,7 +571,7 @@
         :param require_versioned: An optional boolean (defaults to False). When
             supplied and True all the 'specific_files' must be versioned, or
             a PathsNotVersionedError will be thrown.
-        :param want_unversioned: Scan for unversioned paths.
+        :param want_unknown: Scan for unknown paths.
         """
         # NB: show_status depends on being able to pass in non-versioned files
         # and report them as unknown
@@ -592,11 +592,11 @@
             return result
         return delta._compare_trees(self.source, self.target, want_unchanged,
             specific_files, include_root, extra_trees=extra_trees,
-            want_unversioned=want_unversioned)
+            want_unknown=want_unknown)
 
     def _iter_changes(self, include_unchanged=False,
                       specific_files=None, pb=None, extra_trees=[],
-                      require_versioned=True, want_unversioned=False):
+                      require_versioned=True, want_unknown=False):
         """Generate an iterator of changes between trees.
 
         A tuple is returned:
@@ -620,8 +620,8 @@
         :param require_versioned: Raise errors.PathsNotVersionedError if a
             path in the specific_files list is not versioned in one of
             source, target or extra_trees.
-        :param want_unversioned: Should unversioned files be returned in the
-            output. An unversioned file is defined as one with (False, False)
+        :param want_unknown: Should unknown files be returned in the
+            output. An unknown file is presented as one with (False, False)
             for the versioned pair.
         """
         result = []
@@ -630,13 +630,13 @@
              lookup_trees.extend(extra_trees)
         specific_file_ids = self.target.paths2ids(specific_files,
             lookup_trees, require_versioned=require_versioned)
-        if want_unversioned:
-            all_unversioned = sorted([(p.split('/'), p) for p in self.target.extras()
+        if want_unknown:
+            all_unknowns = sorted([(p.split('/'), p) for p in self.target.unknowns()
                 if not specific_files or
                     osutils.is_inside_any(specific_files, p)])
-            all_unversioned = deque(all_unversioned)
+            all_unknowns = deque(all_unknowns)
         else:
-            all_unversioned = deque()
+            all_unknowns = deque()
         to_paths = {}
         from_entries_by_dir = list(self.source.inventory.iter_entries_by_dir(
             specific_file_ids=specific_file_ids))
@@ -650,8 +650,8 @@
         # executable it values when execute is not supported.
         fake_entry = InventoryFile('unused', 'unused', 'unused')
         for to_path, to_entry in to_entries_by_dir:
-            while all_unversioned and all_unversioned[0][0] < to_path.split('/'):
-                unversioned_path = all_unversioned.popleft()
+            while all_unknowns and all_unknowns[0][0] < to_path.split('/'):
+                unversioned_path = all_unknowns.popleft()
                 to_kind, to_executable, to_stat = \
                     self.target._comparison_data(fake_entry, unversioned_path[1])
                 yield (None, (None, unversioned_path[1]), True, (False, False),
@@ -711,9 +711,9 @@
                 yield (file_id, (from_path, to_path), changed_content,
                     versioned, parent, name, kind, executable)
 
-        while all_unversioned:
+        while all_unknowns:
             # yield any trailing unversioned paths
-            unversioned_path = all_unversioned.popleft()
+            unversioned_path = all_unknowns.popleft()
             to_kind, to_executable, to_stat = \
                 self.target._comparison_data(fake_entry, unversioned_path[1])
             yield (None, (None, unversioned_path[1]), True, (False, False),

=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py	2007-03-10 04:50:30 +0000
+++ b/bzrlib/workingtree_4.py	2007-03-12 03:54:24 +0000
@@ -1605,7 +1605,7 @@
 
     def _iter_changes(self, include_unchanged=False,
                       specific_files=None, pb=None, extra_trees=[],
-                      require_versioned=True, want_unversioned=False):
+                      require_versioned=True, want_unknown=False):
         """Return the changes from source to target.
 
         :return: An iterator that yields tuples. See InterTree._iter_changes
@@ -1621,7 +1621,7 @@
         :param require_versioned: If True, all files in specific_files must be
             versioned in one of source, target, extra_trees or
             PathsNotVersionedError is raised.
-        :param want_unversioned: Should unversioned files be returned in the
+        :param want_unknown: Should unversioned files be returned in the
             output. An unversioned file is defined as one with (False, False)
             for the versioned pair.
         """
@@ -1636,7 +1636,7 @@
             # we can't fast-path these cases (yet)
             for f in super(InterDirStateTree, self)._iter_changes(
                 include_unchanged, specific_files, pb, extra_trees,
-                require_versioned, want_unversioned=want_unversioned):
+                require_versioned, want_unknown=want_unknown):
                 yield f
             return
         parent_ids = self.target.get_parent_ids()
@@ -1993,7 +1993,7 @@
                             ((utf8_decode(result[1][0])[0]),
                              utf8_decode(result[1][1])[0]),) + result[2:]
                         yield result
-            if want_unversioned and not path_handled:
+            if want_unknown and not path_handled:
                 yield (None, (None, current_root), True, (False, False),
                     (None, None),
                     (None, splitpath(current_root)[-1]),
@@ -2182,7 +2182,7 @@
                     if advance_path and current_path_info is not None:
                         if not path_handled:
                             # unversioned in all regards
-                            if want_unversioned:
+                            if want_unknown:
                                 yield (None, (None, current_path_info[0]),
                                     True,
                                     (False, False),



More information about the bazaar-commits mailing list