Back to the main page.

Bug 478 - implement an svn hook to replace the svn externals

Status CLOSED FIXED
Reported 2011-02-07 17:02:00 +0100
Modified 2011-02-23 13:51:10 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P1 normal
Assigned to: Robert Oostenveld
URL:
Tags:
Depends on:
Blocks: 490
See also:

Robert Oostenveld - 2011-02-07 17:02:21 +0100

#!/bin/bash # This post-commit script synchronizes multiple files in the same # repository, i.e. if you change and commit file1 in directoryA, then # file1 in directoryB is also updated. It can be used to replicate # identical versions of files at multiple locations in the repository. # # This script serves as a replacement for svn file externals, which # are very slow and require a lot of resources on the server when # used with svn+ssh. # # step 1: the working copy of the repository is updated # step 2: the changed file is copied over all other occurences of that file # step 3: all changes in the working copy are committed umask 0000 REPOS="$1" REV="$2" # this defines the working copy, which should be located on the svn server SYNCPATH="/Users/robert/tmp/working" # this specifies a text file to be checked to limit the files that # are replicated, e.g. if you have Makefiles at various locations, # you probably don't want those to be copied over each other REPLFILE=$SYNCPATH/.replicate # ensure that it is up to date, also including all additions/removals svn update $SYNCPATH/$FILE --ignore-externals # determine the files that have changed CHANGED=`svnlook changed -r "$REV" "$REPOS" | grep "^[U|A]" | awk '{print $2}'` for FILE in $CHANGED do BASE=`basename $FILE` FULL=$SYNCPATH/$FILE if ( grep -q $BASE $REPLFILE ) ; then # copy the changed file to each replicated instance of the same file find $SYNCPATH -name $BASE ! -path $FULL -exec cp -a $FULL {} \; fi done svn commit $SYNCPATH -m "automatically synchronized the replicated files"


Robert Oostenveld - 2011-02-07 17:04:40 +0100

and it should use a property like MacBook> if [ `svn propget replication file1` ] ;then echo 1; else echo 0 ; fi 1 MacBook> if [ `svn propget replication file2` ] ;then echo 1; else echo 0 ; fi 0 instead of the (hidden) .replicate file


Robert Oostenveld - 2011-02-12 23:40:50 +0100

finished, although some more testing would be desired


Robert Oostenveld - 2011-02-23 13:51:10 +0100

I closed all bugs that were in the RESOLVED/FIXED or otherwise RESOLVED state.