37 lines
748 B
Bash
Executable File
37 lines
748 B
Bash
Executable File
#!/bin/sh
|
|
|
|
## Aufruf
|
|
## $ svngrep PATTERN DEVICE(S)
|
|
##
|
|
## Es wird ohne Rücksicht auf Groß- Kleinschreibung nach PATTERN gesucht
|
|
## Berücksichtigt werden alle Dateien die auf DEVICE(S) matchen. Bsp router-*
|
|
## Die Suche endet nach 10 Revisionen
|
|
|
|
pattern=$1
|
|
|
|
for file in $@;
|
|
do
|
|
i=0
|
|
svn log -q "$file" 2>/dev/null | perl -ne 'print "$1\n" if /^r(\d+)/' |
|
|
while read r
|
|
do
|
|
match=`svn cat -r $r "$file" | grep -i "$pattern"`
|
|
result=$?
|
|
if [ $result -eq 0 ]
|
|
then
|
|
ts=`svn propget svn:date --revprop -r $r`
|
|
/bin/echo "$file @r$r $ts:"
|
|
/bin/echo "$match"
|
|
/bin/echo
|
|
elif [ $result -ne 1 ]
|
|
then
|
|
exit 2
|
|
fi
|
|
i=`expr $i + 1`
|
|
if [ $i -eq 10 ]
|
|
then
|
|
exit 2
|
|
fi
|
|
done
|
|
done;
|