|
Revision 92, 1.4 kB
(checked in by mateu..@loskot.net, 1 year ago)
|
Added svnkeywords.sh script. The script purpose is to reset svn:keywords property for files identified as using keywords.
|
- Property svn:executable set to
*
|
| Line | |
|---|
| 1 |
#!/bin/sh |
|---|
| 2 |
# |
|---|
| 3 |
# Author: Mateusz Loskot, mateusz@loskot |
|---|
| 4 |
# Revision: $Revision$ |
|---|
| 5 |
# Date: $Date$ |
|---|
| 6 |
# |
|---|
| 7 |
# The script purpose is to reset svn:keywords property for files |
|---|
| 8 |
# identified as using keywords. |
|---|
| 9 |
# |
|---|
| 10 |
# Set to 1 to print detailed listing of touched files and set keywords |
|---|
| 11 |
VERBOSE=0 |
|---|
| 12 |
|
|---|
| 13 |
if test ! $# = 1; then |
|---|
| 14 |
echo "Usage: `basename $0` <source path>" |
|---|
| 15 |
exit 1 |
|---|
| 16 |
fi |
|---|
| 17 |
|
|---|
| 18 |
SVNSRCPATH=${1} |
|---|
| 19 |
if test ! -d ${SVNSRCPATH}; then |
|---|
| 20 |
echo "*** Given source location is not valid directory '${SVNSRCPATH}'" |
|---|
| 21 |
exit 1 |
|---|
| 22 |
fi |
|---|
| 23 |
|
|---|
| 24 |
SVN=`which svn` |
|---|
| 25 |
FIND=`which find` |
|---|
| 26 |
GREP=`which grep` |
|---|
| 27 |
|
|---|
| 28 |
if test ! -x ${SVN}; then |
|---|
| 29 |
echo "Can not find Subversion program" |
|---|
| 30 |
exit 1 |
|---|
| 31 |
fi |
|---|
| 32 |
|
|---|
| 33 |
if test ! -x ${FIND}; then |
|---|
| 34 |
echo "Can not locate find program" |
|---|
| 35 |
exit 1 |
|---|
| 36 |
fi |
|---|
| 37 |
|
|---|
| 38 |
if test ! -x ${GREP}; then |
|---|
| 39 |
echo "Can not locate grep program" |
|---|
| 40 |
exit 1 |
|---|
| 41 |
fi |
|---|
| 42 |
|
|---|
| 43 |
echo "Entering '${SVNSRCPATH}'" |
|---|
| 44 |
echo "Setting svn:keywords property\c" |
|---|
| 45 |
|
|---|
| 46 |
${FIND} ${SVNSRCPATH} \( -path '*/.svn' \) -prune -o -type f -print | while read file ; do |
|---|
| 47 |
|
|---|
| 48 |
plist="" |
|---|
| 49 |
for p in Author Date Id Rev ; do |
|---|
| 50 |
if ${GREP} -q '\$'${p}'' "${file}" ; then |
|---|
| 51 |
plist="${p} $plist" |
|---|
| 52 |
fi |
|---|
| 53 |
done |
|---|
| 54 |
|
|---|
| 55 |
if [ "$plist" != "" ] ; then |
|---|
| 56 |
${SVN} propset svn:keywords "${plist%% }" ${file} > /dev/null 2>&1 |
|---|
| 57 |
if test ${VERBOSE} = 1; then |
|---|
| 58 |
echo "${SVN} propset svn:keywords "${plist%% }" ${file} " |
|---|
| 59 |
else |
|---|
| 60 |
echo ".\c" |
|---|
| 61 |
fi |
|---|
| 62 |
fi |
|---|
| 63 |
done |
|---|
| 64 |
|
|---|
| 65 |
echo "done." |
|---|