#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# encoding: utf-8
# api: cgi
# type: output
# category: vcs
# title: changelog
# description: Outputs a NEWS-style timeline
# version: 0.2
# state: beta
# depends: php:sqlite
# config: -
# access: public
#
# A variant of the hooks.th1 version, in PHP.
#


#ini_set("display_errors", 1);
include("./fossil_common.php");


#-- output
header("Content-Type: text/PLAIN; filename=NEWS");
print "trunk (unreleased)\n";
$r = db("
     SELECT event.mtime, tag.tagname, MAX(tag.tagid), DATE(event.mtime) AS d,
            event.comment AS comment
     FROM event
      LEFT JOIN tagxref ON event.objid=tagxref.rid
      LEFT JOIN tag ON tagxref.tagid=tag.tagid
     WHERE type='ci'
     GROUP BY objid
     ORDER BY event.mtime DESC
     LIMIT 1750
");
foreach ($r as $row) {
    if (preg_match('/^sym-.*?(\d+\.\d+.*)$/', $row["tagname"], $uu)) {
        print "\n$uu[1] ($row[d])\n";
    }
    $comment = trim(preg_replace("/\s+/", " ", $row["comment"]));
    print " * $comment\n";
}
print "\n\n";

