chiark / gitweb /
pseudomerge: Suppress checks in split brain mode with --overwrite
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 18 Oct 2016 00:33:38 +0000 (01:33 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 18 Oct 2016 00:44:23 +0000 (01:44 +0100)
If the user has specified an appropriate --overwrite (=VERSION with
the archive's version, or without a version and the archive's version
being in debian/changelog), do not do all the automatic checks.

Instead, in this case, simply make the dgit view be a descendant of
the archive, as instructed.

Closes:#841101.

When generating split brain pseudomerge with --overwrite

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
dgit

diff --git a/dgit b/dgit
index bc4d7c3e55bb2f1f09b64b6c1dd1d86e42ca6f7a..2cbb2fdf36dc825559a6eac2b049eb360d78d693 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -2896,17 +2896,26 @@ sub splitbrain_pseudomerge ($$$$) {
 
     return $dgitview if is_fast_fwd $archive_hash, $dgitview;
 
-    my $t_dep14 = debiantag_maintview $i_arch_v->[0], access_basedistro;
-    my $i_dep14 = infopair_lrf_tag_lookup($t_dep14, "maintainer view tag");
-    my $t_dgit = debiantag_new $i_arch_v->[0], access_basedistro;
-    my $i_dgit = infopair_lrf_tag_lookup($t_dgit, "dgit view tag");
-    my $i_archive = [ $archive_hash, "current archive contents" ];
-
-    printdebug "splitbrain_pseudomerge i_archive @$i_archive\n";
-
-    infopair_cond_equal($i_dgit, $i_archive);
-    infopair_cond_ff($i_dep14, $i_dgit);
-    $overwrite_version // infopair_cond_ff($i_dep14, [ $maintview, 'HEAD' ]);
+    if (defined $overwrite_version) {
+    } elsif (!eval {
+       my $t_dep14 = debiantag_maintview $i_arch_v->[0], access_basedistro;
+       my $i_dep14 = infopair_lrf_tag_lookup($t_dep14, "maintainer view tag");
+       my $t_dgit = debiantag_new $i_arch_v->[0], access_basedistro;
+       my $i_dgit = infopair_lrf_tag_lookup($t_dgit, "dgit view tag");
+       my $i_archive = [ $archive_hash, "current archive contents" ];
+
+       printdebug "splitbrain_pseudomerge i_archive @$i_archive\n";
+
+       infopair_cond_equal($i_dgit, $i_archive);
+       infopair_cond_ff($i_dep14, $i_dgit);
+       infopair_cond_ff($i_dep14, [ $maintview, 'HEAD' ]);
+       1;
+    }) {
+       print STDERR <<END;
+$us: check failed (maybe --overwrite is needed, consult documentation)
+END
+       die "$@";
+    }
 
     my $r = pseudomerge_make_commit
        $clogp, $dgitview, $archive_hash, $i_arch_v,