textutil::patch - Application of uni-diff patches to directory trees
Contents
Bugs, Ideas, Feedback
This document, and the package it describes, will undoubtedly contain bugs and other problems. Please
report such in the category textutil of the TcllibTrackers [http://core.tcl.tk/tcllib/reportlist].
Please also report any ideas for enhancements you may have for either package and/or documentation.
When proposing code changes, please provide unifieddiffs, i.e the output of diff-u.
Note further that attachments are strongly preferred over inlined patches. Attachments can be made by
going to the Edit form of the ticket immediately after its creation, and then using the left-most button
in the secondary navigation bar.
Category
Text processing
tcllib 0.2 textutil::patch(3tcl)
Description
This package provides a single command which applies a patch in unifiedformat
[https://www.gnu.org/software/diffutils/manual/html_node/Detailed-Unified.html] to a directory tree.
::textutil::patch::applybasedirectorystriplevelpatchreportcmd
Applies the patch (text of the path, not file) to the files in the basedirectory using the
specified striplevel. The result of the command is the empty string.
The striplevel argument is equivalent to option -p of the patch command.
Errors are thrown when the patch does not parse, and nothing is done to the files in
basedirectory.
All activities during the application of the patch, including the inability to apply a hunk are
reported through the command prefix reportcmd instead. Files with problems are left unchanged.
Note however that this does notprevent changes to files with no problems, before and after the
problematic file(s).
The command prefix is called in 3 possible forms:
{*}reportcmdapplyfilename
The caller begins operation on file fname, applying all hunks collected for said file.
{*}reportcmdfailfilenamehunkexpectedseen
Application of hunk number hunk of file filename has failed. The command expected to find
the text expected, and saw seen instead.
{*}reportcmdfail-alreadyfilenamehunk
Application of hunk number hunk of file filename has failed. The command believes that
this hunk has already been applied to the file.
Keywords
diff -ruN, diff, unified format, fossil, git, patch, unified format diff
Name
textutil::patch - Application of uni-diff patches to directory trees
Synopsis
package require Tcl8.59
package require textutil::patch?0.2?::textutil::patch::applybasedirectorystriplevelpatchreportcmd{*}reportcmdapplyfilename{*}reportcmdfailfilenamehunkexpectedseen{*}reportcmdfail-alreadyfilenamehunk
________________________________________________________________________________________________________________
