Friday 22 June 2007

svn-follow-log.sh

Script to see svn branch log,
 and follow on from the log if earliest entry was a "rebranch",
 and keep on doing that until branch was really created.

Trac and mergebot very very useful for managing svn branches.
Manages making of branches and essentially  branch merges or rebranch very nicely.
 (works with branches with a parent branch too instead of trunk)

We seem to have been burnt by a big merge out on a branch.
Many revisions and a good few rebranches and merges back to parent.
So need to follow log revisions.

On command line svn log --stop-on-copy reports how to get "Previous log" revision. And now that I know what to look for I see a "Previous log" link in the trac log of any changeset which is a rebranch merge.

~/bin/svn-follow-log.sh
#!/bin/bash

if [[ "$1" == "" ]] ; then
  echo "usage: xt <ticket-nnn>"
  #TICKET=ticket-720
  exit
fi

TICKET=$1

touch ${TICKET}follow.log
BRANCHREV=quantiqa/branches/${TICKET}
SVNROOT=https://source.commprove.internal/repository

while [[ $BRANCHREV != "" ]] ; do
#echo go go go;
svn log  ${SVNROOT}/${BRANCHREV} --stop-on-copy >> ${TICKET}follow.log
BRANCHREV=`tail -2 ${TICKET}follow.log |grep "Previous log" | sed "s/.*log:\(.*\) Previous.*/\1/"`
echo $BRANCHREV
done;

http://trac.edgewall.org/

http://en.wikipedia.org/wiki/Subversion_(software)

No comments: