Resolving Drupal CVS Merge Conflicts

We manage our sites via SVN by first checking core and contributed Drupal modules from cvs.drupal.org. An explanation for this deserves its own post (coming soon...), but basically we check out from cvs.drupal.org and then import that into our SVN repository. When a security or feature release is available, we simply update, for example, the module and then commit it into SVN:

cvs up -r DRUPAL-6--2-3
svn commit -m 'updating to version 2.3, patches security hole'
Sometimes, however, we run into merge conflicts between our local working copy and the remote CVS. Typically this would be caused by modifying our local copy in the same areas that the module's maintainer has -- leaving CVS to try and figure out which modification should be kept. In our case, we never made changes to local files, but for one reason or another, the CVS commits didn't jive with our local copy. In this case, CVS will warn you with something like this:

RCS file: /cvs/drupal-contrib/contributions/modules/cck/Attic/userreference.info,v
retrieving revision 1.2.2.2
retrieving revision 1.2.2.3
Merging differences between 1.2.2.2 and 1.2.2.3 into userreference.info
rcsmerge: warning: conflicts during merge
cvs update: conflicts found in userreference.info
C userreference.info

In this particular case, there was a line in the working copy userreference.info that no longer existed in the latest CVS revision. Normally, I don't think this should be an actual conflict, but either way, there is something you can do to avoid having to manually edit conflicted file and resolve the conflict (unless you've actually made legitimate changes locally that you wish to keep). To tell CVS to ignore local edits and refresh your working copy with a clean copy of which ever revision you are updating to, just add on the -C option to your CVS update command:

cvs up -C -r [DRUPAL revision number]
Another good practice is to qualify your update statement with the -d option, which will bring down any new directories added to CVS. Otherwise, CVS only cares about letting you know about changes in files in directories currently in your working copy:

cvs up -C -d -r [DRUPAL revision number]