Rev 3629: (robertc) Improve the testing of InterTree.iter_changes and fix bugs in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Thu Aug 14 08:41:23 BST 2008
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3629
revision-id: pqm at pqm.ubuntu.com-20080814074117-x0zvzzv7y6mok8pz
parent: pqm at pqm.ubuntu.com-20080814042250-v7qws60l3fjwelb1
parent: robertc at robertcollins.net-20080814065435-73xgy9r6xtqmvzux
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2008-08-14 08:41:17 +0100
message:
(robertc) Improve the testing of InterTree.iter_changes and fix bugs
found as a result (Robert Collins, Aaron Bentley)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/diff.py diff.py-20050309040759-26944fbbf2ebbf36
bzrlib/tests/intertree_implementations/test_compare.py test_compare.py-20060724101752-09ysswo1a92uqyoz-2
bzrlib/tree.py tree.py-20050309040759-9d5f2496be663e77
bzrlib/workingtree_4.py workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
------------------------------------------------------------
revno: 3619.4.4
revision-id: robertc at robertcollins.net-20080814065435-73xgy9r6xtqmvzux
parent: robertc at robertcollins.net-20080814064629-wuzmbxzw7tn27usi
committer: Robert Collins <robertc at robertcollins.net>
branch nick: integration
timestamp: Thu 2008-08-14 16:54:35 +1000
message:
Review feedback.
modified:
bzrlib/tests/intertree_implementations/test_compare.py test_compare.py-20060724101752-09ysswo1a92uqyoz-2
------------------------------------------------------------
revno: 3619.4.3
revision-id: robertc at robertcollins.net-20080814064629-wuzmbxzw7tn27usi
parent: robertc at robertcollins.net-20080814052902-1e5a6qm37sqhs2ji
parent: pqm at pqm.ubuntu.com-20080814042250-v7qws60l3fjwelb1
committer: Robert Collins <robertc at robertcollins.net>
branch nick: integration
timestamp: Thu 2008-08-14 16:46:29 +1000
message:
Resolve conflicts in NEWS.
added:
doc/en/developer-guide/testing.txt testing.txt-20080812140359-i70zzh6v2z7grqex-1
modified:
Makefile Makefile-20050805140406-d96e3498bb61c5bb
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/help_topics/en/rules.txt rules.txt-20080516063844-ghr5l6pvvrhiycun-1
bzrlib/osutils.py osutils.py-20050309040759-eeaff12fbf77ac86
bzrlib/repofmt/pack_repo.py pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/smart/medium.py medium.py-20061103051856-rgu2huy59fkz902q-1
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
bzrlib/tests/http_utils.py HTTPTestUtil.py-20050914180604-247d3aafb7a43343
bzrlib/tests/interrepository_implementations/test_fetch.py test_fetch.py-20080425213627-j60cjh782ufm83ry-1
bzrlib/tests/test_bzrdir.py test_bzrdir.py-20060131065654-deba40eef51cf220
bzrlib/tests/test_config.py testconfig.py-20051011041908-742d0c15d8d8c8eb
bzrlib/tests/test_http.py testhttp.py-20051018020158-b2eef6e867c514d9
bzrlib/tests/test_plugins.py plugins.py-20050622075746-32002b55e5e943e9
bzrlib/tests/test_source.py test_source.py-20051207061333-a58dea6abecc030d
bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
bzrlib/tests/tree_implementations/test_iter_search_rules.py test_iter_search_rul-20080528065532-1ml1ttb12az20cxf-1
bzrlib/transform.py transform.py-20060105172343-dd99e54394d91687
bzrlib/transport/http/__init__.py http_transport.py-20050711212304-506c5fd1059ace96
bzrlib/transport/local.py local_transport.py-20050711165921-9b1f142bfe480c24
bzrlib/tree.py tree.py-20050309040759-9d5f2496be663e77
doc/developers/HACKING.txt HACKING-20050805200004-2a5dc975d870f78c
doc/en/user-guide/configuring_bazaar.txt configuring_bazaar.t-20071128000722-ncxiua259xwbdbg7-1
setup.py setup.py-20050314065409-02f8a0a6e3f9bc70
tools/win32/bzr.iss.cog bzr.iss.cog-20060622100836-b3yup582rt3y0nvm-5
------------------------------------------------------------
revno: 3619.4.2
revision-id: robertc at robertcollins.net-20080814052902-1e5a6qm37sqhs2ji
parent: robertc at robertcollins.net-20080813032119-09pl9q0t9gxng5t6
committer: Robert Collins <robertc at robertcollins.net>
branch nick: intertree.missing
timestamp: Thu 2008-08-14 15:29:02 +1000
message:
Change bzrlib.diff.DiffTree.show_diff to skip entries missing in both trees.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/diff.py diff.py-20050309040759-26944fbbf2ebbf36
------------------------------------------------------------
revno: 3619.4.1
revision-id: robertc at robertcollins.net-20080813032119-09pl9q0t9gxng5t6
parent: pqm at pqm.ubuntu.com-20080811083307-tbibm26paa3r4hg8
committer: Robert Collins <robertc at robertcollins.net>
branch nick: intertree.missing
timestamp: Wed 2008-08-13 13:21:19 +1000
message:
Improve tests for the behaviour of Tree.iter_changes for missing paths that are only present in one tree, and fix found bugs. (Robert Collins)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/tests/intertree_implementations/test_compare.py test_compare.py-20060724101752-09ysswo1a92uqyoz-2
bzrlib/tree.py tree.py-20050309040759-9d5f2496be663e77
bzrlib/workingtree_4.py workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
=== modified file 'NEWS'
--- a/NEWS 2008-08-13 22:51:55 +0000
+++ b/NEWS 2008-08-14 06:46:29 +0000
@@ -13,10 +13,18 @@
BUG FIXES:
+ * ``WorkingTree4`` trees will now correctly report missing-and-new
+ paths in the output of ``iter_changes``. (Robert Collins)
+
API CHANGES:
* Exporters now take 4 parameters. (Robert Collins)
+ * ``Tree.iter_changes`` will now return False for the content change
+ field when a file is missing in the basis tree and not present in
+ the target tree. Previously it returned True unconditionally.
+ (Robert Collins)
+
TESTING:
* ``addCleanup`` now takes ``*arguments`` and ``**keyword_arguments``
@@ -26,6 +34,10 @@
INTERNALS:
+ * ``bzrlib.diff.DiffTree.show_diff`` now skips changes where the kind
+ is unknown in both source and target.
+ (Robert Collins, Aaron Bentley)
+
bzr 1.6rc2 2008-08-13
---------------------
=== modified file 'bzrlib/diff.py'
--- a/bzrlib/diff.py 2008-06-11 03:56:46 +0000
+++ b/bzrlib/diff.py 2008-08-14 05:29:02 +0000
@@ -874,7 +874,9 @@
return path.encode(self.path_encoding, "replace")
for (file_id, paths, changed_content, versioned, parent, name, kind,
executable) in sorted(iterator, key=changes_key):
- if parent == (None, None):
+ # The root does not get diffed, and items with no known kind (that
+ # is, missing) in both trees are skipped as well.
+ if parent == (None, None) or kind == (None, None):
continue
oldpath, newpath = paths
oldpath_encoded = get_encoded_path(paths[0])
=== modified file 'bzrlib/tests/intertree_implementations/test_compare.py'
--- a/bzrlib/tests/intertree_implementations/test_compare.py 2008-03-07 14:25:46 +0000
+++ b/bzrlib/tests/intertree_implementations/test_compare.py 2008-08-14 06:54:35 +0000
@@ -21,6 +21,7 @@
from bzrlib import errors, tests, workingtree_4
from bzrlib.osutils import file_kind, has_symlinks
+from bzrlib.tests import TestNotApplicable
from bzrlib.tests.intertree_implementations import TestCaseWithTwoTrees
# TODO: test the include_root option.
@@ -695,6 +696,38 @@
])
self.assertEqual(expected, self.do_iter_changes(tree1, tree2))
+ def test_only_in_source_and_missing(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(['tree1/file'])
+ tree1.add(['file'], ['file-id'])
+ os.unlink('tree1/file')
+ tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
+ root_id = tree1.path2id('')
+ if not tree1.path2id('file'):
+ # The locked test trees conversion could not preserve the missing
+ # 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()
+ expected = [('file-id', ('file', None), False, (True, False),
+ (root_id, None), ('file', None), (None, None), (False, None))]
+ self.assertEqual(expected, self.do_iter_changes(tree1, tree2))
+
+ def test_only_in_target_and_missing(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/file'])
+ tree2.add(['file'], ['file-id'])
+ os.unlink('tree2/file')
+ tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
+ root_id = tree1.path2id('')
+ expected = [('file-id', (None, 'file'), False, (False, True),
+ (None, root_id), (None, 'file'), (None, None), (None, False))]
+ self.assertEqual(expected, self.do_iter_changes(tree1, tree2))
+
def test_unchanged_with_renames_and_modifications(self):
"""want_unchanged should generate a list of unchanged entries."""
tree1 = self.make_branch_and_tree('1')
=== modified file 'bzrlib/tree.py'
--- a/bzrlib/tree.py 2008-08-14 03:08:42 +0000
+++ b/bzrlib/tree.py 2008-08-14 06:46:29 +0000
@@ -948,7 +948,7 @@
self.source._comparison_data(from_entry, path)
kind = (from_kind, None)
executable = (from_executable, None)
- changed_content = True
+ changed_content = from_kind is not None
# the parent's path is necessarily known at this point.
yield(file_id, (path, to_path), changed_content, versioned, parent,
name, kind, executable)
=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py 2008-07-29 13:03:44 +0000
+++ b/bzrlib/workingtree_4.py 2008-08-13 03:21:19 +0000
@@ -1980,7 +1980,6 @@
# record is handled, but isn't interesting to process (unchanged)
uninteresting = object()
-
old_dirname_to_file_id = {}
new_dirname_to_file_id = {}
# TODO: jam 20070516 - Avoid the _get_entry lookup overhead by
@@ -2169,14 +2168,15 @@
return uninteresting
elif source_minikind in 'a' and target_minikind in 'fdlt':
# looks like a new file
+ path = pathjoin(entry[0][0], entry[0][1])
+ # parent id is the entry for the path in the target tree
+ # TODO: these are the same for an entire directory: cache em.
+ parent_id = state._get_entry(target_index,
+ path_utf8=entry[0][0])[0][2]
+ if parent_id == entry[0][2]:
+ parent_id = None
if path_info is not None:
- path = pathjoin(entry[0][0], entry[0][1])
- # parent id is the entry for the path in the target tree
- # TODO: these are the same for an entire directory: cache em.
- parent_id = state._get_entry(target_index,
- path_utf8=entry[0][0])[0][2]
- if parent_id == entry[0][2]:
- parent_id = None
+ # Present on disk:
if use_filesystem_for_exec:
# We need S_ISREG here, because we aren't sure if this
# is a file or not.
@@ -2194,9 +2194,15 @@
(None, path_info[2]),
(None, target_exec))
else:
- # but its not on disk: we deliberately treat this as just
- # never-present. (Why ?! - RBC 20070224)
- pass
+ # Its a missing file, report it as such.
+ return (entry[0][2],
+ (None, utf8_decode(path)[0]),
+ False,
+ (False, True),
+ (None, parent_id),
+ (None, utf8_decode(entry[0][1])[0]),
+ (None, None),
+ (None, False))
elif source_minikind in 'fdlt' and target_minikind in 'a':
# unversioned, possibly, or possibly not deleted: we dont care.
# if its still on disk, *and* theres no other entry at this
@@ -2521,7 +2527,6 @@
except StopIteration:
current_dir_info = None
-
@staticmethod
def is_compatible(source, target):
# the target must be a dirstate working tree
More information about the bazaar-commits
mailing list