[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: svn grep -r2:5 "a_word" filename1 filename2 folder3

From: Hanley, James <jhanley_at_redcom.com>
Date: 2006-09-21 17:10:11 CEST

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
> 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: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Sep 21 17:11:34 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.