CVS
Last modified: January 11, 2007 - 08:47
If you keep drupal or selected modules under version control with CVS, you can create patches using the built in diff command.
- find the cvs.exe of your cvs package (WinCVS, TortoiseCVS, cygwin, ...) and make sure it is in your PATH
- cd to your working copy (eg drupal root dir)
-
cvs diff -u [[-r rev1|-D date1] [-r rev2|-D date2]] [file_to_diff] [> file_to_diff.patch]-u: unified format-r: revision(s) to diff- no -r: compare the working file with the revision it was based on
- one -r: compare that revision with your current working file
- two -r: compare those two revisions
-D: use a date_spec to specify revisions. examples: "1972-09-24 20:05", "24 Sep 1972 20:05".file_to_diff: path to the file or directory you want to diff. if you specify a directory, the output will include the diff of all differing files in this directory and all subdirectories.> file_to_diff.patch: creates a patch - saves the diff infile_to_diff.patchinstead of outputting it on stdout.- see the CVS manual for a complete list of and additional options
Line endings: an issue with using diff on windows is that generated patches have windows line endings, which makes them impossible to apply on unix boxes. unfortunately, there seems to be no way to convince "cvs diff" to output unix line endings. so the only way for making a proper patch on windows that i see is to convert / filter the output from "cvs diff" to unix line endings:
- filter: pipe "cvs diff"s output through some dos2unix tool (like the one from Robert B. Clark, or like cygwins's dos2unix / d2u):
cvs diff [options] file_to_diff | unix2dos -u > file_to_diff.patch - convert: save "cvs diff"s output to a file:
cvs diff [options] file_to_diff > file_to_diff.patch
and manually convertfile_to_diff.patchto unix line endings. every developers editor should be capable of this; besides, there are many dos2unix versions that operate on files.
