summaryrefslogtreecommitdiff
path: root/dgit
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2019-06-06 13:54:48 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2019-06-28 12:45:38 +0100
commit0a65d9b91e6bb11ad6d842b3d5961320c154213b (patch)
tree7fdac93ef6c0a04e4aa8fabbd4d270c6ffff2386 /dgit
parent43fdff73d08efd6dfc74b3e830492048bf7b76dc (diff)
dgit: split brain reorg: Move some split brain code further out.
We are going to want this in other quilt modes. Logically, it should occur in build_maybe_quilt_fixup. Specifically, move: * the quilt cache check * the splitting of the dgit-view branch and setting $split_brain out of quilt_fixup_multipatch. quilt_fixup_multipatch now gets $upstreamversion as a parameter. Right now this logic in build_maybe_quilt_fixup is a bit flabby and confusing. We hope to tidy it up a bit later. No functional change. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'dgit')
-rwxr-xr-xdgit43
1 files changed, 27 insertions, 16 deletions
diff --git a/dgit b/dgit
index 70f28dc..a902590 100755
--- a/dgit
+++ b/dgit
@@ -5817,11 +5817,34 @@ sub build_maybe_quilt_fixup () {
my $clogp = parsechangelog();
my $headref = git_rev_parse('HEAD');
my $symref = git_get_symref();
+ my $upstreamversion = upstreamversion $version;
prep_ud();
changedir $playground;
- my $upstreamversion = upstreamversion $version;
+ my $splitbrain_cachekey;
+
+ if ($do_split_brain) {
+ my $cachehit;
+ ($cachehit, $splitbrain_cachekey) =
+ quilt_check_splitbrain_cache($headref, $upstreamversion);
+ if ($cachehit) {
+ changedir $maindir;
+ return;
+ }
+ }
+
+ unpack_playtree_need_cd_work($headref);
+ if ($do_split_brain) {
+ runcmd @git, qw(checkout -q -b dgit-view);
+ # so long as work is not deleted, its current branch will
+ # remain dgit-view, rather than master, so subsequent calls to
+ # unpack_playtree_need_cd_work
+ # will DTRT, resetting dgit-view.
+ die if $split_brain;
+ $split_brain = 1;
+ }
+ chdir '..';
if ($fopts->{'single-debian-patch'}) {
fail f_
@@ -5830,7 +5853,8 @@ sub build_maybe_quilt_fixup () {
if quiltmode_splitbrain();
quilt_fixup_singlepatch($clogp, $headref, $upstreamversion);
} else {
- quilt_fixup_multipatch($clogp, $headref, $upstreamversion);
+ quilt_fixup_multipatch($clogp, $headref, $upstreamversion,
+ $splitbrain_cachekey);
}
changedir $maindir;
@@ -6056,7 +6080,7 @@ sub quilt_check_splitbrain_cache ($$) {
}
sub quilt_fixup_multipatch ($$$) {
- my ($clogp, $headref, $upstreamversion) = @_;
+ my ($clogp, $headref, $upstreamversion, $splitbrain_cachekey) = @_;
progress f_ "examining quilt state (multiple patches, %s mode)",
$quilt_mode;
@@ -6130,8 +6154,6 @@ sub quilt_fixup_multipatch ($$$) {
# afterwards with dpkg-source --before-build. That lets us save a
# tree object corresponding to .origs.
- my $splitbrain_cachekey;
-
if ($quilt_mode eq 'linear'
&& branch_is_gdr($headref)) {
# This is much faster. It also makes patches that gdr
@@ -6165,12 +6187,6 @@ sub quilt_fixup_multipatch ($$$) {
chdir '..';
}
- if ($do_split_brain) {
- my $cachehit;
- ($cachehit, $splitbrain_cachekey) =
- quilt_check_splitbrain_cache($headref, $upstreamversion);
- return if $cachehit;
- }
my $unapplied=quilt_fakedsc2unapplied($headref, $upstreamversion);
ensuredir '.pc';
@@ -6266,11 +6282,6 @@ END
push @failsuggestion, [ 'origs', __
"Maybe orig tarball(s) are not identical to git representation?" ];
- if ($do_split_brain) {
- runcmd @git, qw(checkout -q -b dgit-view);
- die if $split_brain;
- $split_brain = 1;
- }
if (quiltmode_splitbrain()) {
quiltify_splitbrain($clogp, $unapplied, $headref, $oldtiptree,
$diffbits, \%editedignores,