Rev 2497: Move unknown detection in long status into the delta creation, saving a tree-scan. in http://bazaar.launchpad.net/~bzr/bzr/dirstate
Robert Collins
robertc at robertcollins.net
Fri Mar 2 04:41:19 GMT 2007
At http://bazaar.launchpad.net/~bzr/bzr/dirstate
------------------------------------------------------------
revno: 2497
revision-id: robertc at robertcollins.net-20070302044012-otqrdw1uhxrw3ar7
parent: robertc at robertcollins.net-20070302034756-kkqil9dftr9t14sv
committer: Robert Collins <robertc at robertcollins.net>
branch nick: dirstate.dogfood
timestamp: Fri 2007-03-02 15:40:12 +1100
message:
Move unknown detection in long status into the delta creation, saving a tree-scan.
modified:
bzrlib/delta.py delta.py-20050729221636-54cf14ef94783d0a
bzrlib/status.py status.py-20050505062338-431bfa63ec9b19e6
bzrlib/tests/blackbox/test_status.py teststatus.py-20050712014354-508855eb9f29f7dc
bzrlib/tests/intertree_implementations/test_compare.py test_compare.py-20060724101752-09ysswo1a92uqyoz-2
bzrlib/tree.py tree.py-20050309040759-9d5f2496be663e77
=== modified file 'bzrlib/delta.py'
--- a/bzrlib/delta.py 2007-03-02 03:47:56 +0000
+++ b/bzrlib/delta.py 2007-03-02 04:40:12 +0000
@@ -191,6 +191,10 @@
else:
show_list(self.unchanged, 'S')
+ if self.unversioned:
+ print >>to_file, 'unknown:'
+ show_list(self.unversioned)
+
@deprecated_function(zero_nine)
def compare_trees(old_tree, new_tree, want_unchanged=False,
@@ -217,7 +221,7 @@
specific_files, extra_trees=extra_trees,
want_unversioned=want_unversioned):
if versioned == (False, False):
- delta.unversioned.append((path, kind[1]))
+ delta.unversioned.append((path, None, kind[1]))
continue
if not include_root and (None, None) == parent_id:
continue
=== modified file 'bzrlib/status.py'
--- a/bzrlib/status.py 2007-02-26 01:13:04 +0000
+++ b/bzrlib/status.py 2007-03-02 04:40:12 +0000
@@ -148,18 +148,21 @@
reporter = _mod_delta.ChangeReporter(old.inventory,
output_file=to_file)
_mod_delta.report_changes(changes, reporter)
+ short_status_letter = '? '
+ list_paths('unknown', new.unknowns(), specific_files, to_file,
+ short_status_letter)
else:
delta = new.changes_from(old, want_unchanged=show_unchanged,
- specific_files=specific_files)
+ specific_files=specific_files,
+ want_unversioned=True)
+ # filter out unknown files. We may want a tree method for
+ # this
+ delta.unversioned = [unversioned for unversioned in
+ delta.unversioned if not new.is_ignored(unversioned[0])]
delta.show(to_file,
show_ids=show_ids,
show_unchanged=show_unchanged,
- short_status=short)
- short_status_letter = '? '
- if not short:
- short_status_letter = ''
- list_paths('unknown', new.unknowns(), specific_files, to_file,
- short_status_letter)
+ short_status=False)
conflict_title = False
# show the new conflicts only for now. XXX: get them from the delta.
for conflict in new.conflicts():
=== modified file 'bzrlib/tests/blackbox/test_status.py'
--- a/bzrlib/tests/blackbox/test_status.py 2007-03-01 05:34:39 +0000
+++ b/bzrlib/tests/blackbox/test_status.py 2007-03-02 04:40:12 +0000
@@ -168,7 +168,7 @@
self.assertStatus([
'unknown:\n',
' bye.c\n',
- ' dir2\n',
+ ' dir2/\n',
' directory/hello.c\n'
],
wt)
@@ -204,7 +204,7 @@
tof.seek(0)
self.assertEquals(tof.readlines(),
['unknown:\n',
- ' dir2\n'
+ ' dir2/\n'
])
tof = StringIO()
show_tree_status(wt, specific_files=['dir2'], to_file=tof, short=True)
=== modified file 'bzrlib/tests/intertree_implementations/test_compare.py'
--- a/bzrlib/tests/intertree_implementations/test_compare.py 2007-03-02 03:47:56 +0000
+++ b/bzrlib/tests/intertree_implementations/test_compare.py 2007-03-02 04:40:12 +0000
@@ -294,7 +294,7 @@
tree2.add(['a', 'c'], ['a-id', 'c-id'])
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()
self.assertEqual([], d.added)
self.assertEqual([(u'a', 'a-id', 'file', True, False),
(u'c', 'c-id', 'file', True, False)], d.modified)
@@ -319,8 +319,8 @@
self.assertEqual([], d.removed)
self.assertEqual([], d.renamed)
self.assertEqual([], d.unchanged)
- self.assertEqual([(u'dir', 'directory'), (u'file', 'file'),
- (u'link', 'symlink')], d.unversioned)
+ self.assertEqual([(u'dir', None, 'directory'), (u'file', None, 'file'),
+ (u'link', None, 'symlink')], d.unversioned)
class TestIterChanges(TestCaseWithTwoTrees):
=== modified file 'bzrlib/tree.py'
--- a/bzrlib/tree.py 2007-03-02 03:47:56 +0000
+++ b/bzrlib/tree.py 2007-03-02 04:40:12 +0000
@@ -105,6 +105,10 @@
"""
return []
+ def extras(self):
+ """For trees that can have unversioned files, return all such paths."""
+ return []
+
def get_parent_ids(self):
"""Get the parent ids for this tree.
@@ -558,7 +562,10 @@
# All files are unversioned, so just return an empty delta
# _compare_trees would think we want a complete delta
result = delta.TreeDelta()
- result.unversioned = list(specific_files)
+ fake_entry = InventoryFile('unused', 'unused', 'unused')
+ result.unversioned = [(path, None,
+ self.target._comparison_data(fake_entry, path)[0]) for path in
+ specific_files]
return result
return delta._compare_trees(self.source, self.target, want_unchanged,
specific_files, include_root, extra_trees=extra_trees,
More information about the bazaar-commits
mailing list