ICU-9545 add script for reticketting [wiki:MisTicketted]

X-SVN-Rev: 32343
This commit is contained in:
Steven R. Loomis 2012-09-06 00:45:04 +00:00
parent 352b919992
commit 391fc18b9c
2 changed files with 104 additions and 0 deletions

1
.gitattributes vendored
View File

@ -818,6 +818,7 @@ tools/release/java/src/com/ibm/icu/dev/tools/docs/dumpAllCFunc_xml.xslt -text
tools/release/java/src/com/ibm/icu/dev/tools/docs/dumpAllCppFunc_xml.xslt -text
tools/release/java/src/com/ibm/icu/dev/tools/docs/genreport_xml.xslt -text
tools/scripts/icurun -text
tools/scripts/reticket -text
tools/trac/IcuCodeTools/0.11/icucodetools/__init__.py -text
tools/trac/IcuCodeTools/0.11/icucodetools/dcut.py -text
tools/trac/IcuCodeTools/0.11/icucodetools/htdocs/css/icuxtn.css -text

103
tools/scripts/reticket Normal file
View File

@ -0,0 +1,103 @@
#!/bin/bash
# Copyright (c) 2012, International Business Machines Corporation and others. All Rights Reserved.
# for fixing misticketted
# see http://bugs.icu-project.org/trac/wiki/MisTicketted
# TODO: cleanup ${TMPF}*
rev=
from=
to=
usage()
{
echo "$0 -r rev -f frombug -t tobug"
}
while getopts "r:f:t:" opt; do
case $opt in
r)
rev=$OPTARG
;;
f)
from=$OPTARG
;;
t)
to=$OPTARG
;;
\?)
echo "Invalid: -$OPTARG" >&2
usage
exit 1
;;
esac
done
if [[ ! $rev ]];
then
echo "need -r rev option" >&2
usage
exit 1
fi
if [[ ! $from ]];
then
echo "need -f oldbug option" >&2
usage
exit 1
fi
if [[ ! $to ]];
then
echo "need -t newbug option" >&2
usage
exit 1
fi
if [[ ! -d .svn ]];
then
echo ".svn is not a directory. Please cd somewhere else." >&2
exit 1
fi
if [[ ! -d ${TMPDIR} ]];
then
TMPDIR=/tmp
fi
TMPF=${TMPDIR}/reticket.r${rev}.f${from}.t${to}.txt
echo "Getting log for r${rev}" >&2
( svn pg svn:log --revprop -r ${rev} . | tee ${TMPF} | sed -e 's%^%< %g' ) || exit 1
head -1 ${TMPF} > ${TMPF}.1
if grep -q "^ticket:${from}[^0-9]" ${TMPF}.1;
then
echo "-- old/new --"
else
if grep -q "^ticket:${to}[^0-9]" ${TMPF}.1;
then
echo "r${rev} already references ticket:${to} - exitting." >&2
exit 0
else
echo "Error: r${rev} doesn't pertain to ticket:${from} - was this already fixed?" >&2
exit 1
fi
fi
( ( sed -e "s%^ticket:${from}%ticket:${to}%" ${TMPF}.1 && tail +2 ${TMPF} ) || exit 2 ) | tee ${TMPF}.fix | sed -e 's%^%> %g'
CMD="svn ps svn:log --revprop -r ${rev} -F ${TMPF}.fix"
echo "# ${CMD}"
echo "type YES to do, ^C to kill"
read foo
if [[ $foo = "YES" ]];
then
echo "## Remember the server still needs to be resynced. See http://bugs.icu-project.org/trac/wiki/FixingMisTicketted"
exec ${CMD}
else
exit 0
fi