1#!/usr/bin/env tclsh
2
3if {[llength $::argv] != 2 && [llength $::argv] != 3} {
4    puts "Usage: $::argv0 <branch> <version> \[<num-commits>\]"
5    exit 1
6}
7
8set branch [lindex $::argv 0]
9set ver [lindex $::argv 1]
10if {[llength $::argv] == 3} {
11    set count [lindex ::$argv 2]
12} else {
13    set count 100
14}
15
16set template {
17================================================================================
18Redis %ver%     Released %date%
19================================================================================
20
21Upgrade urgency <URGENCY>: <DESCRIPTION>
22}
23
24set template [string trim $template]
25append template "\n\n"
26set date [clock format [clock seconds]]
27set template [string map [list %ver% $ver %date% $date] $template]
28
29append template [exec git log $branch~$count..$branch "--format=format:%an in commit %h:%n %s" --shortstat]
30
31#Older, more verbose version.
32#
33#append template [exec git log $branch~30..$branch "--format=format:+-------------------------------------------------------------------------------%n| %s%n| By %an, %ai%n+--------------------------------------------------------------------------------%nhttps://github.com/antirez/redis/commit/%H%n%n%b" --stat]
34
35puts $template
36