paskvilwiki

up: version control

SVN

last updated 2013-12

change repository URL (Subversion 1.7+)

a few days ago i've migrated among servers, and along the way had to rename the user used via ssh to serve SVN

the problem - the URL of all repositories has changed. it's either endless diff, checkout, patch, or… dig into the SVN checkout and edit the repo URL!

pre-1.7 this was pure horror, as the URL was in every .svn/entries file in every folder. twice. so, you had to pretty much do your awk magic on find results

Subversion 1.7 introduced something magical - centralized metadata in an SQLite DB

now, to change old_url to new_url simply go to the root of your checkout, and

--- open the metadata DB
$ sqlite3 .svn/wc.db
--- check the repository table; with no externals, this contains just one row
sqlite> select * from REPOSITORY ;
--- change the URL
sqlite> update REPOSITORY set root = 'new_url' where root = 'old_url' ;

of course, if there is just a single row in the REPOSITORY table, you can leave out the where clause

patches and externals

creating and applying a patch - the --diff-cmd is necessary in case you set some graphical diff viewer in ~/.subversion/config:

cd root_of_project
svn di --diff-cmd diff > ~/patch.diff
cd root_of_other_project
patch -p0 -i ~/patch.diff

svn:externals - pull repo1 into dir1, and repo2 into dir2:

echo -e 'dir1 svn://repo1\ndir2 svn://repo2' > repos.txt
svn propset svn:externals . -F repos.txt

validate with svn propget svn:externals .