chiark / gitweb /
i18n: dgit: mark some messages (8)
[dgit.git] / dgit
diff --git a/dgit b/dgit
index 68e80df6bf23bd4496b2338509e87726ce6740eb..359868215a61743f5cd932cab1fdc5cde0ff0059 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -5065,8 +5065,9 @@ sub i_resp_want ($) {
     pushing();
     rpush_handle_protovsn_bothends();
 
-    fail "rpush negotiated protocol version $protovsn".
-       " which does not support quilt mode $quilt_mode"
+    fail f_ "rpush negotiated protocol version %s".
+       " which does not support quilt mode %s",
+       $protovsn, $quilt_mode
        if quiltmode_splitbrain;
 
     my @localpaths = i_method "i_want", $keyword;
@@ -5109,10 +5110,10 @@ sub i_file_buildinfo {
     if (!forceing [qw(buildinfo-changes-mismatch)]) {
        files_compare_inputs($bd, $ch);
        (getfield $bd, $_) eq (getfield $ch, $_) or
-           fail "buildinfo mismatch $_"
+           fail f_ "buildinfo mismatch in field %s", $_
            foreach qw(Source Version);
        !defined $bd->{$_} or
-           fail "buildinfo contains $_"
+           fail f_ "buildinfo contains forbidden field %s", $_
            foreach qw(Changes Changed-by Distribution);
     }
     push @i_buildinfos, $bi;
@@ -5153,7 +5154,7 @@ sub i_want_signed_tag {
 
     return
        push_mktags $i_clogp, $i_dscfn,
-           $i_changesfn, 'remote changes',
+           $i_changesfn, (__ 'remote changes file'),
            \@tagwants;
 }
 
@@ -5179,7 +5180,7 @@ sub quiltify_dpkg_commit ($$$;$) {
 
     mkpath '.git/dgit'; # we are in playtree
     my $descfn = ".git/dgit/quilt-description.tmp";
-    open O, '>', $descfn or die "$descfn: $!";
+    open O, '>', $descfn or confess "$descfn: $!";
     $msg =~ s/\n+/\n\n/;
     print O <<END or die $!;
 From: $author
@@ -5228,21 +5229,21 @@ sub quiltify_trees_differ ($$;$$$) {
 
        if ($unrepres) {
            eval {
-               die "not a plain file or symlink\n"
+               die __ "not a plain file or symlink\n"
                    unless $newmode =~ m/^(?:10|12)\d{4}$/ ||
                           $oldmode =~ m/^(?:10|12)\d{4}$/;
                if ($oldmode =~ m/[^0]/ &&
                    $newmode =~ m/[^0]/) {
                    # both old and new files exist
-                   die "mode or type changed\n" if $oldmode ne $newmode;
-                   die "modified symlink\n" unless $newmode =~ m/^10/;
+                   die __ "mode or type changed\n" if $oldmode ne $newmode;
+                   die __ "modified symlink\n" unless $newmode =~ m/^10/;
                } elsif ($oldmode =~ m/[^0]/) {
                    # deletion
-                   die "deletion of symlink\n"
+                   die __ "deletion of symlink\n"
                        unless $oldmode =~ m/^10/;
                } else {
                    # creation
-                   die "creation with non-default mode\n"
+                   die __ "creation with non-default mode\n"
                        unless $newmode =~ m/^100644$/ or
                               $newmode =~ m/^120000$/;
                }
@@ -5272,7 +5273,7 @@ sub quiltify_tree_sentinelfiles ($) {
 
 sub quiltify_splitbrain_needed () {
     if (!$split_brain) {
-       progress "dgit view: changes are required...";
+       progress __ "dgit view: changes are required...";
        runcmd @git, qw(checkout -q -b dgit-view);
        $split_brain = 1;
     }
@@ -5301,32 +5302,34 @@ sub quiltify_splitbrain ($$$$$$$) {
        my ($x,$y) = @_;
        my $cmd = "git diff $x $y -- :/ ':!debian'";
        $cmd .= " ':!/.gitignore' ':!*/.gitignore'" if $gitignore_special;
-       return "\nFor full diff showing the problem(s), type:\n $cmd\n";
+       return f_ "\nFor full diff showing the problem(s), type:\n %s\n",
+                 $cmd;
     };
 
     if ($quilt_mode =~ m/gbp|unapplied/ &&
        ($diffbits->{O2H} & 01)) {
-       my $msg =
- "--quilt=$quilt_mode specified, implying patches-unapplied git tree\n".
- " but git tree differs from orig in upstream files.";
+       my $msg = f_
+ "--quilt=%s specified, implying patches-unapplied git tree\n".
+ " but git tree differs from orig in upstream files.",
+                     $quilt_mode;
        $msg .= $fulldiffhint->($unapplied, 'HEAD');
        if (!stat_exists "debian/patches") {
-           $msg .=
+           $msg .= __
  "\n ... debian/patches is missing; perhaps this is a patch queue branch?";
        }  
        fail $msg;
     }
     if ($quilt_mode =~ m/dpm/ &&
        ($diffbits->{H2A} & 01)) {
-       fail <<END. $fulldiffhint->($oldtiptree,'HEAD');
---quilt=$quilt_mode specified, implying patches-applied git tree
+       fail +(f_ <<END, $quilt_mode). $fulldiffhint->($oldtiptree,'HEAD');
+--quilt=%s specified, implying patches-applied git tree
  but git tree differs from result of applying debian/patches to upstream
 END
     }
     if ($quilt_mode =~ m/gbp|unapplied/ &&
        ($diffbits->{O2A} & 01)) { # some patches
        quiltify_splitbrain_needed();
-       progress "dgit view: creating patches-applied version using gbp pq";
+       progress __ "dgit view: creating patches-applied version using gbp pq";
        runcmd shell_cmd 'exec >/dev/null', gbp_pq, qw(import);
        # gbp pq import creates a fresh branch; push back to dgit-view
        runcmd @git, qw(update-ref refs/heads/dgit-view HEAD);
@@ -5334,8 +5337,8 @@ END
     }
     if ($quilt_mode =~ m/gbp|dpm/ &&
        ($diffbits->{O2A} & 02)) {
-       fail <<END;
---quilt=$quilt_mode specified, implying that HEAD is for use with a
+       fail f_ <<END, $quilt_mode;
+--quilt=%s specified, implying that HEAD is for use with a
  tool which does not create patches for changes to upstream
  .gitignores: but, such patches exist in debian/patches.
 END
@@ -5343,23 +5346,27 @@ END
     if (($diffbits->{O2H} & 02) && # user has modified .gitignore
        !($diffbits->{O2A} & 02)) { # patches do not change .gitignore
        quiltify_splitbrain_needed();
-       progress "dgit view: creating patch to represent .gitignore changes";
+       progress __
+           "dgit view: creating patch to represent .gitignore changes";
         ensuredir "debian/patches";
        my $gipatch = "debian/patches/auto-gitignore";
-       open GIPATCH, ">>", "$gipatch" or die "$gipatch: $!";
-       stat GIPATCH or die "$gipatch: $!";
-       fail "$gipatch already exists; but want to create it".
-           " to record .gitignore changes" if (stat _)[7];
-       print GIPATCH <<END or die "$gipatch: $!";
+       open GIPATCH, ">>", "$gipatch" or confess "$gipatch: $!";
+       stat GIPATCH or confess "$gipatch: $!";
+       fail f_ "%s already exists; but want to create it".
+               " to record .gitignore changes",
+               $gipatch
+           if (stat _)[7];
+       print GIPATCH +(__ <<END).<<ENDU or die "$gipatch: $!";
 Subject: Update .gitignore from Debian packaging branch
 
 The Debian packaging git branch contains these updates to the upstream
 .gitignore file(s).  This patch is autogenerated, to provide these
 updates to users of the official Debian archive view of the package.
+END
 
 [dgit ($our_version) update-gitignore]
 ---
-END
+ENDU
         close GIPATCH or die "$gipatch: $!";
         runcmd shell_cmd "exec >>$gipatch", @git, qw(diff),
             $unapplied, $headref, "--", sort keys %$editedignores;
@@ -5371,11 +5378,12 @@ END
        print SERIES "auto-gitignore\n" or die $!;
        close SERIES or die  $!;
         runcmd @git, qw(add -f -- debian/patches/series), $gipatch;
-        commit_admin <<END
+        commit_admin +(__ <<END).<<ENDU
 Commit patch to update .gitignore
+END
 
 [dgit ($our_version) update-gitignore-quilt-fixup]
-END
+ENDU
     }
 
     my $dgitview = git_rev_parse 'HEAD';
@@ -5385,8 +5393,8 @@ END
 
     changedir "$playground/work";
 
-    my $saved = maybe_split_brain_save $headref, $dgitview, "converted";
-    progress "dgit view: created ($saved)";
+    my $saved = maybe_split_brain_save $headref, $dgitview, __ "converted";
+    progress f_ "dgit view: created (%s)", $saved;
 }
 
 sub quiltify ($$$$) {
@@ -5451,7 +5459,7 @@ sub quiltify ($$$$) {
        my $c = shift @todo;
        next if $considered{$c->{Commit}}++;
 
-       $not->($c, "maximum search space exceeded") if --$max_work <= 0;
+       $not->($c, __ "maximum search space exceeded") if --$max_work <= 0;
 
        printdebug "quiltify investigate $c->{Commit}\n";
 
@@ -5469,7 +5477,7 @@ sub quiltify ($$$$) {
        }
 
        my $c_sentinels = quiltify_tree_sentinelfiles $c->{Commit};
-       $not->($c, "has $c_sentinels not $t_sentinels")
+       $not->($c, f_ "has %s not %s", $c_sentinels, $t_sentinels)
            if $c_sentinels ne $t_sentinels;
 
        my $commitdata = cmdoutput @git, qw(cat-file commit), $c->{Commit};
@@ -5478,13 +5486,14 @@ sub quiltify ($$$$) {
        my @parents = ($commitdata =~ m/^parent (\w+)$/gm);
        @parents = map { { Commit => $_, Child => $c } } @parents;
 
-       $not->($c, "root commit") if !@parents;
+       $not->($c, __ "root commit") if !@parents;
 
        foreach my $p (@parents) {
            $p->{Nontrivial}= quiltify_trees_differ $p->{Commit},$c->{Commit};
        }
        my $ndiffers = grep { $_->{Nontrivial} } @parents;
-       $not->($c, "merge ($ndiffers nontrivial parents)") if $ndiffers > 1;
+       $not->($c, f_ "merge (%s nontrivial parents)", $ndiffers)
+           if $ndiffers > 1;
 
        foreach my $p (@parents) {
            printdebug "considering C=$c->{Commit} P=$p->{Commit}\n";
@@ -5494,7 +5503,7 @@ sub quiltify ($$$$) {
            my $patchstackchange = cmdoutput @cmd;
            if (length $patchstackchange) {
                $patchstackchange =~ s/\n/,/g;
-               $not->($p, "changed $patchstackchange");
+               $not->($p, f_ "changed %s", $patchstackchange);
            }
 
            printdebug " search queue P=$p->{Commit} ",
@@ -5511,19 +5520,17 @@ sub quiltify ($$$$) {
            $x =~ s/(.*?[0-9a-z]{8})[0-9a-z]*$/$1/;
            return $x;
        };
-       my $reportnot = sub {
-           my ($notp) = @_;
-           my $s = $abbrev->($notp);
-           my $c = $notp->{Child};
-           $s .= "..".$abbrev->($c) if $c;
-           $s .= ": ".$notp->{Whynot};
-           return $s;
-       };
        if ($quilt_mode eq 'linear') {
-           print STDERR "\n$us: error: quilt fixup cannot be linear.  Stopped at:\n";
+           print STDERR f_
+               "\n%s: error: quilt fixup cannot be linear.  Stopped at:\n",
+               $us;
            my $all_gdr = !!@nots;
            foreach my $notp (@nots) {
-               print STDERR "$us:  ", $reportnot->($notp), "\n";
+               my $c = $notp->{Child};
+               my $cprange = $abbrev->($notp);
+               $cprange .= "..".$abbrev->($c) if $c;
+               print STDERR f_ "%s:  %s: %s\n",
+                   $us, $cprange, $notp->{Whynot};
                $all_gdr &&= $notp->{Child} &&
                    (git_cat_file $notp->{Child}{Commit}, 'commit')
                    =~ m{^\[git-debrebase(?! split[: ]).*\]$}m;
@@ -5533,13 +5540,13 @@ sub quiltify ($$$$) {
                [ grep { $_->[0] ne 'quilt-mode' } @$failsuggestion ]
                if $all_gdr;
            print STDERR "$us: $_->[1]\n" foreach @$failsuggestion;
-           fail
+           fail __
  "quilt history linearisation failed.  Search \`quilt fixup' in dgit(7).\n";
        } elsif ($quilt_mode eq 'smash') {
        } elsif ($quilt_mode eq 'auto') {
-           progress "quilt fixup cannot be linear, smashing...";
+           progress __ "quilt fixup cannot be linear, smashing...";
        } else {
-           die "$quilt_mode ?";
+           confess "$quilt_mode ?";
        }
 
        my $time = $ENV{'GIT_COMMITTER_DATE'} || time;
@@ -5549,12 +5556,14 @@ sub quiltify ($$$$) {
 
        quiltify_dpkg_commit "auto-$version-$target-$time",
            (getfield $clogp, 'Maintainer'),
-           "Automatically generated patch ($clogp->{Version})\n".
-           "Last (up to) $ncommits git changes, FYI:\n\n". $msg;
+           (f_ "Automatically generated patch (%s)\n".
+            "Last (up to) %s git changes, FYI:\n\n",
+            $clogp->{Version}, $ncommits).
+            $msg;
        return;
     }
 
-    progress "quiltify linearisation planning successful, executing...";
+    progress __ "quiltify linearisation planning successful, executing...";
 
     for (my $p = $sref_S;
         my $c = $p->{Child};
@@ -5592,7 +5601,7 @@ sub quiltify ($$$$) {
                die "contains leading punctuation\n" if m{^\W} || m{/\W};
                die "contains bad character(s)\n" if m{[^-a-z0-9_.+=~/]}i;
                die "is series file\n" if m{$series_filename_re}o;
-               die "too long" if length > 200;
+               die "too long\n" if length > 200;
            };
            return $_ unless $@;
            print STDERR "quiltifying commit $cc:".
@@ -5760,11 +5769,12 @@ sub unpack_playtree_linkorigs ($$) {
 
 sub quilt_fixup_delete_pc () {
     runcmd @git, qw(rm -rqf .pc);
-    commit_admin <<END
+    commit_admin <<END.<<ENDU
 Commit removal of .pc (quilt series tracking data)
+END
 
 [dgit ($our_version) upgrade quilt-remove-pc]
-END
+ENDU
 }
 
 sub quilt_fixup_singlepatch ($$$) {