creating patch for CVS tree

Sergei Organov osv at
Wed Jun 28 13:53:37 UTC 2006

Jerry Needell <jerry.needell at> writes:
> I'll admit to being confused ans a novice with CVS. I downloaded the
> tree via CVS and have made some changes. The changes were to
> a few existing files and I have added some new files in existing
> subdirectories and added a new subdirectory. The code builds and tests
> so now I am trying to generate a patch for submission. How do I
> generate the patch? So far my attempts have genrated diff files that
> include only chages to the pre-existing files, but do not include the
> new files or subdirectory. Can someone give an example of the proper
> way to  generate the patch?

Unfortunately CVS has very poor support w.r.t. to read-only
repositories. To generate proper patch with CVS, you need to 'cvs add'
the new files, but CVS doesn't allow to do it with read-only
repositories :(

Now, the simplest way to do it (for me) is to checkout another tree (use
'cvs ... checkout -d rtems.orig ...' to get the tree to different
directory) from CVS then use usual command-line diff to get the
patch. Provided your modified tree is called 'rtems', and non-modified
one checked out to 'rtems.orig', the command to generate the patch is:

diff -Naur --exclude=CVS rtems.orig rtems > rtems.patch

Look at rtems.patch with your favorite editor to see if it includes some
unneeded information, and re-generate it by adding more --exclude
options, e.g., to exclude backup files and some CVS-generated files, use:

diff -Naur --exclude=CVS --exclude='*~' --exclude='.#*' \
  rtems.orig rtems > rtems.patch

Don't forget to 'cvs update' both trees in turn before generating patch
to make sure they are identical (except for your changes).


More information about the users mailing list