Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7533130

Browse filesBrowse files
authored
Merge pull request #575 from rvermeulen/rvermeulen/address-hotfix-detection
Address hotfix detection
2 parents cdaffa0 + 3ec494f commit 7533130
Copy full SHA for 7533130

File tree

Expand file treeCollapse file tree

1 file changed

+6
-35
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-35
lines changed

‎scripts/release/is-hotfix-release.py

Copy file name to clipboardExpand all lines: scripts/release/is-hotfix-release.py
+6-35Lines changed: 6 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,45 +6,16 @@
66
if TYPE_CHECKING:
77
from argparse import Namespace
88

9-
def get_merge_base_of_ref() -> str:
10-
cp = run(["git", "merge-base", "HEAD", "origin/main"], capture_output=True, text=True)
11-
if cp.returncode != 0:
12-
raise RuntimeError(f"Failed to get merge base with reason '{cp.stderr.strip()}'")
13-
return cp.stdout.strip()
14-
15-
def get_release_branches_containing(commit: str) -> List[Version]:
16-
cp = run(["git", "branch", "--list", "rc/*", "--contains", commit], capture_output=True, text=True)
17-
if cp.returncode != 0:
18-
raise RuntimeError("Failed to get branches containing commit")
19-
release_versions: List[Version] = []
20-
for version in [b.strip() for b in cp.stdout.splitlines()]:
21-
try:
22-
if version.startswith("rc/"):
23-
version = version[3:]
24-
release_versions.append(Version(version))
25-
except ValueError:
26-
print(f"Warning: Skipping invalid version string: {version}", file=stderr)
27-
28-
return release_versions
29-
309
def main(args: 'Namespace') -> Literal[0,1]:
3110
try:
32-
merge_base = get_merge_base_of_ref()
33-
release_versions = get_release_branches_containing(merge_base)
34-
if len(release_versions) == 0:
35-
print(f"Info: No release branches found containing merge base {merge_base}", file=stderr)
11+
version = Version(args.version)
12+
if version.patch > 0:
13+
print("true")
14+
else:
3615
print("false")
37-
return 0
38-
39-
for version in release_versions:
40-
if version.next_patch() == Version(args.version):
41-
print("true")
42-
return 0
43-
44-
print("false")
4516
return 0
46-
except RuntimeError as e:
47-
print(f"Error: {e}", file=stderr)
17+
except ValueError:
18+
print(f"Invalid version string: {args.version}", file=stderr)
4819
return 1
4920

5021
if __name__ == '__main__':

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.