[PATCH 7 of 7 v2] bdiff: give slight preference to removing trailing lines

Jun Wu quark at fb.com
Mon Nov 28 00:59:08 UTC 2016


I think that's "shift_boundaries" in GNU diffutils' "src/analyze.c":

  /* Adjust inserts/deletes of identical lines to join changes
     as much as possible.
     ....
  static void
  shift_boundaries (struct file_data filevec[])

Git's xdiffi.c does something similar.

Excerpts from Mike Hommey's message of 2016-11-25 06:24:37 +0900:
> On Thu, Nov 24, 2016 at 05:52:29PM +0000, Jun Wu wrote:
> > Excerpts from Augie Fackler's message of 2016-11-17 12:42:26 -0500:
> > > My own cursory perfbdiff runs suggest this is a perf wash (using
> > > `perfbdiff -m 3041e4d59df2` in the mozilla repo). Queued. Thanks!
> > 
> > I'd mention this series changes the behavior of the diff output. The
> > difference was caught by fastannotate test.
> > 
> > See the below table (old: e1d6aa0e4c3a, new: 8836f13e3c5b):
> > 
> >    a | b | old | new
> >   --------------------
> >    a | a |  a  | -a
> >    a | z | +z  |  a
> >    a | a |  a  | +z
> >      |   | -a  |  a
> >   --------------------
> >    a | a |     a
> >    a | a |     a
> >    a |   |    -a
> > 
> > I think we would always prefer putting deletions at the end, to be consistent.
> 
> Wouldn't
>  a
> -a
> +z
>  a
> 
> Be preferable to both old and new? That's what plain diff does, by the
> way.
> 
> Mike



More information about the Mercurial-devel mailing list