Rev 3788: Merge divergence with bb-core. in http://people.ubuntu.com/~robertc/baz2.0/repository
Robert Collins
robertc at robertcollins.net
Fri Nov 14 08:21:55 GMT 2008
At http://people.ubuntu.com/~robertc/baz2.0/repository
------------------------------------------------------------
revno: 3788
revision-id: robertc at robertcollins.net-20081114082151-0g1m7dkmcs1oowqj
parent: robertc at robertcollins.net-20081114081058-bf927jwcqz95sojn
parent: vila at scythe-20081114081556-jigtxmlo297i2sut
committer: Robert Collins <robertc at robertcollins.net>
branch nick: repository
timestamp: Fri 2008-11-14 19:21:51 +1100
message:
Merge divergence with bb-core.
modified:
bzrlib/inventory.py inventory.py-20050309040759-6648b84ca2005b37
bzrlib/tests/intertree_implementations/test_compare.py test_compare.py-20060724101752-09ysswo1a92uqyoz-2
bzrlib/tree.py tree.py-20050309040759-9d5f2496be663e77
------------------------------------------------------------
revno: 3768.1.17
revision-id: vila at scythe-20081114081556-jigtxmlo297i2sut
parent: vila at scythe-20081114072751-v1xchlqtpeign1b7
committer: Vincent Ladeuil <vila at scythe>
branch nick: work
timestamp: Fri 2008-11-14 18:15:56 +1000
message:
Fix the last 2 remaining failures.
* tree.py:
(InterTree.iter_changes): Still in the CHK hacks, add support for
include_unchanged, staying in O(changes) for memory comsumption.
modified:
bzrlib/tree.py tree.py-20050309040759-9d5f2496be663e77
------------------------------------------------------------
revno: 3768.1.16
revision-id: vila at scythe-20081114072751-v1xchlqtpeign1b7
parent: vila at scythe-20081114071251-cfbhtsh5gfmdzi64
committer: Vincent Ladeuil <vila at scythe>
branch nick: work
timestamp: Fri 2008-11-14 17:27:51 +1000
message:
Centralize CHK hacks.
* tree.py:
(InterTree.iter_changes): Let's do all CHK hacks in the same place
until better informed :)
* inventory.py:
(CHKInventory.iter_changes): Revert adding specific files
parameter, let's do all the hacks in the same place for now.
modified:
bzrlib/inventory.py inventory.py-20050309040759-6648b84ca2005b37
bzrlib/tree.py tree.py-20050309040759-9d5f2496be663e77
------------------------------------------------------------
revno: 3768.1.15
revision-id: vila at scythe-20081114071251-cfbhtsh5gfmdzi64
parent: vila at scythe-20081114070824-nj0ol420i5l3t3t5
parent: robertc at robertcollins.net-20081114070331-sz0m35ygkepf1115
committer: Vincent Ladeuil <vila at scythe>
branch nick: work
timestamp: Fri 2008-11-14 17:12:51 +1000
message:
merge bbc
modified:
bzrlib/inventory.py inventory.py-20050309040759-6648b84ca2005b37
------------------------------------------------------------
revno: 3768.1.14
revision-id: vila at scythe-20081114070824-nj0ol420i5l3t3t5
parent: vila at scythe-20081114054937-dn12gj50di5ov1vu
committer: Vincent Ladeuil <vila at scythe>
branch nick: work
timestamp: Fri 2008-11-14 17:08:24 +1000
message:
Still more failures due to not applicable tests.
* tests/intertree_implementations/test_compare.py:
(TestIterChanges.not_applicable_if_missing_in): Give the
explanation during test run.
(TestIterChanges.not_applicable_if_cannot_represent_unversioned):
New helper to flag not applicable tests.
(TestIterChanges.test_unversioned_paths_in_tree,
TestIterChanges.test_unversioned_paths_in_tree_specific_files,
TestIterChanges.test_unversioned_paths_in_target_matching_source_old_names,
TestIterChanges.test_similar_filenames,
TestIterChanges.test_unversioned_subtree_only_emits_root,
TestIterChanges.test_unknown_unicode,
TestIterChanges.test_unknown_empty_dir,
TestIterChanges.test_deleted_and_unknown): None of these are
applicable on revisions trees.
modified:
bzrlib/tests/intertree_implementations/test_compare.py test_compare.py-20060724101752-09ysswo1a92uqyoz-2
=== modified file 'bzrlib/inventory.py'
--- a/bzrlib/inventory.py 2008-11-14 08:10:58 +0000
+++ b/bzrlib/inventory.py 2008-11-14 08:21:51 +0000
@@ -1569,8 +1569,7 @@
for key, _ in self.id_to_entry.iteritems():
yield key[-1]
- def iter_changes(self, basis,
- specific_file_ids=None):
+ def iter_changes(self, basis):
"""Generate a Tree.iter_changes change list between this and basis.
:param basis: Another CHKInventory.
@@ -1583,11 +1582,6 @@
for key, basis_value, self_value in \
self.id_to_entry.iter_changes(basis.id_to_entry):
file_id = key[0]
- if (specific_file_ids is not None
- and not file_id in specific_file_ids):
- # CHKMap.iter_changes is clean and fast. Better filter out
- # the specific files *after* it did its job.
- continue
if basis_value is not None:
basis_entry = basis._bytes_to_entry(basis_value)
path_in_source = basis.id2path(file_id)
=== modified file 'bzrlib/tests/intertree_implementations/test_compare.py'
--- a/bzrlib/tests/intertree_implementations/test_compare.py 2008-11-14 04:32:25 +0000
+++ b/bzrlib/tests/intertree_implementations/test_compare.py 2008-11-14 07:08:24 +0000
@@ -19,7 +19,12 @@
import os
import shutil
-from bzrlib import errors, tests, workingtree_4
+from bzrlib import (
+ errors,
+ revisiontree,
+ tests,
+ workingtree_4,
+ )
from bzrlib.osutils import file_kind, has_symlinks
from bzrlib.tests import TestNotApplicable
from bzrlib.tests.intertree_implementations import TestCaseWithTwoTrees
@@ -507,7 +512,16 @@
# file status. This is normal (e.g. InterDirstateTree falls back
# to InterTree if the basis is not a DirstateRevisionTree, and
# revision trees cannot have missing files.
- raise TestNotApplicable()
+ raise TestNotApplicable('cannot represent missing files')
+
+ def not_applicable_if_cannot_represent_unversioned(self, tree):
+ if isinstance(tree, revisiontree.RevisionTree):
+ # The locked test trees conversion could not preserve the
+ # unversioned file status. This is normal (e.g. InterDirstateTree
+ # falls back to InterTree if the basis is not a
+ # DirstateRevisionTree, and revision trees cannot have unversioned
+ # files.
+ raise TestNotApplicable('cannot represent unversioned files')
def test_empty_to_abc_content(self):
tree1 = self.make_branch_and_tree('1')
@@ -849,6 +863,7 @@
else:
links_supported = False
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
+ self.not_applicable_if_cannot_represent_unversioned(tree2)
expected = [
self.unversioned(tree2, 'file'),
self.unversioned(tree2, 'dir'),
@@ -869,6 +884,7 @@
else:
links_supported = False
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
+ self.not_applicable_if_cannot_represent_unversioned(tree2)
expected = [
self.unversioned(tree2, 'file'),
self.unversioned(tree2, 'dir'),
@@ -909,6 +925,7 @@
tree1.add(['link'], ['link-id'])
tree2.add(['movedlink'], ['link-id'])
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
+ self.not_applicable_if_cannot_represent_unversioned(tree2)
root_id = tree1.path2id('')
expected = [
self.renamed(tree1, tree2, 'dir-id', False),
@@ -958,6 +975,7 @@
['a-id', 'b-id', 'c-id', 'd-id', 'a-c-id', 'e-id'])
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
+ self.not_applicable_if_cannot_represent_unversioned(tree2)
self.assertEqual([], self.do_iter_changes(tree1, tree2,
want_unversioned=True))
@@ -982,6 +1000,7 @@
tree2.set_root_id(tree1.get_root_id())
self.build_tree(['tree2/dir/', 'tree2/dir/file'])
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2)
+ self.not_applicable_if_cannot_represent_unversioned(tree2)
expected = [
self.unversioned(tree2, 'dir'),
]
@@ -1031,6 +1050,7 @@
def test_versioned_symlinks(self):
self.requireFeature(tests.SymlinkFeature)
tree1, tree2 = self.make_trees_with_symlinks()
+ self.not_applicable_if_cannot_represent_unversioned(tree2)
root_id = tree1.path2id('')
expected = [
self.unchanged(tree1, tree1.path2id('')),
@@ -1290,6 +1310,7 @@
tree2.add([u'\u03b1'], [a_id])
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
+ self.not_applicable_if_cannot_represent_unversioned(tree2)
expected = sorted([
self.unversioned(tree2, u'\u03b1/unknown_dir'),
@@ -1340,6 +1361,7 @@
self.build_tree(['tree2/a/file', 'tree2/a/dir/', 'tree2/a/dir/subfile'])
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
+ self.not_applicable_if_cannot_represent_unversioned(tree2)
expected = sorted([
self.unversioned(tree2, u'a/file'),
@@ -1407,6 +1429,7 @@
tree2.add(['a', 'c'], ['a-id', 'c-id'])
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
+ self.not_applicable_if_cannot_represent_unversioned(tree2)
expected = sorted([
self.deleted(tree1, 'b-id'),
=== modified file 'bzrlib/tree.py'
--- a/bzrlib/tree.py 2008-11-14 03:46:29 +0000
+++ b/bzrlib/tree.py 2008-11-14 08:15:56 +0000
@@ -869,9 +869,45 @@
except:
pass
else:
+ if include_unchanged:
+ changed_file_ids = []
for result in self.target.inventory.iter_changes(
- self.source.inventory, specific_file_ids=specific_file_ids):
+ self.source.inventory):
+ if (specific_file_ids is not None
+ and not result[0] in specific_file_ids):
+ # CHKMap.iter_changes is clean and fast. Better filter out
+ # the specific files *after* it did its job.
+ continue
yield result
+ if include_unchanged:
+ # Keep track of yielded results (cheaper than building the
+ # whole inventory).
+ changed_file_ids.append(result[0])
+ if include_unchanged:
+ # CHKMap avoid being O(tree), so we go to O(tree) only if
+ # required to.
+ # Now walk the whole inventory, excluding the already yielded
+ # file ids
+ def not_a_change(file_id, relpath, parent, kind, executable):
+ return (file_id,
+ (relpath, relpath), # Not renamed
+ False, # Not modified
+ (True, True), # Still versioned
+ (executable, executable))
+ changed_file_ids = set(changed_file_ids)
+ for relpath, entry in self.target.inventory.iter_entries():
+ if (specific_file_ids is not None
+ and not entry.file_id in specific_file_ids):
+ continue
+ if not entry.file_id in changed_file_ids:
+ yield (entry.file_id,
+ (relpath, relpath),
+ False,
+ (True, True),
+ (entry.parent_id, entry.parent_id),
+ (entry.name, entry.name),
+ (entry.kind, entry.kind),
+ (entry.executable, entry.executable))
return
to_paths = {}
from_entries_by_dir = list(self.source.iter_entries_by_dir(
More information about the bazaar-commits
mailing list