summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Smith <daniel.smith@qt.io>2023-03-24 11:08:10 +0100
committerDaniel Smith <Daniel.Smith@qt.io>2023-03-29 09:37:18 +0000
commit1d70fe16c46b9d0e0974bd38d6655c00243e85b3 (patch)
tree09f7ae34542cd4fa78fd9dd4155b9cb306adc8c6
parent5b67e2170573358511acbcfa36e18601ef7ff16a (diff)
downloadqtrepotools-1d70fe16c46b9d0e0974bd38d6655c00243e85b3.tar.gz
Allow non-numeric branches which do not begin with wip/
Some repos are better suited to tracking remote branch names from other projects, rather than following the Qt branching scheme. When these branches do not conform to \d+.\d+.\d+, they are not included in the %allHeads of the sanity bot. As such, attempting to cherry-pick to any of these non-conforming branches will be given a -2 by the bot since it is unaware of the branch, even though the pick target is valid. Provide an option per repo to bypass, allowing non-numeric branches. Fixes: QTQAINFRA-5449 Change-Id: I6ca7772703572fdcc010f31dc9bacbbf4fa5e6a2 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Jukka Jokiniva <jukka.jokiniva@qt.io>
-rwxr-xr-xgit-hooks/sanitize-commit9
1 files changed, 8 insertions, 1 deletions
diff --git a/git-hooks/sanitize-commit b/git-hooks/sanitize-commit
index fc27be4..0871b04 100755
--- a/git-hooks/sanitize-commit
+++ b/git-hooks/sanitize-commit
@@ -296,6 +296,11 @@ sub check_apple_terminology()
# The hard-coded fallbacks could be avoided by init-repository setting things up.
my $with_pickbot = parse_bool($config{'with-pickbot'} // "false");
my @LTS = split(/\s+/, $config{'lts-branch'} || "5.6 5.9 5.12 5.15 6.2 6.5");
+# Assume that all WIP branches are reliably prefixed with wip/.
+# Use this when the repo has official branches whose names
+# don't follow Qt policy. If this bypass is not enabled,
+# only numeric branches are included in the branch filters.
+my $wipPrefixed = parse_bool($config{'wip-prefixed'} // "false");
my %allHeads = ();
my %nonDevHeads = ();
@@ -318,7 +323,9 @@ while (<HEADS>) {
}
if ($name =~ m,/dev$,) {
$foundDev = 1;
- } elsif ($name =~ m,/((?:(?:tqtc/)?lts-)?\d+(?:\.\d+)+)$,) {
+ } elsif ($wipPrefixed
+ ? ($name =~ m,(?<!^wip)/(.+)$,)
+ : ($name =~ m,/((?:(?:tqtc/)?lts-)?\d+(?:\.\d+)+)$,)) {
my $branch = $1;
ONCE: while (1) {
foreach my $lts (@LTS) {