Code management - how to work with multiple versions of the same libraries

I'd like some advice on how to manage arduino code libraries. I have arduino based projects that can run autonomously for several weeks, they gather data and log any errors they encounter, and once every few weeks I get to review the log files and fix any bugs they highlight. The result is that by the time I get to find out about the bugs, that version of the library(s) may be several versions out of data.

At the moment my code is structured as follows... I have a directory called 'librarys', within that I have sub-directories called, for example 'tom', 'dick and 'harry', each of these has two same-named files, tom.h and tom.cpp. Each file will contain the code for a single class whose name matches the file. (my first question is, is this how I'm supposed to structure these files? or should I be including multiple classes within each file?)

Each time I build a new version of a project, I run a powershell script to backup a copy of the 'librarys' directory (including all it's subdirectories) and append the version number to the directory name.

When I come to start working on an old version of a project, I have to move my current version of the 'librarys' directory to somewhere safe, and restore my backup version.

This can all get a bit fiddly, and is prone to 'finger trouble'. Is there a better/simplier way of managing this? I've looked at couple of code management tools, but they all seem to be excessively complicated.



This is a classic code versioning problem, and the best solution is to use a code versioning tool. CVS is reasonably easy to use but there are plenty of others. Github is fashionable for this, and free if you're willing to make your project open source. The scheme using these tools would be that your working directory (i.e. My Documents\Arduino) does not contain the master copy of your code. Instead, it contains a working copy that is checked out of the repository. Once you have completed your work, you check your code modifications back into the repository. With this approach you can check out any previous version you want into your working directory, without losing anything. You can see which files changed between versions, what the changes were in those files and what the purpose of those changes was. You can support concurrent development on multiple versions, if you want.

CVS is reasonably easy

Thanks, this isn't one I've reviewed yet, I'll check it out.