chiark / gitweb /
WIP nmu filled in most stuff need to choose filename and make diff and print encoded... wip.nmu-email
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 28 Dec 2016 14:06:58 +0000 (14:06 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 12 Jan 2017 01:36:00 +0000 (01:36 +0000)
dgit

diff --git a/dgit b/dgit
index 98499d4676da1ce592c92a9371b24a7ff75a9698..db283ce47dd2b31c081364b57eeef2021cd67b6d 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -4025,8 +4025,8 @@ sub sign_changes ($) {
     }
 }
 
-sub nmudiff_email_prepare ($) {
-    my ($changes) = @_;
+sub nmudiff_email_prepare ($$$$$) {
+    my ($changes, $cversion, $tagwants, $archive_hash, $dgithead) = @_;
     if ($donmudiff eq 'no') {
        return;
     } elsif ($donmudiff eq 'always') {
@@ -4048,27 +4048,27 @@ sub nmudiff_email_prepare ($) {
 
     my (@header, @psuedoheader, @body);
 
-    my @closes = split /\s+/, $dctrl->{Closes} // '';
+    my @closes = split /\s+/, $changes->{Closes} // '';
     if (@closes==1) {
        push @header,
            To => $closes[0].'@'.(access_cfg 'nmu-bug-old'),
-           Subject => "#$closes[0]: Fixed in NMU ($package $version)";
+           Subject => "#$closes[0]: Fixed in NMU ($package $cversion)";
     } else {
        push @header,
          To => (access_cfg 'nmu-bug-new'),
-         Subject => "$source: diff for NMU version $version";
+         Subject => "$source: diff for NMU version $cversion";
     }
 
     push @body, <<END;
 Dear Maintainer,
 
-I've prepared an NMU for $package, version $version.
+I've prepared an NMU for $package, version $cversion.
 END
 
     if (defined $delayed) {
        push @psuedoheader, <<END;
 Control: tags -1 + patch
-Control: fixed -1 $version
+Control: fixed -1 $cversion
 END
        push @body, <<END:
 I have just uploaded it to DELAYED/$delay.
@@ -4076,7 +4076,7 @@ END
     } else {
        push @pseudoheader, <<END foreach @closes;
 Control: tags $_ + patch
-Control: fixed $_ $version
+Control: fixed $_ $cversion
 END
        push @body, <<END:
 I have just uploaded it to $csuite.
@@ -4095,16 +4095,17 @@ END
     my $u2= do { local $access_forpush=0; access_giturl; };
     push @urls, $u2 unless grep { $_ eq $u2 } @urls;
     push @body, "  ",$_,"\n" foreach @urls;
+    my $rrref = rrref;
     push @body, <<END;
 in the remote ref
-  refs/dgit/$csuite xxx
+  $rrref
 so e.g.
-  git fetch $urls[0] xxx
+  git fetch $urls[0] $rrref
   git log FETCH_HEAD
 
-My commits are from $previous
+My commits are from $archive_hash
 (previous dgit tip for $csuite)
-to $current ($tagname):
+to $dgithead (tag $tagwants->[0]{Tag}):
 END
     if (madformat) {
        push @body, <<END;
@@ -4121,7 +4122,7 @@ END
     }
 
     my $msg = build MIME::Entity @header,
-       'Boundary' => "dgit-$current",
+       'Boundary' => "dgit-$dgithead",
        'Content-Type' => 'multipart/mixed';
 
     $msg->attach(Charset => 'utf-8',
@@ -4130,14 +4131,15 @@ END
 
     $msg->attach(Charset => 'utf-8',
                 Path => output of git diff,
-                Description => "NMU diff for $version",
+                Description => "diff for NMU $source $cversion",
                 Filename => "${package}_${version}_nmu.diff",
-                Disposition => 'attachment'
-    
+                Disposition => 'attachment');
+    $msg->head->add('X-Mailer', "dgit ($our_version)"); # now there are two
+    print_body
 
     prepend dgit to x-mailer
     push @header,
-       'X-Mailer' => "dgit ($our_version)"
+       'X-Mailer' => 
 
 sub dopush () {
     printdebug "actually entering push\n";
@@ -4293,8 +4295,6 @@ END
 
     # Checks complete, we're going to try and go ahead:
 
-    numdiff_email_prepare($changes);
-
     responder_send_file('changes',$changesfile);
     responder_send_command("param head $dgithead");
     responder_send_command("param csuite $csuite");
@@ -4318,6 +4318,9 @@ END
                                 ".git/dgit/tag");
     my @tagobjfns;
 
+    nmudiff_email_prepare($changes, $cversion, \@tagwants,
+                         $archive_hash, $dgithead);
+
     supplementary_message(<<'END');
 Push failed, while signing the tag.
 You can retry the push, after fixing the problem, if you like.