Posts Tagged by Subversion
Notes on Branch Management with Subversion
| 24-Feb-2009 | Posted by Sonia Hamilton under Subversion |
Some notes on branch management with Subversion (more for my own learning purposes than anything):
- create branch: svn cp foo foo-branch
- develop new feature in foo-branch, whilst doing any bug fixes in trunk
- merge some changes from trunk into branch – keep branch up-to-date as possible
- commit any changes first, so can easily revert if desired: cd foo-branch; svn up; svn ci -m “pre merge in trunk”
- find where branch occured (if not noted in a log message – duh): svn log –verbose –stop-on-copy foo-branch (eg 123)
- preview changes succinctly: cd foo-branch; svn merge –dry-run -r 123:HEAD
- preview changes verbosely: cd foo-branch; svn diff –notice-ancestry -r 123:HEAD …
- apply changes: cd foo-branch; svn merge -r 123:HEAD svn+ssh://myrepo.com/foo/bar
- check changes: svn st; svn diff, if problems: svn revert
- commit changes: svn ci -m “merged trunk changes into branch (flubbed the widgets) r123:129″
- keep working in foo-branch, merge in some more changes
- ditto previous
- svn merge -r 130:HEAD svn+ssh://myrepo.com/foo/bar (previously merged up to 129, so start on 130)
- merge all changes from branch into trunk – new feature finished
- ditto previous
- cd foo; svn merge -r 123:HEAD https://myrepo.com/foo-branch
- svn ci -m “merged foo-branch into trunk (feature x) r123:145″
An alternative (and often easier) approach is to branch on the server, then just switch the working copy for the subdirectory (or individual file) being worked on:
- svn cp https://myrepo.com/foo https://myrepo.com/foo-branch
- cd foo
- svn info bar | grep URL
- cd bar; svn switch https://myrepo.com/foo-branch/bar; cd ..
- svn info bar | grep URL
- merge changes as above
Tags:
- tags are just copies (usually put in the tags directory): svn cp https://myrepo.com/foo/foo https://myrepo.com/foo/tags/foo-1.0. Tags aren’t read-only, but any changes can of course be reverted.
Directory structure:
- the canonical way of structuring directories is:
- /foo/trunk (or /foo/foo so name of trunk dir corresponds to project when checked out)
- /foo/branches
- /foo/tags
- I used to ignore this and just do /foo & /foo-branch, but this gets messy quickly and it’s easy to make mistakes or have problems when doing svn moves of large directories if you want to reorganise things later. Also, when working with branches I tend to want to just switch a subdirectory rather than checkout the whole branch, and this directory structure seems to logically help with this
Notes from Version Control with Subversion.
svn over an ssh tunnel
| 04-Dec-2007 | Posted by Sonia Hamilton under Ssh, Subversion |
Often a subversion server is on an internal server that can’t be reached by a DMZ server, and ssh+svn isn’t setup. Here’s a quick recipe for ssh tunnelling from the subversion server to the DMZ server and using svn.
root@svnserver$ ssh -R dmzserver 3690:svnserver:3690
root@dmzserver$ svn co --username sonia svn://localhost/unix/trunk/foo/ # so root not used
root@dmzserver$ svn ci --username sonia --password secret
Subversion Cheatsheet
| 09-Oct-2007 | Posted by Sonia Hamilton under Cheatsheets, Subversion |
- See also: svn command line tutorial for beginners 1
- Notes from: Version Control with Subversion
- Tsavo’s great svn cheatsheet
Quickstart
sudo aptitude install subversion
svnserve -d
Recent Comments
<<EOF>>was eaten...cat <>~/.vi...