SVN : Export modified files of revisions committed with specific comment -
i'm using svn commit comments associate keywords commited files. i'm trying find commited files - in revision - having specific keyword in comment. possible ?
thanks advance !
edit more info : can use tortoisesvn (from local, windows 7 64bit) or command line (from our integration server, linux)
edit again : "show log" in tortoise don't let me searching date. right can't search last year... 15/02/2012... way fix ?
=============================================================================
final answer : made work wanted. wanted these logs use them svn exports. final script named exportallrevisionsfromkeyword.sh :
#!/bin/sh if [ ! $1 ];then echo "no keyword specified. needs example ticket number : project-xxx. command : ./searchcommitsfromcomment.sh project-xxx";exit;fi cd /root/projets/myproject/ search=$1 echo "searching revisions committed keyword "$search svn log | awk '{ if ( $1 == "------------------------------------------------------------------------") { getline revision = $1 } else { if (match($0, search)) { print "keyword found in " revision ". export coming..." system("./var/batchesfolder/svnxport.sh . " substr(revision,2) " var/batchesfolder/sorties/svnexports/" search) } } }' search="$search"
as can see i'm calling script. inspired julien falconet's tutorial, named svnxport.sh :
#!/bin/sh # svnxport.sh # export modified files in svn # # copyright (c) 2009 julien falconnet # http://www.falconnet.fr # # program free software; can redistribute and/or modify # under terms of gnu general public license published # free software foundation; either version 2 of license, or # later version. # # #beware : script not operate correctly files filename contains spaces # tests parameters if [ ! $1 ];then echo "svnxport : no source specified. needs : source revision target_directory";exit;fi if [ ! $2 ];then echo "svnxport : no revision specified. needs : source revision target_directory";exit;fi if [ ! $3 ];then echo "svnxport : no target_directory specified. needs : source revision target_directory";exit;fi # check if target_directory allready exists #if [ -d $3 ];then echo "svnxport : target_directory '$3' allready exists. remove or change target_directory parameter.";exit;fi # use svn diff select changed files between $2-1 , $2 revisions , keep updated or added. sourcedir=$1 revision=$2 previous=$(($revision - 1)) targetdir=$3 escapedsourcedir=$1 if [ $escapedsourcedir == '.' ] escapedsourcedir='\\.' fi echo "processing : source($sourcedir), revision($revision), target_directory($targetdir)" # 'for' separate status filename (here problem file blanks) myfile in `svn diff -r $previous:$revision --summarize $sourcedir | grep -e '^m ' -e '^a '` if [ "$myfile" = "m" -o "$myfile" = "am" -o "$myfile" = "a" -o "$myfile" = "." -o -d $myfile ] # ignore status, , directory update continue else #we focus on true changed files #first create needed directories current file #note use relative directory system outfile=`echo $myfile |sed "s|$escapedsourcedir||g"` dir="$targetdir/$outfile" mkdir -p $(dirname $dir) #then export file svn export --force $myfile $targetdir/$outfile >> /dev/null echo "export $targetdir/$outfile " fi done # list other files. changed not exported. deleted ones. # usefull know files should removed , follow weird comportment #echo "watch : " #svn diff -r $previous:$revision --summarize $sourcedir | grep -v -e 'm ' -e 'a ' |sed "s|$sourcedir||g" echo $'\n'
and now, action cd versionned website root, , call ./path/to/scripts/exportallrevisionsfromkeyword.sh project-xxx
it search revision committed comment containing "project-xxx" keyword, , export head revision of files modified revision new folder : path/to/scripts/sorties/svnexports/project-xxx
i need nishant helpful link gave me. thank ! :)
Comments
Post a Comment