push_tagwants gets a new argument, $maintviewhead, which is defined
iff the quilt mode means we want split tags. It then specifies the
generation of both tags.
push_mktags gains the ability to make the new `maint' view tag (and
checks that the view is not something else unexpected).
Introduce a function debiantag_maintview for calculating the
maintainer's idea of the tag. Currently we use DEP-14 encoding (and
this function is a clone-and-hack of Dgit.pm::debiantag_old, but
perhaps we should do something more complicated (depending on the
quilt mode).
For now we do not push the maint view tag anywhere. The ability to do
that, where appropriate, will come in a moment.
This commit introduces protocol version 4, which includes the new
`maint-view' param. When have a split brain quilt mode, we need to be
sure that we're using protocol version 4 or out peer may not honour
this, resulting in an annoying failure later (the responder sending a
different number of tags to the number expected).
We also have to check that we're using the new tag format (or we might
want to try to generate two different tags with the same name, which
is madness).
When the quilt mode is not a split brain one, this whole commit should
produce no overall functional change (even though a higher protocol
version may be negotiated).
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
our $our_version = 'UNRELEASED'; ###substituted###
our $our_version = 'UNRELEASED'; ###substituted###
-our @rpushprotovsn_support = qw(3 2); # 4 is new tag format
+our @rpushprotovsn_support = qw(4 3 2); # 4 is new tag format
our $protovsn;
our $isuite = 'unstable';
our $protovsn;
our $isuite = 'unstable';
return $tagformatfn->($v, $distro);
}
return $tagformatfn->($v, $distro);
}
+sub debiantag_maintview ($$) {
+ my ($v,$distro) = @_;
+ $v =~ y/~:/_%/;
+ return "$distro/$v";
+}
+
sub lbranch () { return "$branchprefix/$csuite"; }
my $lbranch_re = '^refs/heads/'.$branchprefix.'/([^/.]+)$';
sub lref () { return "refs/heads/".lbranch(); }
sub lbranch () { return "$branchprefix/$csuite"; }
my $lbranch_re = '^refs/heads/'.$branchprefix.'/([^/.]+)$';
sub lref () { return "refs/heads/".lbranch(); }
# > file changes
# [etc]
#
# > file changes
# [etc]
#
+# > param head DGIT-VIEW-HEAD
# > param csuite SUITE
# > param tagformat old|new
# > param csuite SUITE
# > param tagformat old|new
+# > param maint-view MAINT-VIEW-HEAD
#
# > previously REFNAME=OBJNAME # if --deliberately-not-fast-forward
# # goes into tag, for replay prevention
#
# > previously REFNAME=OBJNAME # if --deliberately-not-fast-forward
# # goes into tag, for replay prevention
" but debian/changelog is for $package $cversion";
}
" but debian/changelog is for $package $cversion";
}
-sub push_tagwants ($$$) {
- my ($cversion, $dgithead, $tfbase) = @_;
+sub push_tagwants ($$$$) {
+ my ($cversion, $dgithead, $maintviewhead, $tfbase) = @_;
my @tagwants;
push @tagwants, {
TagFn => \&debiantag,
my @tagwants;
push @tagwants, {
TagFn => \&debiantag,
TfSuffix => '',
View => 'dgit',
};
TfSuffix => '',
View => 'dgit',
};
+ if (defined $maintviewhead) {
+ push @tagwants, {
+ TagFn => \&debiantag_maintview,
+ Objid => $maintviewhead,
+ TfSuffix => '-maintview',
+ View => 'maint',
+ };
+ }
foreach my $tw (@tagwants) {
$tw->{Tag} = $tw->{TagFn}($cversion, access_basedistro);
$tw->{Tfn} = sub { $tfbase.$tw->{TfSuffix}.$_[0]; };
foreach my $tw (@tagwants) {
$tw->{Tag} = $tw->{TagFn}($cversion, access_basedistro);
$tw->{Tfn} = sub { $tfbase.$tw->{TfSuffix}.$_[0]; };
tag $tag
tagger $authline
tag $tag
tagger $authline
+END
+ if ($tw->{View} eq 'dgit') {
+ print TO <<END or die $!;
$package release $cversion for $clogsuite ($csuite) [dgit]
[dgit distro=$declaredistro$delibs]
END
$package release $cversion for $clogsuite ($csuite) [dgit]
[dgit distro=$declaredistro$delibs]
END
- foreach my $ref (sort keys %previously) {
- print TO <<END or die $!;
+ foreach my $ref (sort keys %previously) {
+ print TO <<END or die $!;
[dgit previously:$ref=$previously{$ref}]
END
[dgit previously:$ref=$previously{$ref}]
END
+ }
+ } elsif ($tw->{View} eq 'maint') {
+ print TO <<END or die $!;
+$package release $cversion for $clogsuite ($csuite)
+(maintainer view tag generated by dgit --quilt=$quilt_mode)
+END
+ } else {
+ die Dumper($tw)."?";
Push failed, while preparing your push.
You can retry the push, after fixing the problem, if you like.
END
Push failed, while preparing your push.
You can retry the push, after fixing the problem, if you like.
END
+
+ need_tagformat 'new', "quilt mode $quilt_mode"
+ if quiltmode_splitbrain;
+
prep_ud();
access_giturl(); # check that success is vaguely likely
prep_ud();
access_giturl(); # check that success is vaguely likely
responder_send_command("param head $dgithead");
responder_send_command("param csuite $csuite");
responder_send_command("param tagformat $tagformat");
responder_send_command("param head $dgithead");
responder_send_command("param csuite $csuite");
responder_send_command("param tagformat $tagformat");
+ if (quiltmode_splitbrain) {
+ die unless ($protovsn//4) >= 4;
+ responder_send_command("param maint-view $maintviewhead");
+ }
if (deliberately_not_fast_forward) {
git_for_each_ref(lrfetchrefs, sub {
if (deliberately_not_fast_forward) {
git_for_each_ref(lrfetchrefs, sub {
- my @tagwants = push_tagwants($cversion, $dgithead,
+ my @tagwants = push_tagwants($cversion, $dgithead, $maintviewhead,
".git/dgit/tag");
my @tagobjfns;
".git/dgit/tag");
my @tagobjfns;
my @pushrefs = $forceflag."HEAD:".rrref();
foreach my $tw (@tagwants) {
my @pushrefs = $forceflag."HEAD:".rrref();
foreach my $tw (@tagwants) {
+ my $view = $tw->{View};
+ next unless $view eq 'dgit';
push @pushrefs, $forceflag."refs/tags/$tw->{Tag}";
}
push @pushrefs, $forceflag."refs/tags/$tw->{Tag}";
}
($protovsn) = initiator_expect { m/^dgit-remote-push-ready (\S+)/ };
die "$protovsn ?" unless grep { $_ eq $protovsn } @rpushprotovsn_support;
$supplementary_message = '' unless $protovsn >= 3;
($protovsn) = initiator_expect { m/^dgit-remote-push-ready (\S+)/ };
die "$protovsn ?" unless grep { $_ eq $protovsn } @rpushprotovsn_support;
$supplementary_message = '' unless $protovsn >= 3;
+
+ fail "rpush negotiated protocol version $protovsn".
+ " which does not support quilt mode $quilt_mode"
+ if quiltmode_splitbrain;
+
rpush_handle_protovsn_bothends();
for (;;) {
my ($icmd,$iargs) = initiator_expect {
rpush_handle_protovsn_bothends();
for (;;) {
my ($icmd,$iargs) = initiator_expect {
my $head = $i_param{'head'};
die if $head =~ m/[^0-9a-f]/ || $head !~ m/^../;
my $head = $i_param{'head'};
die if $head =~ m/[^0-9a-f]/ || $head !~ m/^../;
+ my $maintview = $i_param{'maint-view'};
+ die if defined $maintview && $maintview =~ m/[^0-9a-f]/;
+
select_tagformat();
if ($protovsn >= 4) {
my $p = $i_param{'tagformat'} // '<undef>';
select_tagformat();
if ($protovsn >= 4) {
my $p = $i_param{'tagformat'} // '<undef>';
$csuite = $&;
push_parse_dsc $i_dscfn, 'remote dsc', $i_version;
$csuite = $&;
push_parse_dsc $i_dscfn, 'remote dsc', $i_version;
- my @tagwants = push_tagwants $i_version, $head, "tag";
+ my @tagwants = push_tagwants $i_version, $head, $maintview, "tag";
return
push_mktags $i_clogp, $i_dscfn,
return
push_mktags $i_clogp, $i_dscfn,