GDB Focus Group at the 2008 GCC Summit
Daniel Jacobowitz
drow@false.org
Tue Jun 24 18:28:00 GMT 2008
On Tue, Jun 24, 2008 at 09:35:46AM +0100, Andrew STUBBS wrote:
> Mark Kettenis wrote:
>> Objection! I have played with SVN for work and I really dilike the
>> fact that a checked out repository is very grep unfriendly.
>
> grep --exclude=*.svn-base
>
> I have it in an alias.
A slightly more thorough version attached, for anyone who wants it.
Another alternative is to use svk; one of the advantages is smaller
working trees.
--
Daniel Jacobowitz
CodeSourcery
-------------- next part --------------
#!/bin/bash
# svngrep - recursive grep safe for SVN trees (and quilt)
# Copyright (C) 2008 Daniel Jacobowitz <dan@codesourcery.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
args=()
files=()
next_opt=false
next_file=false
need_pattern=true
for arg; do
if $next_file; then
if $need_pattern; then
args=("${args[@]}" "$arg")
need_pattern=false
else
files=("${files[@]}" "$arg")
fi
elif $next_opt; then
next_opt=false
args=("${args[@]}" "$arg")
else
case "$arg" in
-e|-f)
need_pattern=false
next_opt=true
args=("${args[@]}" "$arg")
;;
-m|-A|-B|-C|-D|-d)
next_opt=true
args=("${args[@]}" "$arg")
;;
-r)
# Just consume -r.
;;
--)
args=("${args[@]}" "$arg")
next_file=true
;;
-*)
args=("${args[@]}" "$arg")
;;
*)
if $need_pattern; then
args=("${args[@]}" "$arg")
need_pattern=false
else
files=("${files[@]}" "$arg")
fi
next_file=true
;;
esac
fi
done
find "${files[@]}" -name .svn -prune \
-o -name .pc -prune -o -name \*~ -prune \
-o -type f -print0 | xargs -0 grep "${args[@]}"
More information about the Gdb
mailing list