[MERGE] remerge doesn't clobber unrelated conflicts

John Arbash Meinel john at arbash-meinel.com
Sun Jul 2 19:00:15 BST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Aaron Bentley wrote:
> John Arbash Meinel wrote:
>>> Except it may be the wrong unconflicted state. (Since they aren't merged).
>>>
>>> I'm okay with it, just not 100%.
> 
> Okay, here's a bundle that makes it impossible for the same file to have
> the same conflict type repeated.  It adds WorkingTree.add_conflicts, and
> uses it in Merger.  It also ensures that the conflict list is sorted.
> 
> Aaron


...

+    def test_conflicts(self):
+        self.create_conflicts()
+        self.run_bzr('merge', '../other', retcode=1)
+        wt = WorkingTree.open('.')
+        self.assertEqual(len(wt.conflicts()), 2)
+        self.run_bzr('remerge', retcode=1)
+        wt = WorkingTree.open('.')
+        self.assertEqual(len(wt.conflicts()), 2)
+        self.run_bzr('remerge', 'hello', retcode=1)
+        self.assertEqual(len(wt.conflicts()), 2)

^- I prefer to see these as:
self.assertEqual(2, len(wt.conflicts()))


...
+
+    def test_merge_inner_conflicts(self):
+        tree_a = self.make_branch_and_tree('a')
+        tree_a.set_conflicts(ConflictList([TextConflict('patha')]))
+        merge_inner(tree_a.branch, tree_a, tree_a, this_tree=tree_a)
+        self.assertEqual(len(tree_a.conflicts()), 1)

^- same here
v- and here

+    def test_add_conflicts(self):
+        tree = self.make_branch_and_tree('tree')
+        try:
+            tree.add_conflicts([TextConflict('path_a')])
+        except UnsupportedOperation:
+            raise TestSkipped()
+        self.assertEqual(tree.conflicts(),
+                         ConflictList([TextConflict('path_a')]))
+        tree.add_conflicts([TextConflict('path_a')])
+        self.assertEqual(tree.conflicts(),
+                         ConflictList([TextConflict('path_a')]))
+        tree.add_conflicts([ContentsConflict('path_a')])
+        self.assertEqual(tree.conflicts(),
+                         ConflictList([ContentsConflict('path_a'),
+                                       TextConflict('path_a')]))
+        tree.add_conflicts([TextConflict('path_b')])
+        self.assertEqual(tree.conflicts(),
+                         ConflictList([ContentsConflict('path_a'),
+                                       TextConflict('path_a'),
+                                       TextConflict('path_b')]))
+


I won't block on the assertEqual stuff, but I think we are trying to do
'expected, actual'. Otherwise +1.

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEqAmvJdeBCYSNAAMRArMPAJsEIZBNXNA1L37De/hConI7/gdVSQCfRHkz
XK9ioxAeYBYZJJSv9QYok9I=
=bg5D
-----END PGP SIGNATURE-----




More information about the bazaar mailing list