X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=blobdiff_plain;f=dgit;h=f3aea0dc47bb80c43b6b0877866ab6a028f6dc71;hp=1fde60bba61f663b82f931aaf454f13b193bb7b1;hb=4c9a33a8aa3e68508b240d0460ca462d823525fa;hpb=d5a04ee68cb3ed5c2853bae83b132505b850a5e6 diff --git a/dgit b/dgit index 1fde60bb..f3aea0dc 100755 --- a/dgit +++ b/dgit @@ -2890,8 +2890,8 @@ sub git_fetch_us () { } elsif ($here{$lref} eq $objid) { lrfetchref_used $fullrefname; } else { - print STDERR - "Not updating $lref from $here{$lref} to $objid.\n"; + print STDERR f_ "Not updating %s from %s to %s.\n", + $lref, $here{$lref}, $objid; } }); } @@ -2939,20 +2939,20 @@ sub parse_dsc_field ($$) { } if (!defined $f) { - progress "$what: NO git hash"; + progress f_ "%s: NO git hash", $what; parse_dsc_field_def_dsc_distro(); } elsif (($dsc_hash, $dsc_distro, $dsc_hint_tag, $dsc_hint_url) = $f =~ m/^(\w+)\s+($distro_re)\s+($versiontag_re)\s+(\S+)(?:\s|$)/) { - progress "$what: specified git info ($dsc_distro)"; + progress f_ "%s: specified git info (%s)", $what, $dsc_distro; $dsc_hint_tag = [ $dsc_hint_tag ]; } elsif ($f =~ m/^\w+\s*$/) { $dsc_hash = $&; parse_dsc_field_def_dsc_distro(); $dsc_hint_tag = [ debiantags +(getfield $dsc, 'Version'), $dsc_distro ]; - progress "$what: specified git hash"; + progress f_ "%s: specified git hash", $what; } else { - fail "$what: invalid Dgit info"; + fail f_ "%s: invalid Dgit info", $what; } } @@ -2974,18 +2974,17 @@ sub resolve_dsc_field_commit ($$) { my $lrf = lrfetchrefs; if (!$chase_dsc_distro) { - progress - "not chasing .dsc distro $dsc_distro: not fetching $what"; + progress f_ "not chasing .dsc distro %s: not fetching %s", + $dsc_distro, $what; return 0; } - progress - ".dsc names distro $dsc_distro: fetching $what"; + progress f_ ".dsc names distro %s: fetching %s", $dsc_distro, $what; my $url = access_giturl(); if (!defined $url) { - defined $dsc_hint_url or fail <("rewrite map", $rewritemap) or return; + my $lrf = $do_fetch->((__ "rewrite map"), $rewritemap) or return; $mapref = $lrf.'/'.$rewritemap; } my $rewritemapdata = git_cat_file $mapref.':map'; if (defined $rewritemapdata && $rewritemapdata =~ m/^$dsc_hash(?:[ \t](\w+))/m) { - progress + progress __ "server's git history rewrite map contains a relevant entry!"; $dsc_hash = $1; if (defined $dsc_hash) { - progress "using rewritten git hash in place of .dsc value"; + progress __ "using rewritten git hash in place of .dsc value"; } else { - progress "server data says .dsc hash is to be disregarded"; + progress __ "server data says .dsc hash is to be disregarded"; } } } if (!defined git_cat_file $dsc_hash) { my @tags = map { "tags/".$_ } @$dsc_hint_tag; - my $lrf = $do_fetch->("additional commits", @tags) && + my $lrf = $do_fetch->((__ "additional commits"), @tags) && defined git_cat_file $dsc_hash - or fail < $lastpush_hash, - Info => "dgit suite branch on dgit git server", + Info => (__ "dgit suite branch on dgit git server"), }; my $lastfetch_hash = git_get_ref(lrref()); printdebug "fetch_from_archive: lastfetch=$lastfetch_hash\n"; my $lastfetch_mergeinput = $lastfetch_hash && { Commit => $lastfetch_hash, - Info => "dgit client's archive history view", + Info => (__ "dgit client's archive history view"), }; my $dsc_mergeinput = $dsc_hash && { Commit => $dsc_hash, - Info => "Dgit field in .dsc from archive", + Info => (__ "Dgit field in .dsc from archive"), }; my $cwd = getcwd(); @@ -3202,10 +3201,10 @@ END # push. This can happen if the archive moves .dscs about. # Just follow its lead. if (is_fast_fwd($lastpush_hash,$dsc_hash)) { - progress "archive .dsc names newer git commit"; + progress __ "archive .dsc names newer git commit"; @mergeinputs = ($dsc_mergeinput); } else { - progress "archive .dsc names other git commit, fixing up"; + progress __ "archive .dsc names other git commit, fixing up"; @mergeinputs = ($dsc_mergeinput, $lastpush_mergeinput); } } @@ -3234,10 +3233,10 @@ END } else { printdebug "nothing found!\n"; if (defined $skew_warning_vsn) { - print STDERR <{Message}) { print MC $compat_info->{Message} or die $!; } else { - print MC <($mergeinputs[0]); - print MC <($_) foreach @mergeinputs[1..$#mergeinputs]; @@ -3348,12 +3347,12 @@ END my $chkff = sub { my ($lasth, $what) = @_; return unless $lasth; - die "$lasth $hash $what ?" unless is_fast_fwd($lasth, $hash); + confess "$lasth $hash $what ?" unless is_fast_fwd($lasth, $hash); }; - $chkff->($lastpush_hash, 'dgit repo server tip (last push)') + $chkff->($lastpush_hash, __ 'dgit repo server tip (last push)') if $lastpush_hash; - $chkff->($lastfetch_hash, 'local tracking tip (last fetch)'); + $chkff->($lastfetch_hash, __ 'local tracking tip (last fetch)'); fetch_from_archive_record_1($hash); @@ -3363,11 +3362,11 @@ END my $got_vsn = getfield $gotclogp, 'Version'; printdebug "SKEW CHECK GOT $got_vsn\n"; if (version_compare($got_vsn, $skew_warning_vsn) < 0) { - print STDERR < $af.new" or die $!; - print GAO <) { @@ -3508,7 +3508,7 @@ END $gai->error and die $!; } close GAO or die $!; - rename "$af.new", "$af" or die "install $af: $!"; + rename "$af.new", "$af" or fail f_ "install %s: %s", $af, $!; } sub setup_new_tree () { @@ -3534,8 +3534,8 @@ sub check_gitattrs ($$) { next unless m{(?:^|/)\.gitattributes$}; # oh dear, found one - print STDERR <; die $! unless defined $csuite && chomp $csuite; @@ -3603,7 +3604,7 @@ sub fork_for_multisuite ($) { sub { }); return 0 unless defined $cbasesuite; - fail "package $package missing in (base suite) $cbasesuite" + fail f_ "package %s missing in (base suite) %s", $package, $cbasesuite unless @mergeinputs; my @csuites = ($cbasesuite); @@ -3635,9 +3636,9 @@ sub fork_for_multisuite ($) { if ($previous) { unshift @mergeinputs, { Commit => $previous, - Info => "local combined tracking branch", - Warning => - "archive seems to have rewound: local tracking branch is ahead!", + Info => (__ "local combined tracking branch"), + Warning => (__ + "archive seems to have rewound: local tracking branch is ahead!"), }; } @@ -3676,8 +3677,9 @@ sub fork_for_multisuite ($) { my $tree = cmdoutput qw(git rev-parse), $needed[0]{Commit}.':'; my $commit = "tree $tree\n"; - my $msg = "Combine archive branches $csuite [dgit]\n\n". - "Input branches:\n"; + my $msg = f_ "Combine archive branches %s [dgit]\n\n". + "Input branches:\n", + $csuite; foreach my $mi (sort { $a->{Index} <=> $b->{Index} } @mergeinputs) { printdebug "multisuite merge include $mi->{Info}\n"; @@ -3689,9 +3691,10 @@ sub fork_for_multisuite ($) { $mi->{Info}; } my $authline = clogp_authline mergeinfo_getclogp $needed[0]; - $msg .= "\nKey\n". + $msg .= __ "\nKey\n". " * marks the highest version branch, which choose to use\n". - " + marks each branch which was not already an ancestor\n\n". + " + marks each branch which was not already an ancestor\n\n"; + $msg .= "[dgit multi-suite $csuite]\n"; $commit .= "author $authline\n". @@ -3703,7 +3706,7 @@ sub fork_for_multisuite ($) { fetch_from_archive_record_1($output); fetch_from_archive_record_2($output); - progress "calculated combined tracking suite $csuite"; + progress f_ "calculated combined tracking suite %s", $csuite; return 1; } @@ -3721,7 +3724,7 @@ sub clone_finish ($) { git ls-tree -r --name-only -z HEAD | \ xargs -0r touch -h -r . -- END - printdone "ready for work in $dstdir"; + printdone f_ "ready for work in %s", $dstdir; } sub clone ($) { @@ -3729,7 +3732,7 @@ sub clone ($) { # once in parent after first suite fetched, # and then again in child after everything is finished my ($dstdir) = @_; - badusage "dry run makes no sense with clone" unless act_local(); + badusage __ "dry run makes no sense with clone" unless act_local(); my $multi_fetched = fork_for_multisuite(sub { printdebug "multi clone before fetch merge\n"; @@ -3746,7 +3749,7 @@ sub clone ($) { canonicalise_suite(); my $hasgit = check_for_git(); - mkdir $dstdir or fail "create \`$dstdir': $!"; + mkdir $dstdir or fail f_ "create \`%s': %s", $dstdir, $!; changedir $dstdir; runcmd @git, qw(init -q); record_maindir(); @@ -3757,11 +3760,11 @@ sub clone ($) { runcmd @git, qw(remote add), 'origin', $giturl; } if ($hasgit) { - progress "fetching existing git history"; + progress __ "fetching existing git history"; git_fetch_us(); runcmd_ordryrun_local @git, qw(fetch origin); } else { - progress "starting new git history"; + progress __ "starting new git history"; } fetch_from_archive() or no_such_package; my $vcsgiturl = $dsc->{'Vcs-Git'}; @@ -3786,13 +3789,13 @@ sub fetch_one () { cfg 'dgit.vcs-git.suites')) { my $current = cfg 'remote.vcs-git.url', 'RETURN-UNDEF'; if (defined $current && $current ne $vcsgiturl) { - print STDERR < message fragment "$saved" describing disposition of $dgitview + # (used inside parens, in the English texts) my $save = $internal_object_save{'dgit-view'}; - return "commit id $dgitview" unless defined $save; + return f_ "commit id %s", $dgitview unless defined $save; my @cmd = (shell_cmd 'cd "$1"; shift', $maindir, git_update_ref_cmd "dgit --dgit-view-save $msg HEAD=$headref", $save, $dgitview); runcmd @cmd; - return "and left in $save"; + return f_ "and left in %s", $save; } # An "infopair" is a tuple [ $thing, $what ] @@ -3940,17 +3947,19 @@ sub infopair_lrf_tag_lookup ($$) { printdebug "infopair_lrfetchref_tag_lookup $tagobj $tagname $what\n"; return [ git_rev_parse($tagobj), $what ]; } - fail @tagnames==1 ? <[0], $desc->[0]) or fail <[1] ($anc->[0]) .. $desc->[1] ($desc->[0]) is not fast forward + is_fast_fwd($anc->[0], $desc->[0]) or + fail f_ <[1], $anc->[0], $desc->[1], $desc->[0]; +%s (%s) .. %s (%s) is not fast forward END }; @@ -3959,7 +3968,7 @@ sub pseudomerge_version_check ($$) { my $arch_clogp = commit_getclogp $archive_hash; my $i_arch_v = [ (getfield $arch_clogp, 'Version'), - 'version currently in archive' ]; + __ 'version currently in archive' ]; if (defined $overwrite_version) { if (length $overwrite_version) { infopair_cond_equal([ $overwrite_version, @@ -3967,7 +3976,8 @@ sub pseudomerge_version_check ($$) { $i_arch_v); } else { my $v = $i_arch_v->[0]; - progress "Checking package changelog for archive version $v ..."; + progress f_ + "Checking package changelog for archive version %s ...", $v; my $cd; eval { my @xa = ("-f$v", "-t$v"); @@ -3975,7 +3985,8 @@ sub pseudomerge_version_check ($$) { my $gf = sub { my ($fn) = @_; [ (getfield $vclogp, $fn), - "$fn field from dpkg-parsechangelog @xa" ]; + (f_ "%s field from dpkg-parsechangelog %s", + $fn, "@xa") ]; }; my $cv = $gf->('Version'); infopair_cond_equal($i_arch_v, $cv); @@ -3984,12 +3995,13 @@ sub pseudomerge_version_check ($$) { if ($@) { $@ =~ s/^dgit: //gm; fail "$@". - "Perhaps debian/changelog does not mention $v ?"; + f_ "Perhaps debian/changelog does not mention %s ?", $v; } - fail <[0] =~ m/UNRELEASED/; -$cd->[1] is $cd->[0] -Your tree seems to based on earlier (not uploaded) $v. + fail f_ <[1], $cd->[0], $v +%s is %s +Your tree seems to based on earlier (not uploaded) %s. END + if $cd->[0] =~ m/UNRELEASED/; } } @@ -4000,7 +4012,8 @@ END sub pseudomerge_make_commit ($$$$ $$) { my ($clogp, $dgitview, $archive_hash, $i_arch_v, $msg_cmd, $msg_msg) = @_; - progress "Declaring that HEAD inciudes all changes in $i_arch_v->[0]..."; + progress f_ "Declaring that HEAD inciudes all changes in %s...", + $i_arch_v->[0]; my $tree = cmdoutput qw(git rev-parse), "${dgitview}:"; my $authline = clogp_authline $clogp; @@ -4055,7 +4068,7 @@ sub splitbrain_pseudomerge ($$$$) { my $i_arch_v = pseudomerge_version_check($clogp, $archive_hash); if (!defined $overwrite_version) { - progress "Checking that HEAD inciudes all changes in archive..."; + progress __ "Checking that HEAD inciudes all changes in archive..."; } return $dgitview if is_fast_fwd $archive_hash, $dgitview; @@ -4063,10 +4076,11 @@ sub splitbrain_pseudomerge ($$$$) { if (defined $overwrite_version) { } elsif (!eval { my $t_dep14 = debiantag_maintview $i_arch_v->[0], access_nomdistro; - my $i_dep14 = infopair_lrf_tag_lookup($t_dep14, "maintainer view tag"); + my $i_dep14 = infopair_lrf_tag_lookup($t_dep14, + __ "maintainer view tag"); my $t_dgit = debiantag_new $i_arch_v->[0], access_nomdistro; - my $i_dgit = infopair_lrf_tag_lookup($t_dgit, "dgit view tag"); - my $i_archive = [ $archive_hash, "current archive contents" ]; + my $i_dgit = infopair_lrf_tag_lookup($t_dgit, __ "dgit view tag"); + my $i_archive = [ $archive_hash, __ "current archive contents" ]; printdebug "splitbrain_pseudomerge i_archive @$i_archive\n"; @@ -4076,25 +4090,25 @@ sub splitbrain_pseudomerge ($$$$) { 1; }) { $@ =~ s/^\n//; chomp $@; - print STDERR <[0]; my $r = pseudomerge_make_commit $clogp, $dgitview, $archive_hash, $i_arch_v, "dgit --quilt=$quilt_mode", - (defined $overwrite_version ? <[0] -END_OVERWR -Make fast forward from $i_arch_v->[0] -END_MAKEFF + (defined $overwrite_version + ? f_ "Declare fast forward from %s\n", $arch_v + : f_ "Make fast forward from %s\n", $arch_v); maybe_split_brain_save $maintview, $r, "pseudomerge"; - progress "Made pseudo-merge of $i_arch_v->[0] into dgit view."; + progress f_ "Made pseudo-merge of %s into dgit view.", $arch_v; return $r; } @@ -4107,7 +4121,7 @@ sub plain_overwrite_pseudomerge ($$$) { return $head if is_fast_fwd $archive_hash, $head; - my $m = "Declare fast forward from $i_arch_v->[0]"; + my $m = f_ "Declare fast forward from %s", $i_arch_v->[0]; my $r = pseudomerge_make_commit $clogp, $head, $archive_hash, $i_arch_v, @@ -4115,7 +4129,7 @@ sub plain_overwrite_pseudomerge ($$$) { runcmd git_update_ref_cmd $m, 'HEAD', $r, $head; - progress "Make pseudo-merge of $i_arch_v->[0] into your HEAD."; + progress f_ "Make pseudo-merge of %s into your HEAD.", $i_arch_v->[0]; return $r; } @@ -4127,7 +4141,8 @@ sub push_parse_changelog ($) { my $clogpackage = getfield $clogp, 'Source'; $package //= $clogpackage; - fail "-p specified $package but changelog specified $clogpackage" + fail f_ "-p specified %s but changelog specified %s", + $package, $clogpackage unless $package eq $clogpackage; my $cversion = getfield $clogp, 'Version'; @@ -4148,8 +4163,9 @@ sub push_parse_dsc ($$$) { my $dversion = getfield $dsc, 'Version'; my $dscpackage = getfield $dsc, 'Source'; ($dscpackage eq $package && $dversion eq $cversion) or - fail "$dscfn is for $dscpackage $dversion". - " but debian/changelog is for $package $cversion"; + fail f_ "%s is for %s %s but debian/changelog is for %s %s", + $dscfn, $dscpackage, $dversion, + $package, $cversion; } sub push_tagwants ($$$$) { @@ -4208,8 +4224,8 @@ sub push_mktags ($$ $$ $) { my $changes = parsecontrol($changesfile,$changesfilewhat); foreach my $field (qw(Source Distribution Version)) { $changes->{$field} eq $clogp->{$field} or - fail "changes field $field \`$changes->{$field}'". - " does not match changelog \`$clogp->{$field}'"; + fail f_ "changes field %s \`%s' does not match changelog \`%s'", + $field, $changes->{$field}, $clogp->{$field}; } my $cversion = getfield $clogp, 'Version'; @@ -4235,8 +4251,11 @@ tagger $authline END if ($tw->{View} eq 'dgit') { + print TO f_ <{View} eq 'maint') { - print TO <