File: svnkeywords.sh

package info (click to toggle)
gdal 1.10.1+dfsg-8
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 84,320 kB
  • ctags: 74,726
  • sloc: cpp: 677,199; ansic: 162,820; python: 13,816; cs: 11,163; sh: 10,446; java: 5,279; perl: 4,429; php: 2,971; xml: 1,500; yacc: 934; makefile: 494; sql: 112
file content (65 lines) | stat: -rwxr-xr-x 1,459 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/sh
#
# Author: Mateusz Loskot, mateusz@loskot
# Revision: $Revision: 15034 $
# Date: $Date: 2008-07-25 16:13:02 -0700 (Fri, 25 Jul 2008) $
#
# The script purpose is to reset svn:keywords property for files
# identified as using keywords.
#
# Set to 1 to print detailed listing of touched files and set keywords
VERBOSE=0

if test ! $# = 1; then
    echo "Usage: `basename $0` <source path>"
    exit 1
fi

SVNSRCPATH=${1}
if test ! -d ${SVNSRCPATH}; then
    echo "*** Given source location is not valid directory '${SVNSRCPATH}'"
    exit 1
fi

SVN=`which svn`
FIND=`which find`
GREP=`which grep`

if test ! -x ${SVN}; then
    echo "Can not find Subversion program"
    exit 1
fi

if test ! -x ${FIND}; then
    echo "Can not locate find program"
    exit 1
fi

if test ! -x ${GREP}; then
    echo "Can not locate grep program"
    exit 1
fi

echo "Entering '${SVNSRCPATH}'"
echo "Setting svn:keywords property\c"

${FIND} ${SVNSRCPATH} \( -path '*/.svn' \) -prune -o -type f -print | while read file ; do

    plist=""
    for p in Author Date Id Rev ; do
        if ${GREP} -q '\$'${p}'' "${file}" ; then 
            plist="${p} $plist"
        fi
    done

    if [ "$plist" != "" ] ; then 
        ${SVN} propset svn:keywords "${plist%% }" ${file} > /dev/null 2>&1
        if test ${VERBOSE} = 1; then
            echo "${SVN} propset svn:keywords "${plist%% }" ${file} "
        else
            echo ".\c"
        fi
    fi
done

echo "done."