Added to commit and STDOUT messages short source summary.
authorStanislaw Klekot <dozzie@jarowit.net>
Thu, 31 Mar 2011 15:46:46 +0000 (17:46 +0200)
committerStanislaw Klekot <dozzie@jarowit.net>
Wed, 6 Apr 2011 12:27:55 +0000 (14:27 +0200)
That is, summaries (first lines of commits) that were included in build.

cronbuilder

index f6d31e7..64c4769 100755 (executable)
@@ -128,7 +128,6 @@ if (true $config{build}{rebuild}) {
   $should_build = 1;
 } elsif (not defined $last_build) {
   # if last build is undef, there was no (recent enough) build
-  $last_build = "<none>";
   $should_build = 1;
 } elsif ($last_build ne $current_source) {
   # if last build is different (git hashes can't be compared lexically! just
@@ -176,10 +175,23 @@ if ($build_status != 0) {
 
 #-----------------------------------------------------------------------------
 
+my $additional_comment;
+if (defined $last_build) {
+  # from oldest to newest
+  my @past_builds = reverse $src->log(since => $last_build);
+  if (@past_builds == 0) {
+    $additional_comment = "No changes in sources.";
+  } else {
+    $additional_comment = join "\n", map { $_->{short_descr} } @past_builds;
+  }
+} else {
+  $additional_comment = "No previous build.";
+}
+
 my $commit_output;
 
 if ($opts{commit}) {
-  $commit_output = $dst->commit($current_source);
+  $commit_output = $dst->commit($current_source, $additional_comment);
 
   if (not defined $commit_output) {
     # no changes in destination, no need to send e-mail
@@ -189,7 +201,7 @@ if ($opts{commit}) {
   $commit_output = {
     output => "<Commit was skipped due to command line option>\n",
     revision => "<uncommitted>",
-    message => $dst->build_message($current_source),
+    message => $dst->build_message($current_source, $additional_comment),
     files => { 'file-list-unknown' => undef, },
   };
 }
@@ -203,14 +215,17 @@ if (true $config{build}{inform}) {
                     YAML::Dump($commit_output->{files}) :
                     "no files affected";
   $files_log =~ s/^/  /mg;
+  $additional_comment =~ s/^/  - /mg;
 
   printf "Build successful (revision %s).\n" .
          "Source revisions %s..%s\n\n" .
+         "Change summary:\n%s\n\n" .
          "Files affected:\n%s\n" .
          "#%s\n# build log\n\n%s\n" .
          "#%s\n# commit log\n\n%s\n",
          $commit_output->{revision},
-         $last_build, $current_source,
+         (defined $last_build ? $last_build : "<none>"), $current_source,
+         $additional_comment,
          $files_log,                          # list of affected files
          '#' x 77, $build_message,            # build log
          '#' x 77, $commit_output->{output},  # commit log