3 # Convert one kind of changeset identifier to another.
5 # Usage: gcc-svn-ids -f from_kind -t to_kind id
7 # Where from_kind is one of:
8 # index index into the changeset list used by the reghunt tools
9 # rev is the Subversion revision name
10 # and to_kind is one of:
11 # index index into the changeset list used by the reghunt tools
12 # rev is the Subversion revision name
13 # date expanded UTC date string
14 # branch the branch, or "trunk" for mainline
15 # author the person who checked in the patch
22 echo 'cvs_ids -f kind -t kind id' 1>&2
23 echo ' where from_kind is index or rev' 1>&2
24 echo ' and to_kind is index, rev, date, author, or branch' 1>&2
29 if [ "x${REG_CHANGESET_LIST}" = "x" ]; then
30 errmsg
"REG_CHANGESET_LIST is not defined"
35 if [ ! -f ${REG_CHANGESET_LIST} ]; then
36 errmsg
"changeset list ${REG_CHANGESET_LIST} does not exist"
41 # Use a shorter name here.
42 LIST
=${REG_CHANGESET_LIST}
44 while getopts "f:t:" ARG
; do
46 f
) FROM_KIND
="${OPTARG}";;
47 t
) TO_KIND
="${OPTARG}";;
49 *) errmsg
"unrecognized option: ${ARG}";
53 shift `expr ${OPTIND} - 1`
56 errmsg
"too few arguments, ID is missing"
60 errmsg
"unexpected arguments: $*"
66 index
) LINE
=`awk -F '|' -v id="${ID}" '{if ($1 == id) print }' < ${LIST}`;;
67 rev) LINE
=`awk -F '|' -v id="${ID}" '{if ($2 == id) print }' < ${LIST}`;;
68 *) errmsg
"unrecognized FROM kind: ${FROM_KIND}";
72 if [ "x${LINE}" = "x" ]; then
73 errmsg
"no entry found for ${FROM_KIND} = ${ID}"
79 index
) TO_ID
="`echo ${LINE} | awk -F '|' '{ print $1 }'`";;
80 rev) TO_ID
="`echo ${LINE} | awk -F '|' '{ print $2 }'`";;
81 author
) TO_ID
="`echo ${LINE} | awk -F '|' '{ print $3 }'`";;
82 date) TO_ID
="`echo ${LINE} | awk -F '|' '{ print $4 }'`";;
83 branch
) TO_ID
="`echo ${LINE} | awk -F '|' '{ print $5 }'`";;
84 *) errmsg
"unrecognized TO kind: ${TO_KIND}";