[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
refile-pr
From: |
Paul Traina |
Subject: |
refile-pr |
Date: |
Fri, 9 Mar 2001 19:22:43 -0800 (PST) |
Here's a script I wrote a long time ago, I don't think it made it into GNATSv4.
This does what Bryce asked for in a round-about way (Bob's formatting tools are
so totally cool...):
refile-pr -o <original-pr-number> <pr> [<pr> ...]
This will take the text ONLY parts of the subsequent PRs and refile them to
the original PR. THis is useful when someone replies but changes the subject.
Paul
#!/bin/sh
# Program to submit problem reports for GNATS.
# Copyright (C) 1999 Free Software Foundation, Inc.
# Contributed by Bob Manson (address@hidden).
#
# This file is part of GNU GNATS.
#
# GNU GNATS is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# GNU GNATS is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU GNATS; see the file COPYING. If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
debug_print=false # or echo to get output.
LIBEXECDIR=/usr/local/libexec
BINDIR=/usr/local/bin
EDIT_USER=
EDIT_PASSWD=
version=4.0-alpha
usage="
Usage: refile-pr [-V|--version] [-h|--help] [-d|--database database_name]
[-H|--host hostname] [-P|--port port_number]
[-v|--user userid] [-w|--passwd password]
-o|--original pr-to-attach-to <pr> [<pr> ...]
"
# Parse command line. We don't really need to do this, but that's ok.
while [ $# -gt 0 ]; do
case "$1" in
-V|--version|--ve*)
echo "$version"; exit 0
;;
-d | --database)
if [ $# -eq 1 ]; then echo "$usage"; exit 1; fi
shift ; GNATS_DB="--database=$1" ;;
-d=* | --database=*) GNATS_DB="$1" ;;
-H | --host)
if [ $# -eq 1 ]; then echo "$usage"; exit 1; fi
shift ; GNATS_HOST="--host=$1" ;;
-H=* | --host=*) GNATS_HOST="$1" ;;
-P | --port)
if [ $# -eq 1 ]; then echo "$usage"; exit 1; fi
shift ; GNATS_PORT="--port=$1" ;;
-P=* | --port=*) GNATS_PORT="$1" ;;
-v | --user)
if [ $# -eq 1 ]; then echo "$usage"; exit 1; fi
shift ; EDIT_USER="--user=$1" ;;
-v=* | --user=*) EDIT_USER="$1" ;;
-w | --passwd)
if [ $# -eq 1 ]; then echo "$usage"; exit 1; fi
shift ; EDIT_PASSWD="--passwd=$1" ;;
-w=* | --passwd=*) EDIT_PASSWD="$1" ;;
-o|--original*)
if [ $# -eq 1 ]; then echo "$usage"; exit 1; fi
shift ; ORIGINAL="$1" ;;
-h|--help*)
echo "$usage"; exit 0
;;
-*)
echo "$usage"; exit 1
;;
*)
break
;;
esac
shift
done
if [ $# = 0 ] ; then
echo "$0: missing PR's to refile under original PR" 1>&2
exit 1
fi
# set command here to always pass host and port, and directory if supplied
PR_EDIT="$LIBEXECDIR/gnats/pr-edit ${GNATS_HOST} ${GNATS_PORT} ${EDIT_USER}
${EDIT_PASSWD} ${GNATS_DB}"
QUERY_PR="$BINDIR/query-pr ${GNATS_HOST} ${GNATS_PORT} ${EDIT_USER}
${EDIT_PASSWD} ${GNATS_DB}"
QUERY_FMT='"Date: %s\nFrom: %s\nSubject: %s\n\n%s" Date: From: Subject:
Description'
if [ "$ORIGINAL" = "" ]; then
echo "$0: original PR to refile under required" 1>&2
exit 1
fi
# Get data from bogus PRs
$QUERY_PR --format "$QUERY_FMT" "$@" | \
$PR_EDIT --append audit-trail $ORIGINAL && \
for pr in "$@" ; do
$PR_EDIT --user gnats --delete $pr
done
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- refile-pr,
Paul Traina <=