[darcs-users] hunk pattern recipe
Max Battcher
me at worldmaker.net
Sat Dec 17 22:09:34 UTC 2011
On Monday, December 5, 2011, Ganesh Sittampalam <ganesh at earth.li> wrote:
> Hi,
>
> On 03/12/2011 01:30, Maris, Rob wrote:
>> Currently hunks are identified as blocks of text lines that are
>> separated by at least one unmodified line. However, I'd want to create a
>> sort of recipe on a per-repo basis that allows me to specify a sort of
>> field separators that should be recognized by the hunk identification
>> algorithm.
>>
>> Example: I'd want to manage object library files (graphic objects,
>> organized in libraries stored as ASCII text) through darcs. Darcs should
>> only identify single hunks using specification in the user recipe. Goal:
>> prevent the creation of too many hunks caused by alternating lines
>> within an information entity that are modified, and lines in between
>> that are not modified.
>>
>> Is such a hunk recipe feature anyway present in current darcs version?
>
> Such a feature is definitely not present. However, it wouldn't be too
> intrusive to add, as it only affects the way in which hunks are
> recorded, and not patch representation or handling in general.
>
> One thing that's been mentioned before is the use of "patience diff":
> http://bramcohen.livejournal.com/73318.html
> Would that help in your case?
(Late reply, sorry…) Reminds me of a semantic patch conversation I had ages
ago (and which has always come up from time to time). I ultimately decided
on a syntax highlighter based approach (generally RegEx-based single pass
tokenizers) for performance and "sensitivity" (syntax highlighters
generally have to fallback well on broken/in-progress) input streams…
Anyway, the most interesting take away from this is that I actually
prototyped (in Python due to available libraries) a general purpouse
token-based diff tool. My favorite part was that I used Google's
character-based diff library to generate character-based unified diffs and
the token-based approach fairly consistently outperformed that library's
modern character diff tool…
When character-based hunks are to be supported by darcs, my tool would
already be a potential for useful "middleware" to generate nice chunks.
My blog post on the subject:
http://blog.worldmaker.net/2010/jan/05/further-adventures-token-stream-diffs/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osuosl.org/pipermail/darcs-users/attachments/20111217/ee259122/attachment.html>
More information about the darcs-users
mailing list