Posts Tagged ‘svn’

svn-tools: mysvn

Monday, January 11th, 2010

Scenario: subversion repository installed on a home-server. Sometimes you need to interact with it from the L.A.N. and sometimes from internet.

This script other then being a wrapper for svn, checks whether the working copy needs to be relocated or not before the operations.

#!/usr/bin/env bash

GATEWAY_IP=192.168.0.254
GATEWAY_MAC=00:14:6c:ab:d2:ca
REPO_LOCAL=192.168.0.4
REPO_REMOTE=code.matteolandi.net

arp -a | grep $GATEWAY_MAC > /dev/null
if [ $? -eq 0 ]; then
 source=$REPO_REMOTE
 destination=$REPO_LOCAL
else
 source=$REPO_LOCAL
 destination=$REPO_REMOTE
fi

url_before=$(svn info | grep URL | cut -d ' ' -f 2)
url_after=${url_before/$source/$destination}

if [ "$url_before" != "$url_after" ]; then
 echo "Relocating ${url_before} -> ${url_after}"
 svn switch --relocate $url_before $url_after
 if [ $? -ne 0 ]; then
   exit 1
 fi
fi

svn $@

I know you could create a new entry inside /etc/hosts and use it depending on the situation, but easy solutions are not my best!

Obviously you will find it inside the hacks/svn-tools repository.

svn-tools: svn-feed update

Monday, January 4th, 2010

Few changes regarding the script for the creation of the rss feeds of the commits. Indeed, I decided to create a new one from scratch using python. With this you will be able both to update the feeds and create them from the origins of your repositories.

You can find the tool inside the hacks repository.

Update: hacks repository

Tuesday, July 28th, 2009

I decided to move the svn-tools repository inside hacks.