chiark / gitweb /
Autogenerated quilt patch fixup patch Description contains several recent git commits...
[dgit.git] / dgit
diff --git a/dgit b/dgit
index 88f018d36a6b750e5c81b047b006e648d63bdce8..0adf30224df5d4c34d6e5f3647d6d9beb7534b10 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -236,7 +236,7 @@ our %defcfg = ('dgit.default.distro' => 'debian',
               'dgit-distro.debian.sshdakls-host' => 'coccia.debian.org',
               'dgit-distro.debian.sshdakls-dir' =>
                   '/srv/ftp-master.debian.org/ftp/dists',
-              'dgit-distro.debian.mirror' => 'http://http.debian.net/debian/');
+              'dgit-distro.debian.mirror' => 'http://ftp.debian.org/debian/');
 
 sub cfg {
     foreach my $c (@_) {
@@ -591,12 +591,9 @@ Last allegedly pushed/uploaded: $oversion (newer or same)
 $later_warning_msg
 END
             $outputhash = $upload_hash;
-       } elsif ($outputhash ne $upload_hash) {
-           fail "version in archive ($cversion)".
-               " is same as version in git".
-               " to-be-uploaded (upload/) branch ($oversion)".
-               " but archive version hash no commit hash?!";
-        }
+        } else {
+           $outputhash = $upload_hash;
+       }
     }
     chdir '../../../..' or die $!;
     runcmd @git, qw(update-ref -m),"dgit fetch import $cversion",
@@ -766,7 +763,7 @@ sub commit_quilty_patch () {
     my $bad=0;
     foreach my $l (split /\n/, $output) {
        next unless $l =~ m/\S/;
-       if ($l =~ m{^\?\? (.pc|debian/patches)}) {
+       if ($l =~ m{^(?:\?\?| M) (.pc|debian/patches)}) {
            $adds{$1}++;
        } else {
            print STDERR "git status: $l\n";
@@ -995,18 +992,23 @@ sub build_maybe_quilt_fixup () {
     chomp;
     return unless madformat($_);
     # sigh
+    my $clogp = parsechangelog();
+    my $version = getfield $clogp, 'Version';
+    my $author = getfield $clogp, 'Maintainer';
     my $headref = rev_parse('HEAD');
     my $time = time;
+    my $ncommits = 3;
     my $patchname = "auto-$version-$headref-$time";
-    my $author = cmdoutput @git, qw(log -n1), '--pretty=format:%an <%ae>';
-    my $msg = cmdoutput @git, qw(log -n1), "--pretty=format:%s\n%b";
+    my $msg = cmdoutput @git, qw(log), "-n$ncommits";
     my $descfn = ".git/dgit/quilt-description.tmp";
     open O, '>', $descfn or die "$descfn: $!";
     $msg =~ s/\n/\n /g;
     $msg =~ s/^\s+$/ ./mg;
     print O <<END or die $!;
-Description: $msg
- [generated from git commit $headref]
+Description: Automatically generated patch ($clogp->{Version})
+ Last (up to) $ncommits git changes, FYI:
+ .
+ $msg
 Author: $author
 
 ---
@@ -1019,6 +1021,13 @@ END
        local $ENV{$fakeeditorenv} = cmdoutput qw(realpath --), $descfn;
        runcmd_ordryrun @dpkgsource, qw(--commit .), $patchname;
     }
+
+    if (!open P, '>>', ".pc/applied-patches") {
+       $!==&ENOENT or die $!;
+    } else {
+       close P;
+    }
+
     commit_quilty_patch();
 }