.TH PATCHTREE 1 .SH NAME patchtree \- patch up a directory tree .SH SYNOPSIS .in +5 .ti -5 .B patchtree .RB [ \-znf ] .RB [ \-d ] .RB [ \-c [\fIcontext\fP]] .RB [ \-u [\fIcontext\fP]] .RB [ \-x .IR file "] ..." .IR "original target" " ..." .in -5 .SH DESCRIPTION .de SP .if t .sp 0.4 .if n .sp .. .B Patchtree replaces all the files among the .I targets with diff's of them and files from .IR original , or it replaces all the diff's found among the .I targets with the result of patching files from .IR original . (The latter is the default action.) This allows one to ship a source tree as just a set of differences to a previous version of the sources. .PP In diff mode .B patchtree first maps all the files in .I original recursively. Then it traverses the .I targets recursively trying to diff a target with all the original files that have the same base name (last path component.) The diff that is smaller then the target file and smaller then all other possible diffs is used to replace the target. .PP The patch mode is almost the same, except that the base name of the original file name stored in the diff is used. A patch is only accepted if the original file and the patch result have the expected CRC checksums. .PP .I Original may be a single file, it will then be used for all target files. This means that you can diff a few files that have been renamed with a few explicit calls. Note that the original name is stored in the diff, so it will be found when patching a tree without naming it explicitly. .PP .B Patchtree does not try to diff an already diffed file, and it will only patch files it recognizes. The diffs have a special line prepended to it that looks like this: .PP .RS .B #*+-#*+- .I new-crc new-size old-crc old-size original .RE .PP When patchtree replaces a file it overwrites the file, so that hard links are replaced too. The ownership, modified time, and mode are preserved. Interrupt, hangup and terminate signals are caught while copying, so that the program can be safely stopped, and safely restarted. .SH OPTIONS .TP .B \-d Make a normal diff. Because of the CRC checks there is no need to make context diffs. Normal diffs are good enough and always supported by any diff program. Context diffs are better readable though. .TP .BR \-c [\fIcontext\fP] Make a standard context diff. You may optionally add a decimal number telling the number of context lines that must be produced other then the default. .TP .BR \-u [\fIcontext\fP] Make a unified context diff. These diffs are smaller than standard context diffs and much better readable once you get used to them. Old patch programs don't support them though. .TP .B \-z Zero length diffs (files that are found to be unchanged), are removed. The result is useful to tell which files have changed and how. It is not useful for distribution, because the full tree cannot be restored. .TP .B \-n Play act. Just report what would be done, but don't do it. .TP .B \-f Use a diff even if it is larger than the target file, but not larger than the sum of both the original and the target file. Use this option if you are only allowed to distribute diffs to copyrighted sources. .TP .BI \-x " file" Exclude all files or directories named .I file from the originals. Use one or more of these options to keep .B patchtree from making diffs of some files like makefiles or files in source-code control directories. .SH ENVIRONMENT .TP 10 .B TMPDIR Directory for temporary files, by default .BR /tmp . .SH "SEE ALSO" .BR diff (1), .BR patch (1). .SH DIAGNOSTICS .TP 5 .IR target " -= " original A file has been replaced by a diff. This notation makes sense if you look at a diff as a mathematical difference, one file being subtracted from another. .TP .IR target " == " original The two files were found to be the same and unchanged files are to be removed .RB ( \-z ), so .I target is now gone. .TP .IR target " += " original This should be clear by now. .TP .IR target " ?" Either no suitable file could be found to make a diff, or no patch could be made. The latter is more serious, it either means that you haven't got the original file, or that its CRC is not correct. .SH BUGS .B Patch may complain about finding no patches in an empty diff, even though it is told to be silent. .SH AUTHOR Kees J. Bot (kjb@cs.vu.nl)