This script works well, and flexibility could be added for support for
recursive searching through directories, but in the case of long living
repository with a large number of revisions, this could get really slow,
and with adding the flexibility of recursive searching, it could get
unbearably slow.
I think that this is a great workaround in the interim, but another
issue is that it only works on Linux/UNIX, and even though a user could
install cygwin or a command.com script could be written, it still would
be cumbersome.
After more thought I really feel that this should be added to the
subversion client/server modal - meaning that the client should ask the
server to do the work for the grep since (for example in the case of
this script) if the client does the work, the server still has to send
revision after revision to the client anyway. Another reason for having
this built into subversion is that there would be a common interface for
searching whether it be on windows or Linux. I could also imagine that
this would be available in the api so that third party utilities could
use this enhancement natively.
On Wed, 2006-09-20 at 12:33, Reedick, Andrew wrote:
> > If there is a way of doing this without regressing through
> > every version
> > of a file, I would like to know, and if there is currently no way of
> > doing this, I believe it would be a valuable feature to Subversion.
>
>
> ./rev_grep.sh URL[@PEG_REV] regex
>
> The PEG_REV only works in svn 1.4.0 or higher. ('svn log' supports peg
> revs in 1.4.0)
>
>
> rev_grep.sh
> =====================
> #!/bin/ksh
>
> URL=$1
> REGEX=$2
>
> LAST_REV="n/a"
>
> svn log -q $URL | perl -ne 'print "$1\n" if /^r(\d+)/' |
> while read r
> do
> ##svn cat -r $r $URL | grep "$REGEX" > /dev/null
> BUFFER=`svn cat -r $r $URL | grep "$REGEX"`
> RET=$?
> if [ $RET -eq 0 ]
> then
> echo "Match in revision: $r. Removed in $LAST_REV."
> echo $BUFFER
>
> exit 0
>
> elif [ $RET -ne 1 ]
> then
> ## grep hit an error
> exit 2
> fi
>
> LAST_REV=$r
> done
> exit 1
>
>
> *****
>
> The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential, proprietary, and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers. GA624
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Thu Sep 21 17:11:03 2006