Overview
Bugs happen and sometimes you need to create a patch. Best way to do this using SVN is to take an existing tagged version of your code (which you hopefully do before each build) and create a branch off of it.
Approach
For this to happen you need to know which tag to use and what you want to call the branch. In the example below, I am using
20141205_Version_R8–1–0–07 as my tag. Within this location is an SVN copy of what was in trunk at the time the tag was created.
Look at the contents of the tag
To see the contents of the tag, use the following command
> svn list http://svn.homeworld.lan/repos/python/tags/20141205_Version_R8-1-0-07/
You will get a listing similar to what you would see in trunk.
Create the Branch
To create the branch all you will do is tell SVN to copy the contents from the tag into a new (non-existing) target folder. In this case the folder within branches is called
20150205_R8–1–1_Patch. Remember that this folder will be created and filled by SVN automatically so the name of the target folder is all you need to provide.
> svn copy http://svn.homeworld.lan/repos/python/tags/20141205_Version_R8-1-0-07/ \
http://svn.homeworld.lan/repos/python/branches/20150205_R8-1-1_Patch \
-m "Creating a branch off of tag 20141205_Version_R8-1-0-07"
Committed revision 630.
Once completed you will see a revision number (630 in this case)
Look at the contents of the new branch
To confirm that the
branch worked as you would expect, you can get a listing like you did for the
tag.
> svn list http://svn.homeworld.lan/repos/python/branches/20150205_R8-1-1_Patch
Getting to Work
Now that this is done you can checkout the code from the branch into a working directory and get to work solving the worlds problems (certainly not your own).
> mkdir 20150205_R8-1-1_Patch
> cd 20150205_R8-1-1_Patch
> svn checkout http://svn.homeworld.lan/repos/python/branches/20150205_R8-1-1_Patch ./
Conclusion
Using a few commands you can easily create a
branch from a
tag. If you do not happen to have a
tag available, you can
branch off a specific revision of your
trunk using the
revision command line option. But hopefully you will create tags as you go for each build you create or for each release pushed to SQA or any testing group.
No comments:
Post a Comment