To better explain things, let us assume Downing has given us a project to do in which it has the first 4 projects in it somehow linked together. The next steps are rough and you should figure out the commands properly.
Suppose there is a bug with Primes.py. The proper way to fix this issue is to create a new tag in svn. This allows multiple branches so while you are working on the problem, another person can come in and branch off and do something like implementing a nice GUI. To do this do:
svn copy -m "Describing what you are doing"
Where is of the form .../svn/project/branches/this new branch.
Then check out the branch and start working on it. You should commit to this. If you make changes to this branch, the trunk does not change until you merge it at the end.
So make your changes and a final commit.
Do: svn --stop-on-copy "your copy" to get the revision number (preceded by r)
do svn switch
Do: svn status -q and get the revision number of the trunk.
Do a svn switch branchR:trunkR and this will point you to the trunk.
Do a merge.
Then now commit.
Congratulations your changes are now reflected in the trunk.
Now here is something you don't want to do.
In your branch do a svn add . Then switch and do svn add to the trunk. When you try to commit at this stage you will get an error saying that some file X is already in the trunk.
I got this error at work and took my a while to fix. Since you are at the trunk any svn delete command will mess things up and actually delete files. If you mess it up you can always revert it.
Do a svn delete
Then do a commit again. If get the same error with a different file go back a line. Else go to the next line.
Copy the files that were giving you trouble on your local machine (preferably good ones that work right before you messed things up) to a spot not in a branch on your local machine.
Delete the branch from svn. Make a new branch and checkout the newest code (your missing stuff).
Paste in the missing files/files that were giving errors. Do a svn add to those files. then commit and merge it back together. (Hopefully after making sure everything works again properly)
This should get rid of that error. If you ever get this error, you now know what to do.
Making branches makes it very easy to add features or fix "defects" with out possibly messing up the code that everyone checksout. Think about it, do you really want to checkout code that works horribly more or is incomplete and breaks alot of things. Or would you rather get a good working copy and modify it.
Next post: SVN, JIRA, TRAC all rolled together.
No comments:
Post a Comment