Showing posts with label subversion. Show all posts
Showing posts with label subversion. Show all posts

Thursday, 20 November 2008

svn incremental backup

Just for archiving. I've got it from somewhere but i'm unable to find it. In order to create mirror repository of one already available somewhere follow these steps: $REPO = where you wan't to keep mirror (local path) $SOMEWHERE = where is your original repo
svnadmin create REPO
Add hook that will disallow of commit by anyone except svnsync fake user:
cat > REPO/hooks/pre-revprop-change

#!/bin/sh
USER="$3"
if [ "$USER" = "svnsync" ]; then exit 0; fi
echo "Only the svnsync user can change revprops" >&2
exit 1
^Z

chmod +x REPO/hooks/pre/revprop-change
Finally initialize mirror:
svnsync --username svnsync initialize file://`pwd`/REPO svn://SOMEWHERE
Now each invocation of:
svnsync sync file://$REPO
synchronizes mirror with master. Sample crontab:
* * * * *        sync-svn-repo $REPO
(which means run sync-svn-repo script with parameter $REPO on start of every minute) sync-svn-repo is simple shell script:
#!/bin/sh
repo=$1
(
    echo "---- synchronizing at `date`"
    /usr/bin/svnsync sync file://$repo
    echo "---- finished: exitcode($?)"

) 2>&1 >> $repo/synch_log.log

Thursday, 21 February 2008

subversion and output folders

Wow, first post in this blog. This post may be interesting fot those are going to import some big old stuff into subversion. Below is depiction of one of problems I've encountered today. Never ever add your 'release', 'target', 'bin' or whatever directories into subversion. If you'll import big project and for whatever reason you'll add placeholders for output directories you're buried. At first update (after build you'll) realize that 'insert name of your favorite build system' removed your bin directory (and it's .svn metafolders). Svn will immediately start to complain with something like this:
svn: 'product\library\foo\bin' is not a working copy directory
In order to fix this mess you'll have to: 1. remove directory in question
rm -rf product\library\foo\bin
2. order svn to cleanup it's internal mess
svn cleanup product\library\foo
3. update in order to resurrect broken folders
svn up product\library\foo
4. finally remove this folder
svn rm product\library\foo\bin
So if you'll happen to have 20 folders with this setup in your repo you'll have few minutes of cleanup. Avoid it!