Rev 4322: (jam) Update 'bzr merge --weave' to generate conflicts when one side in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri May 1 21:43:55 BST 2009
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 4322
revision-id: pqm at pqm.ubuntu.com-20090501204351-ll10ketv3bu8plhx
parent: pqm at pqm.ubuntu.com-20090501153755-qk0x5oeclb231390
parent: john at arbash-meinel.com-20090501180924-bco4vmhymopg5lls
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2009-05-01 21:43:51 +0100
message:
(jam) Update 'bzr merge --weave' to generate conflicts when one side
modifies and one side deletes a line. (bug #328171)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/tests/test_merge.py testmerge.py-20050905070950-c1b5aa49ff911024
bzrlib/tests/test_versionedfile.py test_versionedfile.py-20060222045249-db45c9ed14a1c2e5
bzrlib/versionedfile.py versionedfile.py-20060222045106-5039c71ee3b65490
------------------------------------------------------------
revno: 4312.1.3
revision-id: john at arbash-meinel.com-20090501180924-bco4vmhymopg5lls
parent: john at arbash-meinel.com-20090429170327-lhnzbwx2pf7i45w8
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: weave_conflict_delete_328171
timestamp: Fri 2009-05-01 13:09:24 -0500
message:
Different sides deleting different amounts is now a conflict.
This is because the final 'lines' are different, but something occurred
on each side.
modified:
bzrlib/tests/test_versionedfile.py test_versionedfile.py-20060222045249-db45c9ed14a1c2e5
------------------------------------------------------------
revno: 4312.1.2
revision-id: john at arbash-meinel.com-20090429170327-lhnzbwx2pf7i45w8
parent: john at arbash-meinel.com-20090429170236-v1oe7b235mi73cqs
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: weave_conflict_delete_328171
timestamp: Wed 2009-04-29 12:03:27 -0500
message:
NEWS entry for fixing bug #328171
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
------------------------------------------------------------
revno: 4312.1.1
revision-id: john at arbash-meinel.com-20090429170236-v1oe7b235mi73cqs
parent: pqm at pqm.ubuntu.com-20090429093347-5f59e9ix93s30x3r
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: weave_conflict_delete_328171
timestamp: Wed 2009-04-29 12:02:36 -0500
message:
Add a per-implementation test that deleting lines conflicts with modifying lines.
At the moment, I don't see a simple way to implement this for LCA merge,
so I'm just marking it as 'expectedFailure'.
However, it works for both Weave merge and for Merge3.
Fixes bug #328171
modified:
bzrlib/tests/test_merge.py testmerge.py-20050905070950-c1b5aa49ff911024
bzrlib/versionedfile.py versionedfile.py-20060222045106-5039c71ee3b65490
=== modified file 'NEWS'
--- a/NEWS 2009-05-01 07:59:02 +0000
+++ b/NEWS 2009-05-01 20:43:51 +0000
@@ -38,6 +38,9 @@
* Adding now works properly when path contains a symbolic link.
(Geoff Bache, #183831)
+* ``bzr merge --weave`` will now generate a conflict if one side deletes a
+ line, and the other side modifies the line. (John Arbash Meinel, #328171)
+
* ``bzr send`` works to send emails again using MAPI.
(Neil Martinsen-Burrell, #346998)
=== modified file 'bzrlib/tests/test_merge.py'
--- a/bzrlib/tests/test_merge.py 2009-03-24 01:53:42 +0000
+++ b/bzrlib/tests/test_merge.py 2009-04-29 17:02:36 +0000
@@ -1095,6 +1095,52 @@
'>>>>>>> MERGE-SOURCE\n'
'line 4\n', 'this/file1')
+ def test_modify_conflicts_with_delete(self):
+ # If one side deletes a line, and the other modifies that line, then
+ # the modification should be considered a conflict
+ builder = self.make_branch_builder('test')
+ builder.start_series()
+ builder.build_snapshot('BASE-id', None,
+ [('add', ('', None, 'directory', None)),
+ ('add', ('foo', 'foo-id', 'file', 'a\nb\nc\nd\ne\n')),
+ ])
+ # Delete 'b\n'
+ builder.build_snapshot('OTHER-id', ['BASE-id'],
+ [('modify', ('foo-id', 'a\nc\nd\ne\n'))])
+ # Modify 'b\n', add 'X\n'
+ builder.build_snapshot('THIS-id', ['BASE-id'],
+ [('modify', ('foo-id', 'a\nb2\nc\nd\nX\ne\n'))])
+ builder.finish_series()
+ branch = builder.get_branch()
+ this_tree = branch.bzrdir.create_workingtree()
+ this_tree.lock_write()
+ self.addCleanup(this_tree.unlock)
+ other_tree = this_tree.bzrdir.sprout('other', 'OTHER-id').open_workingtree()
+ self.do_merge(this_tree, other_tree)
+ if self.merge_type is _mod_merge.LCAMerger:
+ self.expectFailure("lca merge doesn't track deleted lines",
+ self.assertFileEqual,
+ 'a\n'
+ '<<<<<<< TREE\n'
+ 'b2\n'
+ '=======\n'
+ '>>>>>>> MERGE-SOURCE\n'
+ 'c\n'
+ 'd\n'
+ 'X\n'
+ 'e\n', 'test/foo')
+ else:
+ self.assertFileEqual(
+ 'a\n'
+ '<<<<<<< TREE\n'
+ 'b2\n'
+ '=======\n'
+ '>>>>>>> MERGE-SOURCE\n'
+ 'c\n'
+ 'd\n'
+ 'X\n'
+ 'e\n', 'test/foo')
+
class TestMerge3Merge(TestCaseWithTransport, TestMergeImplementation):
=== modified file 'bzrlib/tests/test_versionedfile.py'
--- a/bzrlib/tests/test_versionedfile.py 2009-04-09 20:23:07 +0000
+++ b/bzrlib/tests/test_versionedfile.py 2009-05-01 18:09:24 +0000
@@ -1152,6 +1152,10 @@
"""
result = """\
line 1
+<<<<<<<\x20
+ line 2
+=======
+>>>>>>>\x20
"""
self._test_merge_from_strings(base, a, b, result)
=== modified file 'bzrlib/versionedfile.py'
--- a/bzrlib/versionedfile.py 2009-04-09 20:23:07 +0000
+++ b/bzrlib/versionedfile.py 2009-04-29 17:02:36 +0000
@@ -1403,9 +1403,13 @@
elif state == 'conflicted-b':
ch_b = ch_a = True
lines_b.append(line)
+ elif state == 'killed-both':
+ # This counts as a change, even though there is no associated
+ # line
+ ch_b = ch_a = True
else:
if state not in ('irrelevant', 'ghost-a', 'ghost-b',
- 'killed-base', 'killed-both'):
+ 'killed-base'):
raise AssertionError(state)
for struct in outstanding_struct():
yield struct
More information about the bazaar-commits
mailing list