Marc Paquette

CodeWarrior 8- & 16-bit tools: Version Control Rules

Discussion created by Marc Paquette Employee on Jan 27, 2006
To help you find solutions to problems that have already been solved, we have posted this message. It contains an entire topic ported from a separate forum. The original message and all replies are in this single message.

Posted: Oct 28, 2005 - 05:08 PM   
I'd like to use the Subversion version control system with Metrowerks CW 3.1 for HC(S)08 including the Processor Expert. I use the TortoiseSVN interface, so I don't need a plugin.
However, I do need advice about which files and directories to put under version control and which to leave out, as well as which patterns to exclude/ignore.
Although I'm using Subversion, I imagine that the same rules would apply to CVS or any other version control system.
Thanks in advance,
- Richard 
Posted: Oct 31, 2005 - 09:15 AM   
This depends of your need.
You can put all the project folde or only:
- all sources files (.c, .asm, .h, ...),
- the prm file,
- export the project in xml file format (to have all project settings).
Pascal Irrle 
Posted: Oct 31, 2005 - 11:14 AM   
Dear Pascal Irrle,
Thanks for responding.
> This depends of your need.
My needs are simple:
(a) When I check out a revision into an empty directory, CW should compile the result, including recognizing the processor expert changes, and
(b) When I update a revision -- i.e., try to bring my working copy up-to-date with the repository -- the only files that should require attention are ones that I caused to be altered that differ from those in the repository and that I have to bring into alignment, because CW cannot.
> You can put all the project folde or only:
This causes major problems, because unnecessary files will be placed under version control, and they will frequently cause conflicts. When these files are not simple ASCII files, the programmer has no way to resolve the conflict.
> - all sources files (.c, .asm, .h, ...),
Are these enough? What about files that CW uses to determine various aspects of the project, e.g., the .mcp, .g_c, and .pe files? What about the .txt and .xml files in the DOC directory?
> - the prm file,
This file states that it is generated by the [processor expert] tool. Wouldn't it be rebuilt if absent? If so, wouldn't it be better left out of the repository?
> - export the project in xml file format (to have all project settings).
Is the intent that this replace the .mcp file with a .mcp.xml file? It places a real burden on the programmer when he checks in his project to make him remember to generate this file first and again when he checks out or updates a project to have to have to remember to import it -- two major places for errors of omission to occur!
The problem is that deciding what to do requires knowing a fair amount about how the CW system for the HC(S)08 with the processor expert works. Which files and directories must be present, and which ones will it generate? Among other things, it entails figuring out which file patterns to ignore -- .o .bak .lst .s19 .abs .bpt .dbg .map .mrk all seem like good candidates. Are there others? And what should we do with .ini, .stg, and .tdt files? Can we safely throw all of them away, relying on CW to regenerate or update them if needed?
We have to know which files to keep besides the obvious ones, .c .h .asm, and we have to know which directories to keep or ignore; but if ignored, we have to know that CW will generate them as needed. For example, it looks like every file in the bin directory can be excluded, but if the bin directory itself is missing, CW cannot generate code.
Someone out there must have solved this problem already, if not for Subversion then for CVS or another version control system.
Best regards,
- Richard 
Posted: Nov 01, 2005 - 06:47 AM   
Difficult to answer.
I think you should include:
- all sources files (asm, inc, c, h, ...),
- all sources files generated by Processor Expert including the prm file,
- the .pe, .G_C and .dsk.
these files contain all Processor Expert config and are in txt format.
- the mcp file contains the project settings as compiler options.
This file can not be read by the VCS tool directly.
You must export the project in xml file and include this file.
This should be enough to be able to rebuild a project.
Processor Expert (PE) is a code generator.
If your project has been configured in order the prm file is generated by PE.
If the prm file is deleted you need to re-generate the code using PE tool. The config contained in the .pe, .G_C and .dsk contain all info to build the same prm file and all files generated by PE.
Hope this will help you.
Pascal Irrle

Posted: Nov 02, 2005 - 02:56 PM   
Thanks. I'll try your suggestions and see how well they work for me.
I would strongly suggest that Metrowerks restructure CW for version 3.2 so that its projects can be managed properly with revision control software. It looks like this shouldn't be too hard a task, mainly replacing the .mcp file by its .xml version, perhaps rearranging the directory structure a little, and then publishing the necessary rules for version control in the manual. The start-up code might have to be altered to recognize missing pieces and regenerate them. [Easy for me to say, since I don't have to do the work and deal with all the resultant problems!] Note that I am not suggesting the addition of a version control facility within CW itself, partly because this would cause religious wars between supporters of various different systems. Nevertheless, making CW compatible with external version control would allow it to be used in a more professional manner.
Best regards.
- Richard