Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Use FileMerge for CVS diffs UNIX
I do Linux kernel development at work, but Xcode is my preferred editor, so I simply mount my CVS working copy to my Mac via NFS, and I can use command line CVS on my local machine with no problem. Unfortunately, Xcode requires the *.xcode project files to be a part of the CVS project for CVS integration in Xcode to work. The one feature I found I was really missing from the integration was the ability to use the excellent FileMerge application from developer tools for my CVS diffs.

For the cvs diff command, CVS uses rcsdiff. Unfortunately, CVS doesn't provide any straightforward way to use an alternate diff program, and it seemed like overkill to actually replace rcsdiff with a symlink to FileMerge. Inspired by a similar script for Windows on the CVS webpage, I created the following script to use in place of cvs diff.


if [ $# -eq 1 ]
   cvs update -p "$NEWFILE" > "$OLDFILE"
elif [ $# -eq 2 ]
   cvs update -p -r "$2" "$NEWFILE"  > "$OLDFILE"
   echo "usage: $SCRIPTNAME <file> [rev]"
   exit 1

opendiff "$OLDFILE" "$NEWFILE"
Put the code in a text file called whatever you want (I call it gdiff) and save it somewhere in your PATH variable. In the Terminal, do chmod u+x /path/to/script (if it's just for you), or chmod a+x /path/to/script (if it's for everyone). Now, to get a FileMerge diff on a file in your CVS working copy do gdiff /path/to/file to diff with the current repository version, or gdiff /path/to/file version to diff against an specific repository version. Note that your current directory must be part of the working copy so that CVS knows what repository to use.
  • Currently 2.67 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)

Use FileMerge for CVS diffs | 1 comments | Create New Account
Click here to return to the 'Use FileMerge for CVS diffs' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use FileMerge for CVS diffs
Authored by: below on Mar 22, '04 05:17:31PM

Very nice, thanks!


[ Reply to This | # ]