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:29:42 GMT 2007
At file:///home/robertc/source/baz/dirstate2/
------------------------------------------------------------
revno: 2332
revision-id: robertc at robertcollins.net-20070312032937-8esz8pq37tccltu3
parent: robertc at robertcollins.net-20070310045030-gse5bj0dshxlfgox
committer: Robert Collins <robertc at robertcollins.net>
branch nick: dirstate2
timestamp: Mon 2007-03-12 14:29:37 +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:29:37 +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:29:37 +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:29:37 +0000
@@ -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)
@@ -766,11 +766,11 @@
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):
tree1 = self.make_branch_and_tree('tree1')
@@ -788,7 +788,7 @@
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'),
@@ -818,7 +818,7 @@
expected.append(self.unversioned(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):
tree1 = self.make_branch_and_tree('tree1')
@@ -845,7 +845,7 @@
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
@@ -893,10 +893,10 @@
# 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):
tree1 = self.make_branch_and_tree('tree1')
@@ -908,7 +908,7 @@
self.unversioned(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')
@@ -976,7 +976,7 @@
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:29:37 +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:29:37 +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:29:37 +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