X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=blobdiff_plain;f=git-debrebase;h=06cdc7692ccdeeeb367b6ec244afc742ff004840;hp=c463f4ace5e2c5ba319d815291b922ce0780e540;hb=2250673c9e458438ae3df6c98bbf0423e81891d3;hpb=892352e386b2908574d660df3ee778171f59995b diff --git a/git-debrebase b/git-debrebase index c463f4ac..06cdc769 100755 --- a/git-debrebase +++ b/git-debrebase @@ -846,6 +846,13 @@ sub keycommits ($;$$$$) { return unless $cb; $cb->("unclean-$tagsfx", $why, $cl, $mainwhy); }; + my $found_anchor = sub { + ($anchor) = @_; + $breakwater //= $clogonly; + $breakwater //= $head; + no warnings qw(exiting); + last; + }; for (;;) { $cl = classify $head; my $ty = $cl->{Type}; @@ -859,10 +866,7 @@ sub keycommits ($;$$$$) { } elsif ($ty eq 'Anchor' or $ty eq 'TreatAsAnchor' or $ty eq 'BreakwaterStart') { - $anchor = $head; - $breakwater //= $clogonly; - $breakwater //= $head; - last; + $found_anchor->($head); } elsif ($ty eq 'Upstream') { $x->($unclean, 'ordering', "packaging change ($breakwater) follows upstream change"," (eg $head)") @@ -1082,8 +1086,16 @@ sub walk ($;$$$) { } die "$ty ?"; } elsif ($ty eq 'VanillaMerge' or $ty eq 'MergedBreakwaters') { - # xxx need to handle ffq if one side was unstitched - # wait both of them may be! + # User may have merged unstitched branch(es). We will + # have now lost what ffq-prev was then (since the later + # pseudomerge may introduce further changes). The effect + # of resolving such a merge is that we may have to go back + # further in history to find a merge base, since the one + # which was reachable via ffq-prev is no longer findable. + # This is suboptimal, but if it all works we'll have done + # the right thing. + # xxx we should warn the user in the docs about this + my $ok=1; my $best_anchor; # We expect to find a dominating anchor amongst the @@ -1288,7 +1300,16 @@ sub walk ($;$$$) { $cl->{MergeInterchangeBaseInfo}, @{ $cl->{Parents} }; $last_anchor = $cl->{MergeBestAnchor}; - # xxx need to check the tree somehow + my $check_differs = get_differs $build, $cl->{CommitId}; + # Breakwater changes which were in each side of the + # merge should be in MergeCreateMergedBreakwaters + # output. Upstream changes are exactly the result + # of merge_series. So the only difference should + # be potential laundry results. + $nomerge->(sprintf + "merge misresolved: tree is not the same (%s %s d.%#x)", + $cl->{CommitId}, $build, $check_differs) + if $check_differs & ~D_PAT_ADD; print "Merge resolution successful.\n"; next; } else {