X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=blobdiff_plain;f=git-debrebase;h=829ab82ce6e44941e0be6ddb83ff7922bf3b573e;hp=3101ae7d9dcddb39902d3aa6b71d976d694c5c3c;hb=e1026645bc6576b9b0f4c20e59b5f785c125aff2;hpb=0eef00174d9c13c2a7b3c72c9515d5fc89a7feba diff --git a/git-debrebase b/git-debrebase index 3101ae7d..829ab82c 100755 --- a/git-debrebase +++ b/git-debrebase @@ -47,7 +47,7 @@ usages: git-debrebase [] prepush [--prose=...] git-debrebase [] quick|conclude git-debrebase [] new-upstream [
] - git-debrebase [] convert-from-gbp [] + git-debrebase [] convert-from-* ... ... See git-debrebase(1), git-debrebase(5), dgit-maint-debrebase(7) (in dgit). END @@ -2537,6 +2537,7 @@ sub complete_convert_from ($$$$) { update_head_checkout $old_head, $new_head, $mrest; } +sub cmd_convert_from_unapplied () { cmd_convert_from_gbp(); } sub cmd_convert_from_gbp () { badusage __ "want only 1 optional argument, the upstream git commitish" unless @ARGV<=1; @@ -2698,10 +2699,10 @@ sub cmd_convert_to_gbp () { } snags_maybe_bail(); update_head_checkout $head, $out, "convert to gbp (v0)"; - print <1; + fail __ "takes 1 optional argument, the upstream commitish" if @ARGV>1; my @upstreams; @@ -2728,7 +2729,7 @@ sub cmd_convert_from_dgit_view () { my $spec = shift @ARGV; my $commit = git_rev_parse "$spec^{commit}"; push @upstreams, { Commit => $commit, - Source => "$ARGV[0], from command line", + Source => (f_ "%s, from command line", $ARGV[0]), Only => 1, }; } @@ -2741,12 +2742,13 @@ sub cmd_convert_from_dgit_view () { keycommits $head, sub{}, sub{}, $trouble, $trouble; printdebug "troubles=$troubles\n"; if (!$troubles) { - print STDERR <{Version}; - print STDERR "Considering possible commits corresponding to upstream:\n"; + print STDERR __ + "Considering possible commits corresponding to upstream:\n"; if (!@upstreams) { if ($do_tags) { my @tried; my $ups_tag = upstream_commitish_search $version, \@tried; if ($ups_tag) { - my $this = "git tag $tried[-1]"; + my $this = f_ "git tag %s", $tried[-1]; push @upstreams, { Commit => $ups_tag, Source => $this, }; } else { - printf STDERR + print STDERR f_ " git tag: no suitable tag found (tried %s)\n", "@tried"; } @@ -2778,11 +2781,12 @@ END # we do a quick check to see if there are plausible origs my $something=0; if (!opendir BPD, $bpd) { - die "opendir build-products-dir $bpd: $!" unless $!==ENOENT; + die f_ "opendir build-products-dir %s: %s", $bpd, $! + unless $!==ENOENT; } else { while ($!=0, my $f = readdir BPD) { next unless is_orig_file_of_p_v $f, $p, $version; - printf STDERR + print STDERR f_ " orig: found what looks like a .orig, %s\n", "$bpd/$f"; $something=1; @@ -2813,7 +2817,7 @@ END }; } } else { - printf STDERR + print STDERR f_ " orig: no suitable origs found (looked for %s in %s)\n", "${p}_".(stripeoch $version)."...", $bpd; } @@ -2822,7 +2826,8 @@ END my $some_patches = stat_exists 'debian/patches/series'; - print STDERR "Evaluating possible commits corresponding to upstream:\n"; + print STDERR __ + "Evaluating possible commits corresponding to upstream:\n"; my $result; foreach my $u (@upstreams) { @@ -2858,7 +2863,7 @@ END } my $r = system @gbp_cmd; if ($r) { - printf STDERR + print STDERR f_ " %s: couldn't apply patches: gbp pq %s", $u->{Source}, waitstatusmsg(); return; @@ -2867,8 +2872,9 @@ END my $work = git_rev_parse qw(HEAD); my $diffout = cmdoutput @git, qw(diff-tree --stat HEAD), $work; if (length $diffout) { - print STDERR - " $u->{Source}: applying patches gives different tree\n"; + print STDERR f_ + " %s: applying patches gives different tree\n", + $u->{Source}; print STDERR $diffout if $diagnose; return; } @@ -2880,24 +2886,26 @@ END } if (!$result) { - fail <{Source}; + print STDERR f_ "Yes, will base new branch on %s\n", $result->{Source}; complete_convert_from $head, $result->{Result}, $gdrlastinfo, 'convert-from-dgit-view'; } sub cmd_forget_was_ever_debrebase () { - badusage "forget-was-ever-debrebase takes no further arguments" if @ARGV; + badusage __ "forget-was-ever-debrebase takes no further arguments" + if @ARGV; my ($ffqstatus, $ffq_msg, $current, $ffq_prev, $gdrlast) = ffq_prev_branchinfo(); - fail "Not suitable for recording git-debrebaseness anyway: $ffq_msg" + fail f_ "Not suitable for recording git-debrebaseness anyway: %s", + $ffq_msg if defined $ffq_msg; push @deferred_updates, "delete $ffq_prev"; push @deferred_updates, "delete $gdrlast"; @@ -2998,7 +3006,7 @@ setlocale(LC_MESSAGES, ""); textdomain("git-debrebase"); getoptions_main - ("bad options\n", + (__ "bad options\n", "D+" => \$debuglevel, 'noop-ok', => \$opt_noop_ok, 'f=s' => \@snag_force_opts, @@ -3024,8 +3032,7 @@ getoptions_main initdebug('git-debrebase '); enabledebug if $debuglevel; -my $toplevel = cmdoutput @git, qw(rev-parse --show-toplevel); -chdir $toplevel or fail "chdir toplevel $toplevel: $!\n"; +changedir_git_toplevel(); $rd = fresh_playground "$playprefix/misc";