root/trunk/scripts/warning-blame.sh

Revision 658, 2.3 kB (checked in by takkaria, 6 months ago)

Make the warning-blame script a little more project-agnostic.

  • Property svn:executable set to *
Line 
1 #!/bin/sh
2
3 # Copyright 2007 Vincent Sanders <vince@debian.org>
4 # All rights reserved.
5
6 # Taken from the NetSurf SVN repository:
7 # http://source.netsurf-browser.org/trunk/netsurf/utils/warning-blame.sh
8
9 # Redistribution and use in source and binary forms, with or without
10 # modification, are permitted provided that the following conditions
11 # are met:
12 # 1. Redistributions of source code must retain the above copyright
13 #    notice, this list of conditions and the following disclaimer.
14 # 2. Redistributions in binary form must reproduce the above copyright
15 #    notice, this list of conditions and the following disclaimer in the
16 #    documentation and/or other materials provided with the distribution.
17 # 3. Neither the name of the Author nor the names of its contributors
18 #    may be used to endorse or promote products derived from this software
19 #    without specific prior written permission.
20
21 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
22 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
25 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 # SUCH DAMAGE.
32
33
34 # where to store the processed list of warnings
35 WARNING_LIST=/tmp/warning-list
36
37 if [ $# != 1 ]; then
38         echo "Syntax: $0 <warning-file>"
39         exit 1
40 fi
41
42 if [ -f $1 ]; then
43         cp $1 ${WARNING_LIST}
44 else
45         echo "Need a valid warning file"
46         exit 1
47 fi
48
49 for blamefile in $(cat ${WARNING_LIST} | cut -f 1 -d ':'  | sort | uniq ); do
50   if [ -f ${blamefile} ]; then
51     svn blame ${blamefile} >/tmp/blame
52
53     cat ${WARNING_LIST} | grep "^${blamefile}" >/tmp/blame-warnings
54
55     while read warning; do
56       echo ${warning}
57
58       lineno=$(echo ${warning} | cut -f 2 -d ':' ; )
59
60       cat /tmp/blame | head -n ${lineno} | tail -n 1
61
62     done < /tmp/blame-warnings
63     rm /tmp/blame-warnings
64   else
65     echo "Unable to find ${blamefile}"
66   fi
67 done 
Note: See TracBrowser for help on using the browser.