diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2015-11-19 00:32:00 +0000 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2016-07-16 16:47:47 +0100 |
commit | b83b6f62fc7c4b473c7228b1293619389b284c5f (patch) | |
tree | e14c3ee46aa026a96bc05523a481c8c7aa72fb5f /dgit | |
parent | bd5e99ad04dc4eda140aca37840628118d1fa94d (diff) |
Split brain: Start work on determining split brain necessity
`Split brain' means the situation where `dgit push' makes private
commits, to push to the dgit repos server, which are not left on the
user's actual branch.
Check whether the quilt mode and tree differences, taken together,
mean that we need split brain.
If we do need split brain, use gbp pq to apply the patch series.
.gitignore changes are mishandled, still. And we don't actually
follow through much yet.
Also, fix a case where quilt mode `apply' hadn't been changed to
`unapplied'.
Diffstat (limited to 'dgit')
-rwxr-xr-x | dgit | 32 |
1 files changed, 26 insertions, 6 deletions
@@ -83,6 +83,7 @@ our (@dpkgbuildpackage) = qw(dpkg-buildpackage -i\.git/ -I.git); our (@dpkgsource) = qw(dpkg-source -i\.git/ -I.git); our (@dpkggenchanges) = qw(dpkg-genchanges); our (@mergechanges) = qw(mergechanges -f); +our (@gbppq) = qw(gbp-pq); our (@changesopts) = (''); our %opts_opt_map = ('dget' => \@dget, # accept for compatibility @@ -114,6 +115,7 @@ autoflush STDOUT 1; our $supplementary_message = ''; our $need_split_build_invocation = 0; +our $split_brain = 0; END { local ($@, $?); @@ -2537,15 +2539,33 @@ sub quiltify_tree_sentinelfiles ($) { qw(-- debian/rules debian/control); $r =~ s/\n/,/g; return $r; + } + +sub quiltify_splitbrain_needed () { + if (!$split_brain) { + progress "creating dgit view"; + runcmd @git, qw(checkout -q -b dgit-view); + $split_brain = 1; + } } sub quiltify_splitbrain ($) { my ($diffbits) = @_; - # memoisation via git-reflog - my $may_apply = $quilt_mode =~ m/gbp|unapplied/; - die "xxx not yet implemented"; -# if ($may_apply && -# quiltify_trees_differ($userhead,)) {} + if ($quilt_mode !~ m/gbp|dpm/) { + # treat .gitignore just like any other upstream file + $diffbits = { %$diffbits }; + $_ = !!$_ foreach values %$diffbits; + } + if ($quilt_mode =~ m/gbp|unapplied/ && + ($diffbits->{O2A} & 01) && # some patches + !($diffbits->{H2O} & 01)) { # but HEAD is like orig + quiltify_splitbrain_needed(); + runcmd @gbppq, qw(import); + die "SPLIT BRAIN"; + } + die 'xxx gitignore'; + die 'xxx memoisation via git-reflog'; + die 'xxx fast forward'; } sub quiltify ($$$$) { @@ -3034,7 +3054,7 @@ END push @failsuggestion, "Maybe you need to specify one of". " --quilt=gbp --quilt=dpm --quilt=unapplied ?"; - if ($quilt_mode =~ m/gbp|dpm|apply/) { + if ($quilt_mode =~ m/gbp|dpm|unapplied/) { quiltify_splitbrain($diffbits); return; } |