This is an archive of the discontinued Mercurial Phabricator instance.

patch: buffer lines for a same hunk
ClosedPublic

Authored by quark on Apr 9 2018, 6:59 PM.

Details

Summary

Instead of yielding tokens directly, buffer them if they belong to a same
hunk. This makes it easier for the upcoming new worddiff algorithm to only
focus on the diff hunk, instead of having to worry about other contents.

This breaks how the existing experimental worddiff algorithm works, so the
algorithm was removed, and related tests are disabled for now. The next patch
will add a new worddiff algorithm.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

quark created this revision.Apr 9 2018, 6:59 PM
yuja requested changes to this revision.Apr 10 2018, 10:46 AM
yuja added a subscriber: yuja.
yuja added inline comments.
mercurial/patch.py
2490

Don't use bytes[n] since it returns an integer on Python 3.
That's why there were silly startswith(char).

2554

I think hunkbuffer could be (alines_without_pluses, blines_without_minuses) so difsinglehunkinline() function
will be slightly simpler.

2578

Can you split this patch to

  • drop the current inlinediff implementation
  • and buffer hunk lines?
This revision now requires changes to proceed.Apr 10 2018, 10:46 AM
durin42 accepted this revision.Apr 16 2018, 7:01 PM
This revision was automatically updated to reflect the committed changes.