SVN

Posted on January 1, 2012

1. svn ignore
svn propedit svn:ignore ./nbproject

2. svn create branch
a. Note the current head revision

svn info svn://server.com/svn/repository/trunk | grep Revision

b. Make a clean, remote copy of trunk into the branches folder. Name it something. We’ll call it your_branch:

svn cp svn://server.com/svn/repository/trunk svn://server.com/svn/repository/branches/your_branch -m “Branching from trunk to your_branch at HEAD_REVISION”

c. switch your local checkout to point to the new branch (this will not overwrite your changes):

svn switch svn://server.com/svn/repository/branches/your_branch .

d. Check that your local checkout is definitely now your_branch, and that you can update ok:

svn info | grep URL
svn up

3. updateing the branch

a. First, update your branch checkout and commit any outstanding changes.
b. Search the Subversion log to see at what revision number you last merged the changes (or when the original branch was made, if you’ve never merged). This is critical for making a successful merge

svn log –limit 500 | grep -B 3 your_branch

c. Also note the current head revision:

svn info svn://server.com/svn/repository/trunk | grep Revision

d. Merge the difference of the last merged revision on trunk and the head revision on trunk into the your_branch working copy:

svn merge -r LAST_MERGED_REVISION:HEAD_REVISION svn://server.com/svn/repository/trunk .

Replace LAST_MERGED_REVISION with the revision number you noted in step b, and HEAD_REVISION with the revision number you noted in step c.
Now look for errors in the output. Could all files be found? Did things get deleted that shouldn’t have been? Maybe you did it wrong. If you need to revert, run svn revert -R *.

e. Otherwise, if things seem ok, check for conflicts:

svn status | egrep ‘^C|^.C’

Resolve any conflicts. Make sure the application starts and the tests pass.

f. commit your merge.

svn ci -m “Merged changes from trunk to your_branch: COMMAND”

Replace COMMAND with the exact command contents from step 4.

4 folding the branch back into trunk

Hey, your_branch is done! Now it has to become trunk, so everyone will use it and see how awesome it is.

This only happens once per branch.

a. First, follow every step in the previous section (“updating the branch”) so that your_branch is in sync with any recent changes on trunk.

b. Delete trunk completely:

svn del svn://server.com/svn/repository/trunk

c. Move your_branch onto the old trunk location:

svn mv svn://server.com/svn/repository/branches/your_branch svn://server.com/svn/repository/trunk

d. Relocate your working copy back to trunk:

svn switch –relocate svn://server.com/svn/repository/branches/your_branch svn://server.com/svn/repository/trunk

Tags:

Categories: Uncategorized


Comments are closed