summaryrefslogtreecommitdiffstats
path: root/tools/validate-commit.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:14:26 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:14:26 +0000
commitc4e8a3222648fcf22ca207f1815ebbf7cd144eeb (patch)
tree93d5c6aa93d9987680dd1adad5685e2ad698f223 /tools/validate-commit.py
parentAdding upstream version 4.2.6. (diff)
downloadwireshark-upstream.tar.xz
wireshark-upstream.zip
Adding upstream version 4.4.0.upstream/4.4.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/validate-commit.py')
-rwxr-xr-xtools/validate-commit.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/tools/validate-commit.py b/tools/validate-commit.py
index cf4980be..b5d85afe 100755
--- a/tools/validate-commit.py
+++ b/tools/validate-commit.py
@@ -19,7 +19,6 @@ import json
import os
import subprocess
import sys
-import tempfile
import urllib.request
import re
@@ -190,6 +189,14 @@ def verify_merge_request():
print("This doesn't appear to be a merge request. CI_MERGE_REQUEST_PROJECT_ID={}, CI_MERGE_REQUEST_IID={}".format(project_id, m_r_iid))
return True
+ m_r_sb_protected = os.getenv('CI_MERGE_REQUEST_SOURCE_BRANCH_PROTECTED')
+ if m_r_sb_protected == 'true':
+ print(f'''\
+You're pushing from a protected branch ({os.getenv('CI_MERGE_REQUEST_SOURCE_BRANCH_NAME')}). You will probably
+have to close this merge request and push from a different branch.\n
+''')
+ # Assume that the "Allow commits" test is about to fail.
+
m_r_url = '{}/projects/{}/merge_requests/{}'.format(gitlab_api_pfx, project_id, m_r_iid)
req = urllib.request.Request(m_r_url)
# print('req', repr(req), m_r_url)
@@ -219,8 +226,8 @@ def main():
try:
with open(args.commitmsg) as f:
return 0 if verify_body(f.read()) else 1
- except:
- print("Couldn't verify body of message from file '", + args.commitmsg + "'");
+ except Exception:
+ print("Couldn't verify body of message from file '", + args.commitmsg + "'")
return 1