summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Smith <daniel.smith@qt.io>2022-06-28 09:34:34 +0200
committerDaniel Smith <Daniel.Smith@qt.io>2022-06-30 14:40:35 +0000
commit125f1520ee41b018888e2e2652a0b1c299f93550 (patch)
treefe444f397dc8270075cf2e317ea9340d53aab5fa
parent1d75b08b83c5d27cf6e0af1b7117e0c396aa3b1c (diff)
downloadqtrepotools-125f1520ee41b018888e2e2652a0b1c299f93550.tar.gz
Complain when pick-to footers do not contain the latest stable branch
If a change targets the latest-1 stable branch, but neglects to include the current latest, the sanity bot should give a -1 warning with a comment. This situation often arises in changes shortly after qt branches to a new stable branch, as it's easy to forget the latest branch target has moved forward. Task-number: QTQAINFRA-5035 Change-Id: I2067c9b1865bd290183d77e46bca2f491708ca2b Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
-rwxr-xr-xgit-hooks/sanitize-commit18
1 files changed, 18 insertions, 0 deletions
diff --git a/git-hooks/sanitize-commit b/git-hooks/sanitize-commit
index da73988..bea948c 100755
--- a/git-hooks/sanitize-commit
+++ b/git-hooks/sanitize-commit
@@ -603,6 +603,24 @@ if ($with_pickbot) {
} else {
complain("Omission of Pick-to footer is probably incorrect", "cherry");
}
+ } elsif (%picktos) {
+ my %majors;
+ # Populate a hash of majors with arrays of stable branches
+ foreach (keys %allHeads) {
+ if (/^(\d+)\.(\d+)$/) {
+ push @{$majors{$1}}, $2;
+ }
+ }
+ foreach (sort keys %majors) {
+ if (@{$majors{$_}} >= 2) {
+ my @major = sort { $a <=> $b } @{$majors{$_}};
+ my ($latest, $previous) = ("$_.$major[-1]", "$_.$major[-2]");
+ if (exists($picktos{$previous}) && !exists($picktos{$latest})) {
+ complain("Omission of $latest from cherry-pick targets".
+ " is probably incorrect", "cherry");
+ }
+ }
+ }
}
}
} elsif (!$havecherry && length($ltsForSha1)) {