xterm.el: Implement OSC-52 functionality for setting the X selection
[emacs.git] / build-aux / gitlog-to-emacslog
bloba523d861611a302ab572cd3aefa9b580966fb297
1 #!/bin/sh
3 # Convert git log output to ChangeLog format for GNU Emacs.
5 # Copyright (C) 2014-2015 Free Software Foundation, Inc.
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 # Written by Paul Eggert
22 LC_ALL=C
23 export LC_ALL
25 gen_origin=${1?}
27 # If this is not a Git repository, just generate an empty ChangeLog.
28 test -d ${srcprefix}.git || {
29 # Remove any old ChangeLog, in case it is a vc-dwim symlink.
30 rm -f "${distprefix}ChangeLog" || exit
31 >"${distprefix}ChangeLog"
32 exit
35 # Use Gnulib's packaged ChangeLog generator.
36 ${srcprefix}build-aux/gitlog-to-changelog --ignore-matching='^; ' \
37 "$gen_origin.." >"${distprefix}ChangeLog.tmp" || exit
39 if test -s "${distprefix}ChangeLog.tmp"; then
41 # Find the years covered by the generated ChangeLog, so that
42 # a proper copyright notice can be output.
43 years=`
44 sed -n 's/^\([0-9][0-9]*\).*/\1/p' "${distprefix}ChangeLog.tmp" |
45 sort -nu
47 start_year=
48 end_year=
49 for year in $years; do
50 : ${start_year:=$year}
51 end_year=$year
52 done
54 if test "$start_year" = "$end_year"; then
55 year_range=$start_year
56 else
57 year_range=$start_year-$end_year
60 # Append a proper copyright notice.
61 sed -n '
62 1i\
64 /^;; Local Variables:/,${
65 s/\(Copyright[ (C)]*\)[0-9]*-[0-9]*/\1'"$year_range"'/
68 ' <ChangeLog.1 >>"${distprefix}ChangeLog.tmp" || exit
71 # Install the generated ChangeLog.
72 mv -i "${distprefix}ChangeLog.tmp" "${distprefix}ChangeLog"