# HG changeset patch # User Martin von Zweigbergk # Date 2021-01-19 06:32:09 # Node ID 98e3a693061ac49aaefc10ff449eb69a46886442 # Parent b8d8fd2fe75f37bf1de4e4d8bfdbd901fc5ae175 simplemerge: delete unused find_unconflicted() The function has been unused ever since it was introduced in 465b9ea02868 (Import 3-way merge code from bzr, 2007-04-16). Differential Revision: https://phab.mercurial-scm.org/D9832 diff --git a/mercurial/simplemerge.py b/mercurial/simplemerge.py --- a/mercurial/simplemerge.py +++ b/mercurial/simplemerge.py @@ -402,31 +402,6 @@ class Merge3Text(object): return sl - def find_unconflicted(self): - """Return a list of ranges in base that are not conflicted.""" - am = mdiff.get_matching_blocks(self.basetext, self.atext) - bm = mdiff.get_matching_blocks(self.basetext, self.btext) - - unc = [] - - while am and bm: - # there is an unconflicted block at i; how long does it - # extend? until whichever one ends earlier. - a1 = am[0][0] - a2 = a1 + am[0][2] - b1 = bm[0][0] - b2 = b1 + bm[0][2] - i = intersect((a1, a2), (b1, b2)) - if i: - unc.append(i) - - if a2 < b2: - del am[0] - else: - del bm[0] - - return unc - def _verifytext(text, path, ui, opts): """verifies that text is non-binary (unless opts[text] is passed, diff --git a/tests/test-simplemerge.py b/tests/test-simplemerge.py --- a/tests/test-simplemerge.py +++ b/tests/test-simplemerge.py @@ -141,8 +141,6 @@ class TestMerge3(TestCase): """No conflicts because nothing changed""" m3 = Merge3([b'aaa', b'bbb'], [b'aaa', b'bbb'], [b'aaa', b'bbb']) - self.assertEqual(m3.find_unconflicted(), [(0, 2)]) - self.assertEqual( list(m3.find_sync_regions()), [(0, 2, 0, 2, 0, 2), (2, 2, 2, 2, 2, 2)], @@ -189,8 +187,6 @@ class TestMerge3(TestCase): [b'aaa', b'bbb'], [b'aaa', b'111', b'bbb'], [b'aaa', b'bbb'] ) - self.assertEqual(m3.find_unconflicted(), [(0, 1), (1, 2)]) - self.assertEqual( list(m3.find_sync_regions()), [(0, 1, 0, 1, 0, 1), (1, 2, 2, 3, 1, 2), (2, 2, 3, 3, 2, 2)], @@ -271,8 +267,6 @@ class TestMerge3(TestCase): [b'aaa\n', b'222\n', b'bbb\n'], ) - self.assertEqual(m3.find_unconflicted(), [(0, 1), (1, 2)]) - self.assertEqual( list(m3.find_sync_regions()), [(0, 1, 0, 1, 0, 1), (1, 2, 2, 3, 2, 3), (2, 2, 3, 3, 3, 3)], @@ -323,8 +317,6 @@ bbb [b'aaa', b'222', b'bbb'], ) - self.assertEqual(m3.find_unconflicted(), [(0, 1), (2, 3)]) - self.assertEqual( list(m3.find_sync_regions()), [(0, 1, 0, 1, 0, 1), (2, 3, 2, 3, 2, 3), (3, 3, 3, 3, 3, 3)], @@ -338,8 +330,6 @@ bbb [b'aaa', b'222', b'222', b'222', b'222', b'bbb'], ) - self.assertEqual(m3.find_unconflicted(), [(0, 1), (3, 4)]) - self.assertEqual( list(m3.find_sync_regions()), [(0, 1, 0, 1, 0, 1), (3, 4, 4, 5, 5, 6), (4, 4, 5, 5, 6, 6)],