Tag Archives: CVS

Merging Git and CVS

Today I found myself needing to run ahead of the current stream of development and code some things to be merged in later.  I needed the flexibility of easy branching and merging atop a code base that’s maintained in CVS.   CVS branches are overkill and Eclipse/CVS change set grouping is too limited.  What I really wanted was Git, but migrating wasn’t an option, and doing a full git cvsimport would take forever.  I just needed simple local changesets atop the shared CVS repository.

Fortunately, I stumbled across a simple workflow by Kris Johnson that met my needs perfectly.  I used it with a few minor variations, such as synching (cvs update) differently, using TortoiseCVS for a few operations, and doing the final commit via Eclipse (so that I could get one last look at the changes in the Synchronize view).  But it’s a very helpful process that I’ll hang on to.

While I’m jotting things down, here’s the .gitignore I created for the Eclipse/Java projects I’m working on.

CVS/

bin/
*.class
*.jar
*.zip

*.~
*.dat
*.cache
*.lock
*.log
*.out
*.swp

Back In Time

A common problem with CVS is that it doesn’t preserve file modification timestamps.  For normal source control, preserving or relying on these timestamps is neither needed nor recommended.  But there are plenty of cases where this is a legitimate requirement, such as storing non-source files used directly by customers.  Rough partial workarounds are possible in CVS (such as “import -d” and Entries file hacking), but these are incomplete, kludgy, and problematic.

So, a simple solution I used today is to generate a script that can put back the original timestamps:

find . -printf ‘touch -c -t %TY%Tm%Td%TH%TM “%p”\n’

I checked the generated script into CVS alongside the files so it can be re-run and updated as needed.