patchtree(1)


NAME
     patchtree - patch up a directory tree

SYNOPSIS
     patchtree [-znf] [-d] [-c[context]] [-u[context]] [-x file] ...  original
          target ...

DESCRIPTION
     Patchtree replaces all the files among the targets with  diff's  of  them
     and  files  from  original, or it replaces all the diff's found among the
     targets with the result of patching files from 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.

     In diff mode patchtree first maps all the files in original  recursively.
     Then  it  traverses  the 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.

     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.

     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.

     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:

          #*+-#*+- new-crc new-size old-crc old-size original

     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.

OPTIONS

     -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.



     -c[context]
          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.

     -u[context]
          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.

     -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.

     -n   Play act.  Just report what would be done, but don't do it.

     -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.

     -x file
          Exclude all files or directories named file from the originals.  Use
          one  or more of these options to keep patchtree from making diffs of
          some  files  like  makefiles  or  files   in   source-code   control
          directories.

ENVIRONMENT

     TMPDIR    Directory for temporary files, by default /tmp.

SEE ALSO
     diff(1), patch(1).

DIAGNOSTICS

     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.

     target == original
          The two files were found to be the same and unchanged files  are  to
          be removed (-z), so target is now gone.

     target += original
          This should be clear by now.


     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.

BUGS
     Patch may complain about finding no patches in an empty diff, even though
     it is told to be silent.

AUTHOR
     Kees J. Bot (kjb@cs.vu.nl)