Rev 2470: (robertc) Properly compare filesystem paths with absent and renamed entries. (John Arbash Meinel, #110256) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Mon Apr 30 05:29:02 BST 2007
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 2470
revision-id: pqm at pqm.ubuntu.com-20070430042900-o9x8ggxoevt9s9fi
parent: pqm at pqm.ubuntu.com-20070430040006-olr7xpzdbp02y1sd
parent: robertc at robertcollins.net-20070430034851-aik2bzpubf44oyjc
committer: Canonical.com Patch Queue Manager<pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2007-04-30 05:29:00 +0100
message:
(robertc) Properly compare filesystem paths with absent and renamed entries. (John Arbash Meinel, #110256)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/tests/intertree_implementations/test_compare.py test_compare.py-20060724101752-09ysswo1a92uqyoz-2
bzrlib/workingtree_4.py workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
------------------------------------------------------------
revno: 2465.1.4
merged: robertc at robertcollins.net-20070430034851-aik2bzpubf44oyjc
parent: john at arbash-meinel.com-20070426211345-fh5tuoii9mb7w15a
parent: pqm at pqm.ubuntu.com-20070430025942-y83xydh67a37zebd
committer: Robert Collins <robertc at robertcollins.net>
branch nick: integration
timestamp: Mon 2007-04-30 13:48:51 +1000
message:
Merge Johns fix for bug 110256.
------------------------------------------------------------
revno: 2465.1.3
merged: john at arbash-meinel.com-20070426211345-fh5tuoii9mb7w15a
parent: john at arbash-meinel.com-20070426211150-q67uvpdf3os770u2
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: status_after_merge_110256
timestamp: Thu 2007-04-26 16:13:45 -0500
message:
NEWS entry for fixing bug #110256
------------------------------------------------------------
revno: 2465.1.2
merged: john at arbash-meinel.com-20070426211150-q67uvpdf3os770u2
parent: john at arbash-meinel.com-20070426204553-sfw4mo98pxggdrfm
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: status_after_merge_110256
timestamp: Thu 2007-04-26 16:11:50 -0500
message:
Alternate fix for 'absent' entries.
This also handles 'renamed' entries properly.
Basically, when we get a path which happens to match a dirstate entry
check to see if the entry is considered 'live'.
If it isn't, then we treat it as a non-match, which allows
later checks to properly handle the file on disk.
------------------------------------------------------------
revno: 2465.1.1
merged: john at arbash-meinel.com-20070426204553-sfw4mo98pxggdrfm
parent: pqm at pqm.ubuntu.com-20070426181928-ot99t6eyhjjfj5h3
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: status_after_merge_110256
timestamp: Thu 2007-04-26 15:45:53 -0500
message:
Add a (failing) test exposing the bug in _iter_changes
If you bzr mv a => b, and then bzr add a (for a new a), bzr can get
confused as to the state of 'a'.
=== modified file 'NEWS'
--- a/NEWS 2007-04-30 01:49:39 +0000
+++ b/NEWS 2007-04-30 03:48:51 +0000
@@ -14,6 +14,9 @@
* Fix the bzr commit message to be in text mode.
(Alexander Belchenko, #110901)
+ * Also handle when you rename a file and create a file where it used
+ to be. (John Arbash Meinel, #110256)
+
bzr 0.16rc1 2007-04-26
NOTES WHEN UPGRADING:
=== modified file 'bzrlib/tests/intertree_implementations/test_compare.py'
--- a/bzrlib/tests/intertree_implementations/test_compare.py 2007-04-25 22:45:55 +0000
+++ b/bzrlib/tests/intertree_implementations/test_compare.py 2007-04-26 20:45:53 +0000
@@ -1318,3 +1318,39 @@
self.assertEqual(expected,
self.do_iter_changes(tree1, tree2,
want_unversioned=False))
+
+ def test_renamed_and_added(self):
+ """Test when we have renamed a file, and put another in its place."""
+ tree1 = self.make_branch_and_tree('tree1')
+ tree2 = self.make_to_branch_and_tree('tree2')
+ root_id = tree1.get_root_id()
+ tree2.set_root_id(root_id)
+
+ # The final changes are:
+ # bzr add b c
+ # bzr mv b a
+ # bzr mv c d
+ # bzr add b c
+
+ self.build_tree_contents([
+ ('tree1/b', 'b contents\n'),
+ ('tree1/c', 'c contents\n'),
+ ('tree2/a', 'b contents\n'),
+ ('tree2/b', 'new b contents\n'),
+ ('tree2/c', 'new c contents\n'),
+ ('tree2/d', 'c contents\n'),
+ ])
+ tree1.add(['b', 'c'], ['b1-id', 'c1-id'])
+ tree2.add(['a', 'b', 'c', 'd'], ['b1-id', 'b2-id', 'c2-id', 'c1-id'])
+
+ tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
+
+ expected = sorted([
+ self.renamed(tree1, tree2, 'b1-id', False),
+ self.renamed(tree1, tree2, 'c1-id', False),
+ self.added(tree2, 'b2-id'),
+ self.added(tree2, 'c2-id'),
+ ])
+ self.assertEqual(expected,
+ self.do_iter_changes(tree1, tree2,
+ want_unversioned=True))
=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py 2007-04-25 22:07:09 +0000
+++ b/bzrlib/workingtree_4.py 2007-04-26 21:11:50 +0000
@@ -2289,16 +2289,39 @@
result[7],
)
advance_path = False
+ elif current_entry[1][target_index][0] in 'ar':
+ # The path matches, but the current entry is marked as
+ # not being here. So we don't want to consider this
+ # as a match. We still need to process the current
+ # entry, though.
+ advance_path = False
+ path_handled = False
+ for result in _process_entry(current_entry, None):
+ if (include_unchanged
+ or result[2] # content change
+ or result[3][0] != result[3][1] # versioned status
+ or result[4][0] != result[4][1] # parent id
+ or result[5][0] != result[5][1] # name
+ or result[6][0] != result[6][1] # kind
+ or result[7][0] != result[7][1] # executable
+ ):
+ yield (result[0],
+ (utf8_decode_or_none(result[1][0]),
+ utf8_decode_or_none(result[1][1])),
+ result[2],
+ result[3],
+ result[4],
+ (utf8_decode_or_none(result[5][0]),
+ utf8_decode_or_none(result[5][1])),
+ result[6],
+ result[7],
+ )
else:
for result in _process_entry(current_entry, current_path_info):
# this check should probably be outside the loop: one
# 'iterate two trees' api, and then _iter_changes filters
# unchanged pairs. - RBC 20070226
- if current_entry[1][target_index][0] == 'a':
- advance_path = False
- path_handled = False
- else:
- path_handled = True
+ path_handled = True
if (include_unchanged
or result[2] # content change
or result[3][0] != result[3][1] # versioned status
More information about the bazaar-commits
mailing list