X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=git-debrebase;h=403fba1ba6bc458099849df521b7d6ebff88e660;hb=6122e79e9fe147a285cd98aa938de6c1f024a0c3;hp=0e199b852a747d3e9d225a69d8d5bca0a1003ee5;hpb=0357e638d318892b579635b1e1b34e514dbcd01b;p=dgit.git diff --git a/git-debrebase b/git-debrebase index 0e199b85..403fba1b 100755 --- a/git-debrebase +++ b/git-debrebase @@ -33,7 +33,7 @@ # git-debrebase [] stitch [--prose=] # git-debrebase [] downstream-rebase-launder-v0 # experimental # -# git-debrebase [] convert-from-gbp +# git-debrebase [] convert-from-gbp [] # git-debrebase [] convert-to-gbp # problems / outstanding questions: @@ -111,7 +111,8 @@ sub cfg ($;$) { fail "missing required git config $k" unless $optional; return (); } - return split /\0/, $out; + my @l = split /\0/, $out; + return wantarray ? @l : $l[0]; } memoize('cfg'); @@ -450,15 +451,24 @@ sub classify ($) { Contributor => $identical[0]); } if (@p == 2 && @identical == 2) { - my @bytime = nsort_by { - my ($ph,$pm) = get_commit $_->{CommitId}; + my $get_t = sub { + my ($ph,$pm) = get_commit $_[0]{CommitId}; $ph =~ m/^committer .* (\d+) [-+]\d+$/m or die "$_->{CommitId} ?"; $1; - } @p; + }; + my @bytime = @p; + my $order = $get_t->($bytime[0]) <=> $get_t->($bytime[1]); + if ($order > 0) { # newer first + } elsif ($order < 0) { + @bytime = reverse @bytime; + } else { + # same age, default to order made by -s ours + # that is, commit was made by someone who preferred L + } return $classify->(qw(Pseudomerge), SubType => qw(Ambiguous), - Overwritten => [ $bytime[0] ], - Contributor => $bytime[1]); + Contributor => $bytime[0], + Overwritten => [ $bytime[1] ]); } foreach my $p (@p) { my ($p_h, $p_m) = get_commit $p->{CommitId}; @@ -590,13 +600,16 @@ sub walk ($;$$) { my $bomb = sub { # usage: return $bomb->(); print $report " Unprocessable" if $report; + print $report " ($cl->{Why})" if $report && defined $cl->{Why}; $prprdelim->(); if ($nogenerate) { return (undef,undef); } die "commit $cur: Cannot cope with this commit (d.". (join ' ', map { sprintf "%#x", $_->{Differs} } - @{ $cl->{Parents} }). ")"; + @{ $cl->{Parents} }). + (defined $cl->{Why} ? "; $cl->{Why}": ''). + ")"; }; my $build;