[darcs-devel] token replace patches with custom --token-chars

Ganesh Sittampalam ganesh at earth.li
Sun Jun 14 20:15:17 UTC 2015


On 14/06/2015 20:27, Ben Franksen wrote:
> I just replaced :> with :* (almost 700 occurrences in more than 50 files, an 
> experimental change just to see if it would work), using the command
> 
>   find harness src -name *.hs | xargs perl -pi -e's/:\>(?!:)/:*/g'
> 
> Recording this change and realizing how many files and lines are affected I 
> thought this should rather be done with a replace patch. So I went ahead and 
> did this:
> 
>   find src harness -name *.hs | xargs darcs replace ':>' ':*' --token-
> chars='[:>*]'
> 
> Works like a charm. And has the advantage that it commutes with most 
> overlapping changes.
> 
> But I dimly remember having read warnings that using --token-chars may lead 
> to trouble. That was long ago, though.
> 
> What is the state of the art here? Is it safe to do something like that?

I think the main problem is that token replaces with different sets of
token characters never commute with each other. I don't think that's
really a concern in this case.

Cheers,

Ganesh



More information about the darcs-devel mailing list