Several win diff programs
Last modified: November 7, 2008 - 16:36
(against a cvs source with the cvs.exe built-in diff. do diff local files, you need a windows diff program, command line or visual)
- Generic:
-
- find the cvs.exe of your cvs package (WinCVS, TortoiseCVS, cygwin, ...) and make sure it is in your PATH
- cd to your 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. if you send a patch, make sure it has the proper line endings- see the CVS manual for a complete list of and additional options
- WinCVS: Menubar > "Admin" > "Preferences" > "WinCVS" > "External diff program ". This program will be invoked by the "Diff selection" when "Use the external diff" is checked.
- TortoiseCVS: CVS > "Preferences" > "External diff application". This program will be invoked by "CVS Diff ..."
- Araxis Merge (commercial)
- Beyond Compare (commercial)
- UltraCompare (commercial)
- ExamDiff
- CSDiff
- for those who can live w/ java: Guiffy (commercial)
- KDiff
- WinMerge
- you may find more here
Notes:
- While these programs do a nice job in showing file differences visually, side by side, non of them (as i can tell) allows to actually save the difference in unified format (most allow to save a standard diff, though) - update: TortoiseCVS lets you save patches. It does unified format by default. See its Make Patch option. Note that this 'Make Patch' option can make recursive patches when applied to directories.
- You cannot specify the "-u" in the External diff preferences (eg "diff -u") as this will result in "Unable to open 'diff -u' (The system cannot find the file specified.)". A workaround for this is to, in the preferences, specify a batch-file that calls the external diff with the -u option. Another workaround is meta-diff, which allows for launching of special diff programs for certain file types.)
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 [1][2]. 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.
