//Tips tagged svn
Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
In bash (or anything using libreadline, such as mysql) press ALT+. to insert the last used parameter from the previous line.
Eg:
$ vim some/file.c
$ svn commit
Eg:
$ vim some/file.c
$ svn commit
Resolve all your conflicted files. Use with caution!!
svn st|awk '/^C/{ print $2; }'|xargs svn resolvedvimdiff <(svn cat -r ##ver## foo) foo
will put you in the usual vimdiff output, but comparing between ##ver## and your current version of foo
will put you in the usual vimdiff output, but comparing between ##ver## and your current version of foo
Sometimes, you want to add a lot of files to SVN from the command line. This simple command will find all unversioned files in an SVN checkout and adds them to SVN versioning.
for i in `svn status | awk '{if ($1 == "?") print $2}'`; do svn add $i; doneCASE: You've relocated Subversion and Trac repositories to another machine/directories. You don't want to edit n+1 trac.ini files.
You have for example:
/repos/svn-myprojects/my-first-project
/repos/trac-myprojects/my-first-project
/repos/svn-myprojects/my-second-project
/repos/trac-myprojects/my-second-project
...etc...
Change ALL trac.ini repository_dir settings:
trac-mass-repodir-edit.sh:
Usage:
Then you want to resync and upgrade all existing Tracs:
trac-mass-upgrade.sh:
Usage:
Now you have everything in order.
You have for example:
/repos/svn-myprojects/my-first-project
/repos/trac-myprojects/my-first-project
/repos/svn-myprojects/my-second-project
/repos/trac-myprojects/my-second-project
...etc...
Change ALL trac.ini repository_dir settings:
trac-mass-repodir-edit.sh:
#!/bin/bash TRACSPATH=$1 REPOPATH=$2 for i in $( find $TRACSPATH -maxdepth 1 -type d | grep -v "^$TRACSPATH\$" ); do BN=`basename $i` INIPATH=$i/conf/trac.ini TMP=$i/conf/trac.ini-temp # Replace repository_dir cat $INIPATH | perl -pe "s@repository_dir = .*@repository_dir = $REPOPATH/$BN@i" > $TMP mv $INIPATH $INIPATH-old && mv $TMP $INIPATH && rm $INIPATH-old done
Usage:
./trac-mass-repodir-edit.sh /repos/trac-myprojects /repos/svn-myprojects
Then you want to resync and upgrade all existing Tracs:
trac-mass-upgrade.sh:
#!/bin/bash
TRACSPATH=$1
REPOPATH=$2
for i in $( find $TRACSPATH -maxdepth 1 -type d | grep -v "^$TRACSPATH\$" ); do
BN=`basename $i`
# SVN directory exists
if [ -d $REPOPATH/$BN ]; then
echo "Processinc Trac: $BN.."
trac-admin $i resync
trac-admin $i upgrade
fi
done
Usage:
./trac-mass-upgrade.sh /repos/trac-myprojects /repos/svn-myprojects
Now you have everything in order.

