Команда: patch
sfk patch [-revoke|-redo] yourpatchfile.cpp [-sim|-verify]
search text blocks in file(s) and replace them by other text blocks,
including backup creation and optional restore of original files.
-revoke: undo all patches, by replacing the modified targets
by the backup files which sfk stores in save_patch.
the target files are touched afterwards (date/time update)
to enforce proper recompile. use -keep-dates to avoid this.
-redo : undo all patches and then re-apply patches.
best used whenever you change the patchfile itself,
to have your changes updated in the target files.
-exact-match: by default, leading whitespaces are ignored.
use this option enforce exact 1:1 line matching.
-keep-dates: by default, revoked files get touched. use this option
to enforce original file dates (yet windows only).
-sim : simulate what the patch would do, don't change anything.
-qs : quick summary, just tell a one-line status.
-stats : show statistics of select-replace usage.
-verify : check if an applied patch is still intact.
-nopid : apply irrevocable patch without [patch-id].
-anyroot : ignore the :root dir entry in a patch file.
patchfile rules:
- patches are executed exactly in the order as given in the patchfile.
- each :from/:to statement is executed exactly once.
- if ANY of the :from/:to statements doesn't match the input,
the whole file is NOT patched.
- the first :to block for a new target file must contain the word [patch-id],
by using a comment in the target file's syntax, e.g. in C++: // [patch-id].
this marks the file as being patched -> sfk will not patch it again.
it is recommended that your patchfiles have the ending .cpp (or .java etc.)
to enable syntax highlighting with your favourite text editor.
sfk patch -example
shows a detailed patchfile example.
sfk patch -template
gives a simple, empty patchfile template.