On Thu, 2007-07-19 at 08:15 -0700, Josh Triplett wrote:
> Adam D. Barratt wrote:
> > martin f krafft wrote, Wednesday, July 18, 2007 7:27 AM:
[...]
> >> also sprach Adam D. Barratt <[EMAIL PROTECTED]> 
> >> [2007.07.18.0814 +0200]:
> >>> Other than changing git-diff to "git diff" as per Martin's original
> >>> patch, does anyone have any objections to this new version? If not then
> >>> I'll look at applying it (or something very close) to the next release.
> > 
> >> After reading over
> >>
> >>  http://marc.info/?t=118322948500001&r=1&w=2
> >>
> >> again, I am not sure it is being deprecated. Let's leave it for now.
> >>
> >> Thanks, Junichi!
> > 
> > I'll take that as a lack of objections from Martin. :-) Josh?
> 
> Sounds good to me!

Hurrah :-)

I've committed this to svn and attached a copy of the final diff for
reference.

Regards,

Adam
--- Begin Message ---
Author: adam-guest
Date: 2007-07-19 20:08:52 +0000 (Thu, 19 Jul 2007)
New Revision: 716

Modified:
   trunk/debian/changelog
   trunk/scripts/debcommit.pl
Log:
* debcommit: When using git, allow either all files or only those in
  the index to be committed. Thanks to Martin F Kraft and Junichi
  Uekawa for the patch. (Closes: #402539, #427429, #433081)

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2007-07-18 06:15:11 UTC (rev 715)
+++ trunk/debian/changelog      2007-07-19 20:08:52 UTC (rev 716)
@@ -19,6 +19,9 @@
       (Closes: #433169)
   * deb-reversion: Apply patch from Adeodato Simó to ensure -v is
     honoured (Closes: #433492)
+  * debcommit: When using git, allow either all files or only those in
+    the index to be committed. Thanks to Martin F Kraft and Junichi
+    Uekawa for the patch. (Closes: #402539, #427429, #433081)
 
   [ Christoph Berg ]
   * rmadison: Support ubuntu and querying multiple archives, suggested by
@@ -29,7 +32,7 @@
   * dd-list: list Uploaders per default, added --nouploaders option to
     force the old behaviour
 
- -- Adam D. Barratt <[EMAIL PROTECTED]>  Tue, 17 Jul 2007 19:00:56 +0100
+ -- Adam D. Barratt <[EMAIL PROTECTED]>  Thu, 19 Jul 2007 18:47:00 +0100
 
 devscripts (2.10.6) unstable; urgency=low
 

Modified: trunk/scripts/debcommit.pl
===================================================================
--- trunk/scripts/debcommit.pl  2007-07-18 06:15:11 UTC (rev 715)
+++ trunk/scripts/debcommit.pl  2007-07-19 20:08:52 UTC (rev 716)
@@ -6,7 +6,7 @@
 
 =head1 SYNOPSIS
 
-B<debcommit> [B<--release>] [B<--message=>I<text>] [B<--noact>] [I<files to 
commit>]
+B<debcommit> [B<--release>] [B<--message=>I<text>] [B<--noact>] [B<--all> | 
I<files to commit>]
 
 =head1 DESCRIPTION
 
@@ -41,9 +41,14 @@
 
 Do not actually do anything, but do print the commands that would be run.
 
+=item B<-a> B<--all>
+
+Commit all files. This is the default operation when using a VCS other 
+than git.
+
 =item I<files to commit>
 
-Specify which files to commit. Commits all files if not used.
+Specify which files to commit. 
 
 =over 4
 
@@ -70,6 +75,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
+   -a --all           Commit all files (default except for git)
    -h --help          This message
    -v --version       Version information
 EOT
@@ -89,14 +95,16 @@
 my $release=0;
 my $message;
 my $noact=0;
+my $all=0;
 if (! GetOptions(
                 "release" => \$release,
                 "message=s" => \$message,
                 "noact" => \$noact,
+                "all" => \$all,
                 "help" => sub { usage(); exit 0; },
                 "version" => sub { version(); exit 0; },
                 )) {
-    die "Usage: debcommit [--release] [--message=text] [--noact] [files to 
commit]\n";
+    die "Usage: debcommit [--release] [--message=text] [--noact] [--all] 
[files to commit]\n";
 }
 
 my @files_to_commit = @ARGV;
@@ -174,13 +182,19 @@
 sub commit {
     my $message=shift;
     
+    die "debcommit: can't specify a list of files to commit when using --all\n"
+       if (@files_to_commit and $all);
+
     if ($prog =~ /^(cvs|svn|svk|bzr|hg)$/) {
        if (! action($prog, "commit", "-m", $message, @files_to_commit)) {
            die "debcommit: commit failed\n";
        }
     }
     elsif ($prog eq 'git') {
-       if (! action($prog, "commit", "-a", "-m", $message, @files_to_commit)) {
+       if ($all) {
+           @files_to_commit=("-a")
+       }
+       if (! action($prog, "commit", "-m", $message, @files_to_commit)) {
            die "debcommit: commit failed\n";
        }
     }
@@ -284,7 +298,11 @@
        if ($prog eq 'tla' || $prog eq 'baz') {
            @diffcmd = ($prog, 'file-diff');
        } elsif ($prog eq 'git') {
-           @diffcmd = ('git-diff', '--cached');
+           if ($all) {
+               @diffcmd = ('git-diff');
+           } else {
+               @diffcmd = ('git-diff', '--cached');
+           }
        } else {
            @diffcmd = ($prog, 'diff');
        }
@@ -300,7 +318,11 @@
        }
        
        if (! length $ret) {
-           die "debcommit: unable to determine commit message using $prog\nTry 
using the -m flag.\n";
+           my $info='';
+           if ($prog eq 'git') {
+               $info = ' (do you mean "debcommit -a" or did you forget to run 
"git add"?)';
+           }
+           die "debcommit: unable to determine commit message using 
$prog$info\nTry using the -m flag.\n";
        }
     }
     else {



-- 
To unsubscribe, send mail to [EMAIL PROTECTED]


--- End Message ---

Reply via email to