Am 12.08.15 um 20:10 schrieb Heinz-Jürgen Oertel:> Christian Gollwitzer
wrote:
>
>> what is the process to get something integrated into tcllib? I've
>> developed a function in pure Tcl to apply patches in unified diff
>> format, which is the current standard for patches (diff -ruN old/ new/)
>> to a source tree. This could be a useful addition, maybe as
>> fileutil::patch or similar.
>
>
> Don't ge me wrong, I like tcl much,
> but why not using exec patch
> and using tcl only as the clue language, as indented by the inventor?
>
Yes, this also works, provided that a suitable patch progam is
installed. But a library always gives you more fine-grained control over
the process. For instance, on error conditions the usual GNU patch
program stops and asks the user for advice, for instance if the patch
should be applied in reverse, or if a filename is missing, it puts
nonsuccessful hunks into reject files etc. In a non-interactive program
this would be undesirable, and if you are writing a code editor than you
would need to use expect to redirect those questions to the GUI. A
Tcl-only implementation can also work on virtual file systems or strings
instead of files. The algorithm is simple enough (my implementation on
http://wiki.tcl.tk/12586 is just ~200 lines) that reinventing the wheel
is not the biggest obstacle here. And there is already a diff function
in tcllib, albeit buried under struct::list::longestCommonSubsequence.
PS: I prefer to contiue discussion on this public list