1264790Sbapt#! /bin/bash
2264790Sbapt
3264790Sbapt# Make a list of revisions for commits to the branch of interest (trunk
4264790Sbapt# by default) between the specified dates.  This skips commits that do
5264790Sbapt# not modify any existing files and changes by gccadmin.
6264790Sbapt#
7264790Sbapt# Copyright (C) 2007 Free Software Foundation.
8264790Sbapt#
9264790Sbapt# This file is free software; you can redistribute it and/or modify
10264790Sbapt# it under the terms of the GNU General Public License as published by
11264790Sbapt# the Free Software Foundation; either version 3 of the License, or
12264790Sbapt# (at your option) any later version.
13264790Sbapt#
14264790Sbapt# This program is distributed in the hope that it will be useful,
15264790Sbapt# but WITHOUT ANY WARRANTY; without even the implied warranty of
16264790Sbapt# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17264790Sbapt# GNU General Public License for more details.
18264790Sbapt#
19264790Sbapt# For a copy of the GNU General Public License, write the the
20264790Sbapt# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21264790Sbapt# Boston, MA 02111-1301, USA.
22264790Sbapt
23264790Sbapt#set -ex
24264790Sbapt
25264790Sbaptabort() {
26264790Sbapt    echo "$@"
27264790Sbapt    exit 1
28264790Sbapt}
29264790Sbapt
30264790Sbapttest $# -lt 2 && abort "usage: $0 low_date high_date [branch]"
31264790Sbapt
32264790Sbaptexport TZ=UTC
33264790SbaptLOW_DATE="$1"
34264790SbaptHIGH_DATE="$2"
35264790Sbapt
36264790Sbaptif [ $# -eq 3 ]; then
37264790Sbapt    BRANCH="$3"
38264790Sbaptelse
39264790Sbapt    BRANCH=""
40264790Sbaptfi
41264790Sbapt
42264790Sbapt# Verify branch name, convert a short name to the real one.
43264790Sbapt
44264790Sbaptcase $BRANCH in
45264790Sbapt"")             BRANCH="trunk";;
46264790Sbaptmline)          BRANCH="trunk";;
47264790Sbaptmainline)       BRANCH="trunk";;
48264790Sbapt4.1)            BRANCH="gcc-4_1-branch";;
49264790Sbaptgcc-4_1-branch) ;;
50264790Sbapt4.0)            BRANCH="gcc-4_0-branch";;
51264790Sbaptgcc-4_0-branch) ;;
52264790Sbapt3.4)            BRANCH="gcc-3_4-branch";;
53264790Sbaptgcc-3_4-branch) ;;
54264790Sbapt*)              ;; # abort "$0: unrecognized branch $BRANCH"
55264790Sbaptesac
56264790Sbapt
57264790Sbaptif [ "${BRANCH}" = "trunk" ]; then
58264790Sbapt  BRANCHPATH=trunk
59264790Sbaptelse
60264790Sbapt  BRANCHPATH=branches/${BRANCH}
61264790Sbaptfi
62264790Sbapt
63264790Sbapt# Get the revision at the time of LOW_DATE.
64264790Sbapt
65264790SbaptLOW_REV=`svn info --revision {"${LOW_DATE}"} \
66264790Sbapt        ${REG_SVN_REPO}/${BRANCHPATH} \
67264790Sbapt  | awk '/Revision:/ { print $2 }'`
68264790Sbapt
69264790Sbapt# Create the list of information for LOW_REV through HIGH_DATE in a
70264790Sbapt# form expected by gcc-svn-ids.
71264790Sbapt
72264790Sbaptsvn log --quiet --non-interactive \
73264790Sbapt        --revision ${LOW_REV}:{"${HIGH_DATE}"} \
74264790Sbapt        ${REG_SVN_REPO}/${BRANCHPATH} \
75264790Sbapt  | awk -v branch=$BRANCH \
76264790Sbapt      'BEGIN { id=0 }
77264790Sbapt       /---/ { next }
78264790Sbapt       /(no author)/ { next }
79264790Sbapt       /gccadmin/ { next }
80264790Sbapt             { sub(" \\+0000 (.*)","")
81264790Sbapt               sub("r","",$1)
82264790Sbapt               gsub(" \\| ","|")
83264790Sbapt               id++
84264790Sbapt               print id "|" $0 "|" branch
85264790Sbapt             }'
86264790Sbapt