Package: devscripts
Severity: wishlist
Tags: patch
Usertags: debcommit

Hi,

Please add this patch to confirm the commit message.
The patch is taken from ubuntu

Regards

Laurent Bigonville
--- scripts/debcommit.pl.orig	2007-08-21 23:03:38.000000000 +0200
+++ scripts/debcommit.pl	2007-08-21 23:06:53.000000000 +0200
@@ -6,7 +6,7 @@
 
 =head1 SYNOPSIS
 
-B<debcommit> [B<--release>] [B<--message=>I<text>] [B<--noact>] [B<--changelog=>I<path>] [B<--all> | I<files to commit>]
+B<debcommit> [B<--release>] [B<--message=>I<text>] [B<--noact>] [B<--confirm>] [B<--changelog=>I<path>] [B<--all> | I<files to commit>]
 
 =head1 DESCRIPTION
 
@@ -46,6 +46,11 @@
 
 Do not actually do anything, but do print the commands that would be run.
 
+=item B<-c> B<--confirm>
+
+Display the generated commit message and ask for confirmation before committing
+it.
+
 =item B<-a> B<--all>
 
 Commit all files. This is the default operation when using a VCS other 
@@ -82,6 +87,7 @@
    -r --release        Commit a release of the package and create a tag
    -m --message=text   Specify a commit message
    -n --noact          Dry run, no actual commits
+   -C --confirm        Ask for confirmation of the message before commit
    -a --all            Commit all files (default except for git)
    -h --help           This message
    -v --version        Version information
@@ -102,6 +108,7 @@
 my $release=0;
 my $message;
 my $noact=0;
+my $confirm=0;
 my $all=0;
 my $changelog="debian/changelog";
 Getopt::Long::Configure("bundling");
@@ -109,12 +116,13 @@
 		 "r|release" => \$release,
 		 "m|message=s" => \$message,
 		 "n|noact" => \$noact,
+		 "C|confirm" => \$confirm,
 		 "a|all" => \$all,
 		 "c|changelog=s" => \$changelog,
 		 "h|help" => sub { usage(); exit 0; },
 		 "v|version" => sub { version(); exit 0; },
 		 )) {
-    die "Usage: debcommit [--release] [--message=text] [--noact] [--changelog=path] [--all | files to commit]\n";
+    die "Usage: debcommit [--release] [--message=text] [--noact] [--confirm] [--changelog=path] [--all | files to commit]\n";
 }
 
 my @files_to_commit = @ARGV;
@@ -142,7 +150,7 @@
 }
 else {
     $message=getmessage() if ! defined $message;
-    commit($message);
+    commit($message) if not $confirm or confirm($message);
 }
 
 sub getprog {
@@ -344,6 +352,17 @@
     return $ret;
 }
 
+sub confirm {
+    my $message=shift;
+    print $message, "\n--\n";
+    while(1) {
+        print "OK to commit? [Y/n] ";
+        $_ = <STDIN>;
+        return 0 if /^n/i;
+        return 1 if /^(y|$)/i;
+    }
+}
+
 =head1 LICENSE
 
 This code is copyright by Joey Hess <[EMAIL PROTECTED]>, all rights reserved.

Attachment: pgpsyfy8z2mjj.pgp
Description: PGP signature

Reply via email to