#!/bin/bash
. ~/.profile.d/gentoo.sh
+. ~/.profile.d/aliases.sh
op=${0##*/}
-op=${op%-close}
+ops=( ${op//-/ } )
+op=${ops[0]}
+[[ ${op} == "er" ]] && op+=" -q"
tdir="${HOME}/.cache/bugz"
mkdir -p "${tdir}"
find "${tdir}" -mmin +30 -type f -delete
xml="${tdir}/${b}.xml"
# server doesn't support timestamps, so cannot use -N
- if [[ ! -e $xml ]] ; then
+ if [[ ! -s $xml ]] ; then
wget -q -O $xml https://bugs.gentoo.org/${b}?ctype=xml
fi
name=$(xml sel -E utf8 -t -m bugzilla/bug/long_desc -c who -n $xml | \
name=$(xml sel -E utf8 -t -m bugzilla/bug/long_desc -v who -n $xml | \
head -${c} | tail -1 | cut -d@ -f1)
fi
+ new_name=$(echo "${name}" | scrub_html | sed "s: [(\"'][^()\"']*[)\"']::g")
+ if [[ ${new_name} != "${name}" ]] ; then
+ echo "Normalizing '${name}' to '${new_name}'"
+ name=${new_name}
+ fi
if [[ -n ${cl_msg} ]] ; then
cl_msg+=" "
for (( n=0; n < ${#bugs[@]}; ++n )) ; do
b=${bugs[$n]}
c=${comments[$n]}
- run "$@" gbugz -q modify ${b} --fixed -c "\
+ local msg="Commit message: $c$(printf '\n%s' ${urls})"
+
+ case ${ops[1]} in
+ close)
+ run "$@" gbugz -q modify ${b} --fixed -c "\
should be all set now in the tree; thanks for the report!
-Commit message: $c$(printf '\n%s' ${urls})"
+${msg}"
+ ;;
+ comment)
+ run "$@" gbugz -q modify ${b} -c "${msg}"
+ ;;
+ esac
done
echo
}
cvs=$(cvs up)
files=$(echo "$cvs" | awk '$1 ~ /^[MA]/ { print $NF }' | grep -v '^Manifest$')
-unk_files=$(echo "$cvs" | awk '$1 !~ /^[MAR]/')
+unk_files=$(echo "$cvs" | awk '$1 !~ /^[MARU]/')
if [[ -n ${unk_files} ]] ; then
echo "unknown files:"
echo "${unk_files}"
t=$(mktemp)
echo "${cmds}" > "${t}"
${EDITOR:-nano} "${t}" || rm "${t}"
+ set -e
. "${t}"
rm "${t}"
;;