Author: jamessan
Date: 2010-01-09 02:30:09 +0000 (Sat, 09 Jan 2010)
New Revision: 2077
Modified:
trunk/debian/changelog
trunk/scripts/debcommit.pl
Log:
Treat darcs similar to hg with respect to determining the commit message. Fold
a single change into one line and spawn an editor if multiple changes are
detected. (Closes: #563901)
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2010-01-09 00:02:16 UTC (rev 2076)
+++ trunk/debian/changelog 2010-01-09 02:30:09 UTC (rev 2077)
@@ -5,6 +5,9 @@
repos. Thanks to Thomas Parmelan for the patch. (Closes: #563918)
+ Change '~' in version numbers to '.' when tagging in git. Thanks to
Damyan Ivanov. (Closes: #564075)
+ + Treat darcs similar to hg with respect to determining the commit
+ message. Fold a single change into one line and spawn an editor if
+ multiple changes are detected. (Closes: #563901)
* rmadison:
+ Add http://qa.debian.org/cgi-madison/madison.cgi, shorthand "udd", as a
known madison URL.
Modified: trunk/scripts/debcommit.pl
===================================================================
--- trunk/scripts/debcommit.pl 2010-01-09 00:02:16 UTC (rev 2076)
+++ trunk/scripts/debcommit.pl 2010-01-09 02:30:09 UTC (rev 2077)
@@ -153,7 +153,7 @@
the changes as extracted from the changelog. B<debcommit> will then spawn an
editor so that the message may be fine-tuned before committing.
-=item B<hg>
+=item B<hg> / B<darcs>
The first change detected in the changelog will be unfolded to form a single
line
summary. If multiple changes were detected then an editor will be spawned to
@@ -568,7 +568,10 @@
if ($diffmode) {
$action_rc = action($prog, "diff", @files_to_commit);
} else {
- $action_rc = action($prog, "record", "-m", $message, "-a",
@files_to_commit);
+ my $fh = File::Temp->new(TEMPLATE => '.commit-tmp.XXXXXX');
+ $fh->print("$message\n");
+ $fh->close();
+ $action_rc = action($prog, "record", "--logfile", "$fh", "-a",
@files_to_commit);
}
}
else {
@@ -730,8 +733,7 @@
die "debcommit: unable to determine commit message using
$prog$info\nTry using the -m flag.\n";
}
} else {
-
- if ($prog =~ /^(git|hg)$/ and not $diffmode) {
+ if ($prog =~ /^(git|hg|darcs)$/ and not $diffmode) {
my $count = () = $ret =~ /^\s*[\*\+-] /mg;
if ($count == 1) {
@@ -756,7 +758,7 @@
} else {
# Strip off the first change so that we can prepend
# the unfolded version
- $ret =~ s/^\* .*?(^\s*[\*\+-] .*)/$1/msg;
+ $ret =~ s/^\* .*?(^\s*[\*\+-] .*)/$1\n/msg;
$ret = $summary . $ret;
}
}
@@ -790,31 +792,31 @@
$message = $confirmmessage;
return 1;
} elsif (/^e/i) {
- my $modified = 0;
- ($confirmmessage, $modified) = edit($confirmmessage);
+ ($confirmmessage) = edit("$confirmmessage\n");
print "\n", $confirmmessage, "\n--\n";
}
}
}
+# The string returned by edit is chomp()ed, so anywhere we present that string
+# to the user again needs to have a \n tacked on to the end.
sub edit {
my $message=shift;
- my $tempfile=".commit-tmp";
- open(FH, ">$tempfile") || die "debcommit: unable to create a temporary
file.\n";
- print FH $message;
- close FH;
- my $mtime = (stat("$tempfile"))[9];
+ my $fh=File::Temp->new(TEMPLATE => '.commit-tmp.XXXXXX')
+ || die "$progname: unable to create a temporary file.\n";
+ $fh->print($message);
+ $fh->close();
+ my $mtime = (stat("$fh"))[9];
defined $mtime || die "$progname: unable to retrieve modification time for
temporary file: $!\n";
- system("sensible-editor $tempfile");
- open(FH, "<$tempfile") || die "debcommit: unable to open temporary file
for reading\n";
+ system("sensible-editor $fh");
+ open(FH, '<', "$fh") || die "$progname: unable to open temporary file for
reading\n";
$message = "";
while(<FH>) {
$message .= $_;
}
- close FH;
- my $newmtime = (stat("$tempfile"))[9];
+ close(FH);
+ my $newmtime = (stat("$fh"))[9];
defined $newmtime || die "$progname: unable to retrieve modification time
for updated temporary file: $!\n";
- unlink($tempfile);
chomp $message;
return ($message, $mtime != $newmtime);
}
--
To unsubscribe, send mail to [email protected].