our $our_version = 'UNRELEASED'; ###substituted###
our $absurdity = undef; ###substituted###
-our @rpushprotovsn_support = qw(4); # 4 is new tag format
+our @rpushprotovsn_support = qw(4 5); # 5 drops tag format specification
our $protovsn;
our $cmd;
our $supplementary_message = '';
our $made_split_brain = 0;
-our $do_split_brain = 0;
+our $do_split_brain;
# Interactions between quilt mode and split brain
# (currently, split brain only implemented iff
#
# no split no q cache no q cache forbidden,
# brain PM on master q fixup on master prevented
-# !$do_split_brain PM on master
+# !do_split_brain() PM on master
#
# split brain no q cache q fixup cached, to dgit view
# PM in dgit view PM in dgit view
$absurdity =~ s{/[^/]+$}{/absurd} or die;
}
-sub debiantag ($$) {
- my ($v,$distro) = @_;
- return debiantag_new($v, $distro);
-}
-
sub madformat ($) { $_[0] eq '3.0 (quilt)' }
sub lbranch () { return "$branchprefix/$csuite"; }
$quilt_mode =~ m/gbp|dpm|unapplied/;
}
+sub do_split_brain () { !!($do_split_brain // confess) }
+
sub opts_opt_multi_cmd {
my $extra = shift;
my @cmd;
#
# > param head DGIT-VIEW-HEAD
# > param csuite SUITE
-# > param tagformat new # $protovsn >= 4
+# > param tagformat new # $protovsn == 4
# > param maint-view MAINT-VIEW-HEAD
#
# > param buildinfo-filename P_V_X.buildinfo # zero or more times
# deliberately-not-ff, in which case we must fetch everything.
my @specs = deliberately_not_fast_forward ? qw(tags/*) :
- map { "tags/$_" }
- (quiltmode_splitbrain
- ? (map { $_->('*',access_nomdistro) }
- \&debiantag_new, \&debiantag_maintview)
- : debiantags('*',access_nomdistro));
+ map { "tags/$_" } debiantags('*',access_nomdistro);
push @specs, server_branch($csuite);
push @specs, $rewritemap;
push @specs, qw(heads/*) if deliberately_not_fast_forward;
if (!$we_are_initiator) {
# rpush initiator can't do this because it doesn't have $isuite yet
- my $tag = debiantag($cversion, access_nomdistro);
+ my $tag = debiantag_new($cversion, access_nomdistro);
runcmd @git, qw(check-ref-format), $tag;
}
my ($cversion, $dgithead, $maintviewhead, $tfbase) = @_;
my @tagwants;
push @tagwants, {
- TagFn => \&debiantag,
+ TagFn => \&debiantag_new,
Objid => $dgithead,
TfSuffix => '',
View => 'dgit',
TfSuffix => '-maintview',
View => 'maint',
};
- } elsif ($dodep14tag eq 'no' ? 0
- : $dodep14tag eq 'want' ? 1
- : $dodep14tag eq 'always' ? 1
- : die "$dodep14tag ?") {
+ } elsif ($dodep14tag ne 'no') {
push @tagwants, {
TagFn => \&debiantag_maintview,
Objid => $dgithead,
if (madformat_wantfixup($format)) {
# user might have not used dgit build, so maybe do this now:
- if ($do_split_brain) {
+ if (do_split_brain()) {
changedir $playground;
my $cachekey;
($dgithead, $cachekey) =
perhaps HEAD changed since dgit build[-source] ?",
$quilt_mode;
}
- if (!$do_split_brain) {
+ if (!do_split_brain()) {
# In split brain mode, do not attempt to incorporate dirty
# stuff from the user's working tree. That would be mad.
commit_quilty_patch();
}
}
- if ($do_split_brain) {
+ if (do_split_brain()) {
$made_split_brain = 1;
$dgithead = splitbrain_pseudomerge($clogp,
$actualhead, $dgithead,
}
}
- confess unless !!$made_split_brain == !!$do_split_brain;
+ confess unless !!$made_split_brain == do_split_brain();
changedir $playground;
progress f_ "checking that %s corresponds to HEAD", $dscfn;
responder_send_command("param head $dgithead");
responder_send_command("param csuite $csuite");
responder_send_command("param isuite $isuite");
- responder_send_command("param tagformat new");
+ responder_send_command("param tagformat new"); # needed in $protovsn==4
if (defined $maintviewhead) {
responder_send_command("param maint-view $maintviewhead");
}
my $maintview = $i_param{'maint-view'};
die if defined $maintview && $maintview =~ m/[^0-9a-f]/;
- if ($protovsn >= 4) {
+ if ($protovsn == 4) {
my $p = $i_param{'tagformat'} // '<undef>';
$p eq 'new'
or badproto \*RO, "tag format mismatch: $p vs. new";
local $ENV{GIT_AUTHOR_EMAIL} = $authline[1];
local $ENV{GIT_AUTHOR_DATE} = $authline[2];
- confess unless $do_split_brain;
+ confess unless do_split_brain();
my $fulldiffhint = sub {
my ($x,$y) = @_;
my $splitbrain_cachekey;
- if ($do_split_brain) {
+ if (do_split_brain()) {
my $cachehit;
($cachehit, $splitbrain_cachekey) =
quilt_check_splitbrain_cache($headref, $upstreamversion);
}
unpack_playtree_need_cd_work($headref);
- if ($do_split_brain) {
+ 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
$splitbrain_cachekey);
}
- if ($do_split_brain) {
+ if (do_split_brain()) {
my $dgitview = git_rev_parse 'HEAD';
changedir $maindir;
progress f_ "starting quiltify (multiple patches, %s mode)", $quilt_mode;
quiltify($clogp,$headref,$oldtiptree,\@failsuggestion);
- runcmd @git, qw(checkout -q), (qw(master dgit-view)[!!$do_split_brain]);
+ runcmd @git, qw(checkout -q), (qw(master dgit-view)[do_split_brain()]);
if (!open P, '>>', ".pc/applied-patches") {
$!==&ENOENT or confess "$!";
$dscfn = dscfn($version);
}
-sub build_or_push_prep_modes () {
+sub determine_whether_split_brain () {
my ($format,) = get_source_format();
printdebug "format $format, quilt mode $quilt_mode\n";
if (madformat_wantfixup($format) && quiltmode_splitbrain()) {
$do_split_brain = 1;
}
+ $do_split_brain //= 0;
+}
+
+sub build_or_push_prep_modes () {
+ determine_whether_split_brain();
+
fail __ "dgit: --include-dirty is not supported in split view quilt mode"
- if $do_split_brain && $includedirty;
+ if do_split_brain() && $includedirty;
}
sub build_prep_early () {
unlink "$buildproductsdir/$sourcechanges" or $!==ENOENT
or fail f_ "remove %s: %s", $sourcechanges, $!;
}
-# confess unless !!$made_split_brain == !!$do_split_brain;
+# confess unless !!$made_split_brain == do_split_brain();
my @cmd = (@dpkgsource, qw(-b --));
my $leafdir;