From fbf96e6c1449973cf4a8375fa0b0fca40a2e3fa9 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 22 Sep 2016 13:29:10 +0100 Subject: Ovewrite: Honour $overwrite_version in non-split-brain mode Currently there is no commnad line option to set this, so there is no way to exercise this functionality. Signed-off-by: Ian Jackson --- dgit | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'dgit') diff --git a/dgit b/dgit index 483c864..0e99eb5 100755 --- a/dgit +++ b/dgit @@ -537,6 +537,8 @@ our %defcfg = ('dgit.default.distro' => 'debian', # old means "repo server accepts pushes with old dgit tags" # new means "repo server accepts pushes with new dgit tags" # maint means "repo server accepts split brain pushes" + # hist means "repo server may have old pushes without new tag" + # ("hist" is implied by "old") 'dgit-distro.debian.archive-query' => 'ftpmasterapi:', 'dgit-distro.debian.git-check' => 'url', 'dgit-distro.debian.git-check-suffix' => '/info/refs', @@ -2489,6 +2491,40 @@ END_MAKEFF return $r; } +sub plain_overwrite_pseudomerge ($$$) { + my ($clogp, $head, $archive_hash) = @_; + + printdebug "plain_overwrite_pseudomerge..."; + + my $i_arch_v = pseudomerge_version_check($clogp, $archive_hash); + + my @tagformats = access_cfg_tagformats(); + my @t_overwr = + map { $_->($overwrite_version, access_basedistro) } + (grep { m/^(?:old|hist)$/ } @tagformats) + ? \&debiantags : \&debiantag_new; + my $i_overwr = infopair_lrf_tag_lookup \@t_overwr, "previous version tag"; + my $i_archive = [ $archive_hash, "current archive contents" ]; + + infopair_cond_equal($i_overwr, $i_archive); + + return $head if is_fast_fwd $archive_hash, $head; + + my $m = "Declare fast forward from $overwrite_version"; + + my $r = pseudomerge_make_commit + $clogp, $head, $archive_hash, $i_arch_v, <[0] into your HEAD."; + return $r; +} + sub push_parse_changelog ($) { my ($clogpfn) = @_; @@ -2716,6 +2752,12 @@ END } } + if (defined $overwrite_version && !defined $maintviewhead) { + $dgithead = plain_overwrite_pseudomerge($clogp, + $dgithead, + $archive_hash); + } + check_not_dirty(); my $forceflag = ''; -- cgit v1.2.3