gnucash maint: Replace gitlog2ul.sh with git-release-notes.pl.
John Ralls
jralls at code.gnucash.org
Thu Jun 27 19:46:51 EDT 2019
Updated via https://github.com/Gnucash/gnucash/commit/58069668 (commit)
from https://github.com/Gnucash/gnucash/commit/72bdaeef (commit)
commit 580696681a3840565012259f57dff9491e28f16a
Author: John Ralls <jralls at ceridwen.us>
Date: Thu Jun 27 16:43:43 2019 -0700
Replace gitlog2ul.sh with git-release-notes.pl.
git-release-notes.pl finds the last release on its own and formats
the log output separately as text for NEWS and HTML for the announcements.
diff --git a/util/git-release-notes.pl b/util/git-release-notes.pl
new file mode 100644
index 000000000..de0b43b57
--- /dev/null
+++ b/util/git-release-notes.pl
@@ -0,0 +1,96 @@
+#!/usr/bin/env perl -w
+use strict;
+
+use Git;
+use Cwd qq(getcwd);
+use Text::Wrap;
+
+
+sub print_notes {
+ my $notes = shift;
+ print ("\nNOTES:\n");
+ print fill ('', '', $notes);
+ print "\n\n";
+}
+
+sub text_format {
+ my ($string, $indent, $tab) = @_;
+ my ($sum, $desc, $notes) = split('\<\|\>', $string);
+ $sum = wrap($indent, $tab, $sum);
+ print "$sum\n";
+ if ($desc) {
+ $desc = fill($tab, $tab, $desc);
+ print "$desc\n";
+ }
+ print_notes($notes) if ($notes);
+}
+
+sub html_format_bug {
+ my $string = shift;
+ my $href='"https://bugs.gnucash.org/show_bug.cgi?id=XXXXXX"';
+ my ($sum, $desc, $notes) = split('\<\|\>', $string);
+ $sum =~ m/Bug ([0-9]+) - /;
+ my $num = $1;
+ die "No bug number in $sum" if ! $num;
+ $href =~ s/XXXXXX/$num/;
+ print "<li><a href=$href>$sum</a>";
+ print "<p>$desc</p>" if ($desc);
+ print_notes($notes) if ($notes);
+ print "</li>\n";
+}
+
+sub html_format_other {
+ my $string = shift;
+ my ($sum, $desc, $notes) = split('\<\|\>', $string);
+ die "No summary in $string" if not $sum;
+ print "<li>$sum";
+ print "<p>$desc</p>" if ($desc);
+ print_notes($notes) if ($notes);
+ print"</li>\n";
+}
+
+my $repo = Git->repository(Directory => getcwd);
+$repo->command('describe') =~ m/(^[.\d]+)/;
+my $tag = $1 or die "Unable to determine tag";
+
+my (@bugs, @improves);
+my ($revs, $c) = $repo->command_output_pipe('log', '--topo-order', '--format=%s<|>%b<|>%N<{}>', "$tag..HEAD");
+my $item = "";
+while(<$revs>) {
+ my $rev = $_;
+ chomp($rev);
+ $item .= ' ' if $item;
+ $item .= $rev;
+ if ($rev =~ /<\{\}>$/) {
+ $item =~ s/<\{\}>//;
+ if ($item =~ m/^Bug[\s:]?[0-9]+/) {
+ $item =~ s/^Bug[\s:]?([0-9]+)[ -]*/Bug $1 - /;
+ push @bugs, $item;
+ } else {
+ push @improves, $item;
+ }
+ $item = '';
+ }
+}
+$repo->command_close_pipe($revs, $c);
+
+print "\nThe following bugs have been fixed:\n";
+foreach my $bug (sort @bugs) {
+ text_format($bug, ' ', ' ');
+}
+
+print "\nOther repairs or enhancements not marked as bugs:\n\n";
+foreach my $other (@improves) {
+ text_format($other, ' ', ' ');
+}
+
+print "*****HTML OUTPUT*****\n\n";
+print "<h6>Between $tag and XXX, the following bugfixes were accomplished:</h6>\n<ul>\n";
+foreach my $bug (sort @bugs) {
+ html_format_bug($bug);
+}
+print "</ul>\n<h6>The following fixes and improvements were not associated with bug reports:</h6>\n<ul>\n";
+foreach my $other (@improves) {
+ html_format_other($other);
+}
+print "</ul>\n";
diff --git a/util/gitlog2ul.sh b/util/gitlog2ul.sh
deleted file mode 100755
index ea8680318..000000000
--- a/util/gitlog2ul.sh
+++ /dev/null
@@ -1,55 +0,0 @@
-#! /bin/bash
-#
-# gitlog2ul.sh <prevrelease> <newrelease>
-#
-# This script will extract all the commit messages from the git
-# repository between two releases or from a previous release and the
-# current checkout's HEAD.
-# The result will be printed on standard out as a
-# html unordered list ("bulleted list").
-#
-# Parameters:
-#
-# <prevrelease> : the git tag for the release to start
-# the commit message search
-# <newrelease> : the git tag for the release to end
-# the commit message search
-#
-# The search will return all commit messages between
-# <prevrelease> and <newrelease>
-#
-# Examples:
-# This will compile the changes between two tagged releases:
-# gitlog2ul.sh 2.3.7 2.3.8
-# This will compile the changes between the tagged release and the
-# current HEAD in checked out working copy:
-# gitlog2ul.sh 2.4.7
-
-oldrelease=$1
-newrelease=$2
-
-dir=`dirname "$0"`
-
-# Print basic headers (to match what svn2log generates)
-cat <<EOF
-<?xml version="1.0"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-</head>
- <body>
- <ul>
-EOF
-
-if [ "x$2" == "x" ]
-then
- newrelease=HEAD
-fi
-
-git --no-pager log --format="<li>%s%n<br/>%b</li>" $oldrelease..$newrelease | egrep -v "git-svn-id|^(<br/>)?BP$|^$"
-
-cat <<EOF
- </ul>
-</body>
-EOF
Summary of changes:
util/git-release-notes.pl | 96 +++++++++++++++++++++++++++++++++++++++++++++++
util/gitlog2ul.sh | 55 ---------------------------
2 files changed, 96 insertions(+), 55 deletions(-)
create mode 100644 util/git-release-notes.pl
delete mode 100755 util/gitlog2ul.sh
More information about the gnucash-changes
mailing list