flogiston

Blog

Subversion - Command line samples

· admin · Dev, Linux

Some of the svn commands I use from time to time.

Find the revision number when a branch was created

svn log --verbose --stop-on-copy urltosvnbranch

Merge latest changes from the runk to your branch

When you're working on a branch and you wish to bring it up to date with changes made in the trunk, these are the steps required.
This assumes the last revision that was merged was 55.

  • make sure all files have been commited both in trunk & branch
  • cd svnbranchdir
  • svn merge --dry-run -r:55:HEAD urltosvntrunk .
  • if dry-run ok:<code>svn merge  -r:55:HEAD  urltosvntrunk .
  • resolve conflicts
  • svn commit

Switch your working copy from a branch to the trunk

svn switch urltosvntrunk

List all changes since a given revision

cd to your working copy
svn log -q -v -r 60:HEAD | grep trunk  | sort -u

Update issues

Sometimes we notice that the svn marks a folder as being up-to-date while the files in that folder aren't. By default svn stops when it reaches a folder that is up to date. To force svn to go down all directories is:

svn update --set-depth infinity

SVN Cheat sheet

I also found this svn cheat sheet

Migrate an SVN repo


svnadmin dump /path/to/repo > reponame.dmp
cd /path/to/newrepo
svnadmin create newreponame
svnadmin load newreponame < reponame.dmp

Or, when it's a huge repository:
Pipe the archive to a tar.gzip file when dumping


svnadmin dump /path/to/repo | split -b 700m – reponame.dump.tar.gz
svnadmin create newreponame
cat reponame.dump.tar.gz* | svnadmin load /path/to/newrepo

Source: http://www.digitalmediaminute.com/article/2251/how-to-move-a-subversion-repository

Merge between branches

task: merge changes from branch1 to branch2 that have been excluded when merging from branch1 to trunk

svn merge  urltotrunk@7479 urltobranch1 .

7478: moment of merge from trunk to branch1
7487: moment of merge from branch1 to trunk
7488: moment of create branch2
wc: branch2