Author: adam-guest
Date: 2008-03-14 18:47:35 +0000 (Fri, 14 Mar 2008)
New Revision: 1131
Modified:
trunk/debian/changelog
trunk/scripts/debcommit.pl
Log:
+ Format commit messages in a more useful manner for git and hg. The
first change found is unfolded and used as the summary line. If more
than one change was found then an editor is spawned so that the message
can be fine-tuned if required (Closes: #402531)
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2008-03-14 14:44:38 UTC (rev 1130)
+++ trunk/debian/changelog 2008-03-14 18:47:35 UTC (rev 1131)
@@ -45,6 +45,10 @@
used, use them as the commit message. Otherwise use the message passed
with --message or "releasing version X.Y" as currently
(Closes: #470366)
+ + Format commit messages in a more useful manner for git and hg. The
+ first change found is unfolded and used as the summary line. If more
+ than one change was found then an editor is spawned so that the message
+ can be fine-tuned if required (Closes: #402531)
* deb[ci]:
+ Allow either package names or filenames to be passed on the
command line (Closes: #469663)
Modified: trunk/scripts/debcommit.pl
===================================================================
--- trunk/scripts/debcommit.pl 2008-03-14 14:44:38 UTC (rev 1130)
+++ trunk/scripts/debcommit.pl 2008-03-14 18:47:35 UTC (rev 1131)
@@ -552,9 +552,39 @@
die "debcommit: unable to determine commit message using
$prog$info\nTry using the -m flag.\n";
}
} else {
- if ($stripmessage) {
- my $count = () = $ret =~ /^\* /mg;
+ my $count = () = $ret =~ /^\* /mg;
+
+ if ($prog =~ /^(git|hg)$/) {
if ($count == 1) {
+ # Unfold
+ $ret =~ s/\n\s+/ /mg;
+ } else {
+ my $summary = '';
+
+ # We're constructing a message that can be used as a
+ # good starting point, the user will need to fine-tune it
+ $edit = 1;
+
+ $summary = $ret;
+ # Strip off the second and subsequent changes
+ $summary =~ s/(^\* .*?)^\* .*/$1/ms;
+ # Unfold
+ $summary =~ s/\n\s+/ /mg;
+ $summary =~ s/^\* // if $prog eq 'git' or $stripmessage;
+
+ if ($prog eq 'git') {
+ $ret = $summary . "\n" . $ret;
+ } else {
+ # Strip off the first change so that we can prepend
+ # the unfolded version
+ $ret =~ s/^\* .*?(^\* .*)/$1/msg;
+ $ret = $summary . $ret;
+ }
+ }
+ }
+
+ if ($stripmessage or $prog eq 'git') {
+ if ($count == 1) {
$ret =~ s/^\* //;
}
}
--
To unsubscribe, send mail to [EMAIL PROTECTED]