1#! /bin/bash
2
3# Make a list of revisions for commits to the branch of interest (trunk
4# by default) between the specified dates.  This skips commits that do
5# not modify any existing files and changes by gccadmin.
6#
7# Copyright (C) 2007 Free Software Foundation.
8#
9# This file is free software; you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation; either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17# GNU General Public License for more details.
18#
19# For a copy of the GNU General Public License, write the the
20# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21# Boston, MA 02111-1301, USA.
22
23#set -ex
24
25abort() {
26    echo "$@"
27    exit 1
28}
29
30test $# -lt 2 && abort "usage: $0 low_date high_date [branch]"
31
32export TZ=UTC
33LOW_DATE="$1"
34HIGH_DATE="$2"
35
36if [ $# -eq 3 ]; then
37    BRANCH="$3"
38else
39    BRANCH=""
40fi
41
42# Verify branch name, convert a short name to the real one.
43
44case $BRANCH in
45"")             BRANCH="trunk";;
46mline)          BRANCH="trunk";;
47mainline)       BRANCH="trunk";;
484.1)            BRANCH="gcc-4_1-branch";;
49gcc-4_1-branch) ;;
504.0)            BRANCH="gcc-4_0-branch";;
51gcc-4_0-branch) ;;
523.4)            BRANCH="gcc-3_4-branch";;
53gcc-3_4-branch) ;;
54*)              ;; # abort "$0: unrecognized branch $BRANCH"
55esac
56
57if [ "${BRANCH}" = "trunk" ]; then
58  BRANCHPATH=trunk
59else
60  BRANCHPATH=branches/${BRANCH}
61fi
62
63# Get the revision at the time of LOW_DATE.
64
65LOW_REV=`svn info --revision {"${LOW_DATE}"} \
66        ${REG_SVN_REPO}/${BRANCHPATH} \
67  | awk '/Revision:/ { print $2 }'`
68
69# Create the list of information for LOW_REV through HIGH_DATE in a
70# form expected by gcc-svn-ids.
71
72svn log --quiet --non-interactive \
73        --revision ${LOW_REV}:{"${HIGH_DATE}"} \
74        ${REG_SVN_REPO}/${BRANCHPATH} \
75  | awk -v branch=$BRANCH \
76      'BEGIN { id=0 }
77       /---/ { next }
78       /(no author)/ { next }
79       /gccadmin/ { next }
80             { sub(" \\+0000 (.*)","")
81               sub("r","",$1)
82               gsub(" \\| ","|")
83               id++
84               print id "|" $0 "|" branch
85             }'
86