Compare commits

..

No commits in common. "22456984058ff1a29215450e3aa6a0ecc0d901a7" and "356da4d8ecfdcae4ccca10d65fc777f911b2e7e4" have entirely different histories.

4 changed files with 4 additions and 19 deletions

View File

@ -28,8 +28,6 @@ def pr(
status = pr_merge_status(pr, branches) status = pr_merge_status(pr, branches)
else: else:
status = pr_merge_status(pr) status = pr_merge_status(pr)
console.print(f"{status.title}\n", highlight=False)
merged = ":white_check_mark: merged" if status.merged else ":x: merged" merged = ":white_check_mark: merged" if status.merged else ":x: merged"
console.print(merged, highlight=False) console.print(merged, highlight=False)

View File

@ -9,7 +9,6 @@ BACKPORT_LABEL = "backport release-24.05"
class PRStatus(BaseModel): class PRStatus(BaseModel):
title: str
merged: bool merged: bool
branches: dict[str, bool] branches: dict[str, bool]
@ -41,13 +40,10 @@ def pr_merge_status(
pr_response.raise_for_status() pr_response.raise_for_status()
pr_data = pr_response.json() pr_data = pr_response.json()
title = pr_data["title"]
merged = pr_data["merged"] merged = pr_data["merged"]
if merged is False: if merged is False:
return PRStatus( return PRStatus(merged=False, branches={branch: False for branch in branches})
title=title, merged=False, branches={branch: False for branch in branches}
)
commit_sha = pr_data.get("merge_commit_sha") commit_sha = pr_data.get("merge_commit_sha")
@ -81,11 +77,11 @@ def pr_merge_status(
backport_sha = backport_response.json().get("merge_commit_sha") backport_sha = backport_response.json().get("merge_commit_sha")
if backport_sha is None: if backport_sha is None:
results[f"nixos-24.05 (#{backport_pr})"] = False results[f"nixos-24.05 (#{backport_pr})"] = False
return PRStatus(title=title, merged=True, branches=results) return PRStatus(merged=True, branches=results)
results.pop("nixos-24.05") results.pop("nixos-24.05")
results[f"nixos-24.05 (#{backport_pr})"] = commit_in_branch( results[f"nixos-24.05 (#{backport_pr})"] = commit_in_branch(
backport_sha, "nixos-24.05" backport_sha, "nixos-24.05"
) )
return PRStatus(title=title, merged=True, branches=results) return PRStatus(merged=True, branches=results)

View File

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "nixprstatus" name = "nixprstatus"
version = "0.1.2" version = "0.1.1"
description = "Nixpkgs PR status checker" description = "Nixpkgs PR status checker"
authors = ["Torjus Håkestad <torjus@usit.uio.no>"] authors = ["Torjus Håkestad <torjus@usit.uio.no>"]
license = "MIT" license = "MIT"

View File

@ -57,15 +57,6 @@ class TestPRMergeStatus(unittest.TestCase):
self.assertTrue(res.merged) self.assertTrue(res.merged)
self.assertTrue(res.branches["nixos-24.05 (#346022)"]) self.assertTrue(res.branches["nixos-24.05 (#346022)"])
@unittest.mock.patch("requests.get", side_effect=mocked_requests_get)
def test_pr_merge_status_title_345769(self, mock_get):
pr = 345769
branches = ["nixos-24.05"]
expected_title = "Firefox: 130.0.1 -> 131.0; 128.2.0esr -> 128.3.0esr; 115.15.0esr -> 115.16.0esr"
res = pr_merge_status(pr, branches, check_backport=True)
self.assertEqual(res.title, expected_title)
class TestCommitInBranch(unittest.TestCase): class TestCommitInBranch(unittest.TestCase):
@unittest.mock.patch("requests.get", side_effect=mocked_requests_get) @unittest.mock.patch("requests.get", side_effect=mocked_requests_get)