Patchwork simplemerge: remove dead code

login
register
mail settings
Submitter Jordi Gutiérrez Hermoso
Date Aug. 7, 2014, 4:52 p.m.
Message ID <83df50a8d61cc08a76fc.1407430321@Iris>
Download mbox | patch
Permalink /patch/5311/
State Accepted
Headers show

Comments

Jordi Gutiérrez Hermoso - Aug. 7, 2014, 4:52 p.m.
# HG changeset patch
# User Jordi Gutiérrez Hermoso <jordigh@octave.org>
# Date 1407430305 14400
#      Thu Aug 07 12:51:45 2014 -0400
# Node ID 83df50a8d61cc08a76fcb78d797cf9ec7631c0c9
# Parent  ba5fc3f81f1588507a5a84ac2b43679705ceec7b
simplemerge: remove dead code

The following functions in simplemerge are dead code. I reran "make
test-merge*" after this change, and it passed. Looks like cruft that
we've been carrying since we nabbed this code from bzr.
Augie Fackler - Aug. 7, 2014, 5 p.m.
On Thu, Aug 07, 2014 at 12:52:01PM -0400, Jordi Gutiérrez Hermoso wrote:
> # HG changeset patch
> # User Jordi Gutiérrez Hermoso <jordigh@octave.org>
> # Date 1407430305 14400
> #      Thu Aug 07 12:51:45 2014 -0400
> # Node ID 83df50a8d61cc08a76fcb78d797cf9ec7631c0c9
> # Parent  ba5fc3f81f1588507a5a84ac2b43679705ceec7b
> simplemerge: remove dead code

Queued, thanks

>
> The following functions in simplemerge are dead code. I reran "make
> test-merge*" after this change, and it passed. Looks like cruft that
> we've been carrying since we nabbed this code from bzr.
>
> diff --git a/mercurial/simplemerge.py b/mercurial/simplemerge.py
> --- a/mercurial/simplemerge.py
> +++ b/mercurial/simplemerge.py
> @@ -126,33 +126,6 @@ class Merge3Text(object):
>              else:
>                  raise ValueError(what)
>
> -    def merge_annotated(self):
> -        """Return merge with conflicts, showing origin of lines.
> -
> -        Most useful for debugging merge.
> -        """
> -        for t in self.merge_regions():
> -            what = t[0]
> -            if what == 'unchanged':
> -                for i in range(t[1], t[2]):
> -                    yield 'u | ' + self.base[i]
> -            elif what == 'a' or what == 'same':
> -                for i in range(t[1], t[2]):
> -                    yield what[0] + ' | ' + self.a[i]
> -            elif what == 'b':
> -                for i in range(t[1], t[2]):
> -                    yield 'b | ' + self.b[i]
> -            elif what == 'conflict':
> -                yield '<<<<\n'
> -                for i in range(t[3], t[4]):
> -                    yield 'A | ' + self.a[i]
> -                yield '----\n'
> -                for i in range(t[5], t[6]):
> -                    yield 'B | ' + self.b[i]
> -                yield '>>>>\n'
> -            else:
> -                raise ValueError(what)
> -
>      def merge_groups(self):
>          """Yield sequence of line groups.  Each one is a tuple:
>
> @@ -273,11 +246,6 @@ class Merge3Text(object):
>                  ia = aend
>                  ib = bend
>
> -    def mismatch_region(next_a, region_ia,  next_b, region_ib):
> -        if next_a < region_ia or next_b < region_ib:
> -            return 'conflict', None, None, next_a, region_ia, next_b, region_ib
> -    mismatch_region = staticmethod(mismatch_region)
> -
>      def find_sync_regions(self):
>          """Return a list of sync regions, where both descendants match the base.
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/simplemerge.py b/mercurial/simplemerge.py
--- a/mercurial/simplemerge.py
+++ b/mercurial/simplemerge.py
@@ -126,33 +126,6 @@  class Merge3Text(object):
             else:
                 raise ValueError(what)
 
-    def merge_annotated(self):
-        """Return merge with conflicts, showing origin of lines.
-
-        Most useful for debugging merge.
-        """
-        for t in self.merge_regions():
-            what = t[0]
-            if what == 'unchanged':
-                for i in range(t[1], t[2]):
-                    yield 'u | ' + self.base[i]
-            elif what == 'a' or what == 'same':
-                for i in range(t[1], t[2]):
-                    yield what[0] + ' | ' + self.a[i]
-            elif what == 'b':
-                for i in range(t[1], t[2]):
-                    yield 'b | ' + self.b[i]
-            elif what == 'conflict':
-                yield '<<<<\n'
-                for i in range(t[3], t[4]):
-                    yield 'A | ' + self.a[i]
-                yield '----\n'
-                for i in range(t[5], t[6]):
-                    yield 'B | ' + self.b[i]
-                yield '>>>>\n'
-            else:
-                raise ValueError(what)
-
     def merge_groups(self):
         """Yield sequence of line groups.  Each one is a tuple:
 
@@ -273,11 +246,6 @@  class Merge3Text(object):
                 ia = aend
                 ib = bend
 
-    def mismatch_region(next_a, region_ia,  next_b, region_ib):
-        if next_a < region_ia or next_b < region_ib:
-            return 'conflict', None, None, next_a, region_ia, next_b, region_ib
-    mismatch_region = staticmethod(mismatch_region)
-
     def find_sync_regions(self):
         """Return a list of sync regions, where both descendants match the base.