Merge pull request 'Don't check merge base branch' (#13) from 10-no-recheck-master into master
Reviewed-on: #13
This commit is contained in:
commit
b4b2b2ec5d
@ -58,6 +58,13 @@ def pr_merge_status(
|
|||||||
|
|
||||||
results = {}
|
results = {}
|
||||||
|
|
||||||
|
# Check if base branch is in our list, if it is
|
||||||
|
# no need to call commit_in_branch
|
||||||
|
merge_base_branch = pr_data.get("base", {}).get("ref")
|
||||||
|
if merge_base_branch in branches:
|
||||||
|
results[merge_base_branch] = True
|
||||||
|
branches.remove(merge_base_branch)
|
||||||
|
|
||||||
for branch in branches:
|
for branch in branches:
|
||||||
in_branch = commit_in_branch(commit_sha, branch)
|
in_branch = commit_in_branch(commit_sha, branch)
|
||||||
results[branch] = in_branch
|
results[branch] = in_branch
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "nixprstatus"
|
name = "nixprstatus"
|
||||||
version = "0.1.2"
|
version = "0.1.3"
|
||||||
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"
|
||||||
|
@ -66,6 +66,19 @@ class TestPRMergeStatus(unittest.TestCase):
|
|||||||
res = pr_merge_status(pr, branches, check_backport=True)
|
res = pr_merge_status(pr, branches, check_backport=True)
|
||||||
self.assertEqual(res.title, expected_title)
|
self.assertEqual(res.title, expected_title)
|
||||||
|
|
||||||
|
@unittest.mock.patch("requests.get", side_effect=mocked_requests_get)
|
||||||
|
def test_pr_merge_status_no_check_master_345583(self, mock_get):
|
||||||
|
pr = 345583
|
||||||
|
branches = ["master", "nixos-unstable", "nixos-24.05"]
|
||||||
|
master_compare_url = "https://api.github.com/repos/NixOS/nixpkgs/compare/master...2c5fac3edf2d00d948253e392ec1604b29b38f14"
|
||||||
|
|
||||||
|
res = pr_merge_status(pr, branches, check_backport=False)
|
||||||
|
self.assertTrue(res.merged)
|
||||||
|
self.assertTrue(res.branches["master"])
|
||||||
|
|
||||||
|
urls_called = [call[0][0] for call in mock_get.call_args_list]
|
||||||
|
self.assertFalse(master_compare_url in urls_called)
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user