views:

54

answers:

2

Note: my code is written in flash but this is a SVN-related issue and is not a flash-specific.

I have a code library targeted at Flash Player 9 stored in an SVN repository. I want to create a modified version of the code targeted at Flash Player 10.

What are the best practices for maintaining both versions of the code? Should I create a branch for the FP10 version and maintain the two separately or is there some other preferred method? Ideally, I'd like to be able to fix common bugs for both code-bases simultaneously.

+3  A: 

You're correct...this is what branching is used for. If you make a fix in one branch, you can apply it to the other branch using svn merge.

Example:

svn checkout svn://path/to/fp9branch workingCopy
cd workingCopy
# make a fix
svn commit --message "Fixed bug with the frobbitz."
# Committed revision 42.
svn switch svn://path/to/fp10branch
svn merge --change 42 svn://path/to/fp9branch

Now you have applied the fix to the fp10branch and you can

svn commit --message "Fixed frobbitz bug for FP10."
Michael Hackner
nicely expressed answer - thanks.
Critical Skill
+1  A: 

alternative method is to use the CONFIG:: method, it works like #if defined() in C/C++

however, you would need to manually add this compile option into the compile line. If not it results in compile error (unable to recognise the tag)

Using this method, you do not need to make a branch in SVN.

Check the Flex Documentation for further information.

private static function SomeFunc():void {
    CONFIG::DEBUG {
      // do something here if CONFIG::DEBUG is defined during compilation
      trace("hello");
    }

}
Jeffrey Chee
I think I may do this because I'm using ant to build the SWC and it would be easy to add this.
Mims H. Wright