summaryrefslogtreecommitdiff
path: root/dgit
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2015-11-18 18:59:35 +0000
committerIan Jackson <ijackson@chiark.greenend.org.uk>2016-07-16 16:47:47 +0100
commitbd5e99ad04dc4eda140aca37840628118d1fa94d (patch)
treecb592a6e9c468b9c3b75f37489ce306797c532ee /dgit
parent40f91b11738a9d84bd8b329c40003d5ac5f08ec3 (diff)
Split brain: Introduce $diffbits (nfc)
Replace ${user,{,un}applied}2${,un}applied with $diffbits->{[HOA]2[HOA]} This encapsulates the info it nicely and makes it easy to pass it to quiltify_splitbrain, which is going to need it.
Diffstat (limited to 'dgit')
-rwxr-xr-xdgit24
1 files changed, 15 insertions, 9 deletions
diff --git a/dgit b/dgit
index 3e4741f..08d07be 100755
--- a/dgit
+++ b/dgit
@@ -2539,7 +2539,8 @@ sub quiltify_tree_sentinelfiles ($) {
return $r;
}
-sub quiltify_splitbrain () {
+sub quiltify_splitbrain ($) {
+ my ($diffbits) = @_;
# memoisation via git-reflog
my $may_apply = $quilt_mode =~ m/gbp|unapplied/;
die "xxx not yet implemented";
@@ -3001,14 +3002,19 @@ END
# We calculate some guesswork now about what kind of tree this might
# be. This is mostly for error reporting.
- my $user2unapplied = quiltify_trees_differ($headref, $unapplied, 1);
- my $user2applied = quiltify_trees_differ($headref, $oldtiptree,1);
- my $applied2unapplied = quiltify_trees_differ($oldtiptree,$unapplied, 1);
+ my $diffbits = {
+ # H = user's HEAD
+ # O = orig, without patches applied
+ # A = "applied", ie orig with H's debian/patches applied
+ H2O => quiltify_trees_differ($headref, $unapplied, 1),
+ H2A => quiltify_trees_differ($headref, $oldtiptree,1),
+ O2A => quiltify_trees_differ($unapplied,$oldtiptree,1),
+ };
my @dl;
foreach my $b (qw(01 02)) {
- foreach my $v ($user2unapplied, $applied2unapplied, $user2applied) {
- push @dl, ($v & $b) ? '##' : '==';
+ foreach my $v (qw(H2O O2A H2A)) {
+ push @dl, ($diffbits->{$v} & $b) ? '##' : '==';
}
}
printdebug "differences \@dl @dl.\n";
@@ -3020,16 +3026,16 @@ END
$dl[2], $dl[5];
my @failsuggestion;
- if (!($user2unapplied & $applied2unapplied)) {
+ if (!($diffbits->{H2O} & $diffbits->{O2A})) {
push @failsuggestion, "This might be a patches-unapplied branch.";
- } elsif (!($user2applied & $applied2unapplied)) {
+ } elsif (!($diffbits->{H2A} & $diffbits->{O2A})) {
push @failsuggestion, "This might be a patches-applied branch.";
}
push @failsuggestion, "Maybe you need to specify one of".
" --quilt=gbp --quilt=dpm --quilt=unapplied ?";
if ($quilt_mode =~ m/gbp|dpm|apply/) {
- quiltify_splitbrain();
+ quiltify_splitbrain($diffbits);
return;
}