[PATCH 1 of 6 STABLE] bdiff: deal better with duplicate lines

Yuya Nishihara yuya at tcha.org
Mon Apr 25 11:41:48 EDT 2016


On Sat, 23 Apr 2016 10:41:14 -0500, Matt Mackall wrote:
> # HG changeset patch
> # User Matt Mackall <mpm at selenic.com>
> # Date 1461290726 18000
> #      Thu Apr 21 21:05:26 2016 -0500
> # Branch stable
> # Node ID 819d49f91597733db78db240523115279fc71b2d
> # Parent  2d3837a4bded5362f26f91033c0a83376c207593
> bdiff: deal better with duplicate lines

I went through this series as a newcomer to bdiff, and couldn't find any
problem except for a few nits. The series looks great to me.

> The find_longest_match code compares all the possible positions in two

s/find_longest_match/longest_match/g

>   a b b b c . d e . f
>   0 1 2 3 4 5 6 7 8 9
> a 1 - - - - - - - - -
> b - 2 1 1 - - - - - -
> b - 1 3 2 - - - - - -
> b - 1 2 4 - - - - - -
> . - - - - - 1 - - 1 -

> --- a/tests/test-bdiff.py	Thu Mar 24 22:55:56 2016 +0900
> +++ b/tests/test-bdiff.py	Thu Apr 21 21:05:26 2016 -0500
> @@ -52,6 +52,7 @@
>          pos += l
>  showdiff("x\n\nx\n\nx\n\nx\n\nz\n", "x\n\nx\n\ny\n\nx\n\nx\n\nz\n")
>  showdiff("x\n\nx\n\nx\n\nx\n\nz\n", "x\n\nx\n\ny\n\nx\n\ny\n\nx\n\nz\n")
> +showdiff("a\nb\nb\nb\nc\n.\nd\ne\n.\nf\n", "a\nb\nb\nb\n.\n")

At first, I thought this would fail in old version, but I was wrong. My
understanding is that this patch fixes the process of reaching the result.

> +8 10 ''
> +12 20 ''


More information about the Mercurial-devel mailing list