From b1a004c119441bfbe3392284beedea338dc67ae1 Mon Sep 17 00:00:00 2001 From: Andrew Chilton Date: Fri, 29 Jan 2010 18:45:50 +1300 Subject: [PATCH] cil-c77fae7c: Now does a nicer commit message for multiple issue changes --- issues/i_c77fae7c.cil | 4 ++-- lib/CIL/Command/Status.pm | 3 ++- lib/CIL/Git.pm | 5 ++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/issues/i_c77fae7c.cil b/issues/i_c77fae7c.cil index 0870527..cc55b9f 100644 --- a/issues/i_c77fae7c.cil +++ b/issues/i_c77fae7c.cil @@ -1,10 +1,10 @@ Summary: Make commit messages nicer when multiple issues are updated -Status: New +Status: Finished CreatedBy: Andrew Chilton AssignedTo: Andrew Chilton Label: Milestone-v0.07 Inserted: 2010-01-27T23:59:52 -Updated: 2010-01-27T23:59:52 +Updated: 2010-01-29T05:40:37 When updating the status, label, depends on or precedes (and other things which can happen to multiple issues at any one time), the commit message doesn't say diff --git a/lib/CIL/Command/Status.pm b/lib/CIL/Command/Status.pm index 35fe885..b74f2ae 100644 --- a/lib/CIL/Command/Status.pm +++ b/lib/CIL/Command/Status.pm @@ -61,7 +61,8 @@ sub run { if ( $cil->UseGit ) { # if we want to commit these issues if ( $args->{commit} ) { - $cil->git->commit_multiple( $cil, "Status changed to '$status'", @issues ); + my $message = "Status changed to '$status'"; + $cil->git->commit_multiple( $cil, $message, @issues ); } } } diff --git a/lib/CIL/Git.pm b/lib/CIL/Git.pm index 1dec720..a38323c 100644 --- a/lib/CIL/Git.pm +++ b/lib/CIL/Git.pm @@ -24,6 +24,7 @@ package CIL::Git; use strict; use warnings; use Carp; +use List::Util qw(reduce); use Git; use base qw(Class::Accessor); @@ -128,7 +129,9 @@ sub commit_multiple { push @filenames, $filename; } - return $self->git->command('commit', '-m', $message, @filenames); + my $commit_list_string = reduce { $a . $b } map { "* cil-" . $_->name . "\n" } @entities; + + return $self->git->command('commit', '-m', "$message\n\n$commit_list_string", @filenames); } ## ---------------------------------------------------------------------------- -- 2.39.5