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

Fix Compare/Merge in Project Builder CVS Apps

Note: I'm using Project Builder v2.1 (December 2002); the following may or may not apply to other versions.

I've just recently starting using CVS within Project Builder (PB), and I must say it's pretty useful and time-saving. I've used FileMerge for a long time, so I was naturally looking forward to using it automatically with PB. I imported a test project into CVS, checked it out, and opened the project in PB. As expected, PB recognized the CVS and integrated it with the project. PB correctly identified modified files and commited them without a problem. But then I went to compare a file with the last revision ... no go.

PB is supposed to automatically fetch the specified revision from CVS and open FileMerge, comparing your local copy with the CVS version. Even though PB would give the status message that the compare had successfully completed, it hadn't. Nothing happened. Checking the Console, I saw the culprit errors (line breaks added for readability):

2003-09-11 21:14:48.855 Project Builder[5179] pbcvsdiff returned:
2003-09-11 21:14:42.754 /System/Library/PrivateFrameworks/
cd: subdir: No such file or directory
cp: subdir/ No such file or directory
2003-09-11 21:14:48.572 opendiff[5246] /tmp/pbcvsdiff.5231/ does not exist
So, off I went to find this pbcvsdiff.

As it turns out, pbcvsdiff is a helper script for PB, and it has bugs (PB 2.1 aka December 2002 version). Thankfully, they weren't too bad, and I fixed them -- read the rest of the hint for the how-to...

All offending lines were in one function, GetCVSRevision(). Here is a fixed version of the function that you can copy and past over the function in your own pbcvsdiff file:

    ( cd "${DIFFDIR}";
#     Changed By Alex:
#     For some reason, PB couldn't properly execute the 'cd' command.
#     Bizarre.
# mkdir subdir;
#    cd subdir;
  mkdir CVS;
  echo "" > CVS/Entries;
  echo "${REPOSITORY}" > CVS/Root;
  echo "${REPOSITORY_BASE}/${RELATIVE_PATH}" > CVS/Repository;     
  if [ "${1}" = "PBXSCMCompareTopOfTrunkRevision" ]; then
    cvs update "${FILE}" 2>&1 > /dev/null;
    grep "/${FILE}/" CVS/Entries | cut -f3,3 -d/ > "/tmp/___CVS_VERSION_FILE_${FILE}"
    cvs update -r$1 "${FILE}" 2>&1 > /dev/null;
# Changed By Alex:
#   We don't need to change up because we never changed down.  Therefore, the 'cp'
#   command should be changed.  Making it a 'mv' avoids having a file in the tmp
#   directory with the same name as your working copy.  Finally, we don't need to
#   remove the subdir because we never created it in the first place.
#   cd ..;
#   cp -r "subdir/${FILE}" "$2";
  mv "${FILE}" "$2";
#   rm -rf subdir;

Alternatively, you can just download my version of the entire script and replace the default version with it. The path to the default version is /System -> Library -> PrivateFrameworks -> PBXCore.framework -> Resources -> pbcvsdiff.

That's it! The compare and merge functions in PB should now work properly, opening FileMerge for you. Enjoy!

Note: There are a couple of hints in the database about setting up CVS in Project Builder if you need help with that. There is also a good series of articles (1, 2, 3) about using CVS and source code management (with and without Project Builder) on Finally, over at Apple Internet Developer, there's another article about using CVS.

  • Currently 2.67 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)

Fix Compare/Merge in Project Builder CVS | 3 comments | Create New Account
Click here to return to the 'Fix Compare/Merge in Project Builder CVS' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
changes on download
Authored by: dustox on Sep 16, '03 02:00:36PM

If you download the changed file and replace the default one remember to make the new file executable. I also changed the owner to root and the group to wheel to match what it was before, just in case it mattered.

[ Reply to This | # ]
Fix Compare/Merge in Project Builder CVS
Authored by: dr_turgeon on Sep 16, '03 11:39:41PM

Cool, but how do you get PB CVS to properly handle nib files (which are binary) and proj files (which are nested)?

[ Reply to This | # ]
Fix Compare/Merge in Project Builder CVS
Authored by: Xtapolapocetl on Sep 19, '03 08:21:35PM

To make CVS deal with binary files, check them in with the -kb switch:

cvs add -kb file.nib

Nested files like project files are just directories, check them in like any other directory of files.

[ Reply to This | # ]