fix: fetch the project main an upstream lacks

A remote named upstream added as CONTRIBUTING said and never fetched made validate_pr --changed compare with the fork's main and exit 0 on nothing. It now fetches the project's main when the remote does not hold it. profile_sync names the fetch when --base is absent, and CONTRIBUTING adds git fetch upstream.
This commit is contained in:
Abdessamad Derraz committed 2026-11-05 19:20:50 +01:00
1 parent 9e04bf887d
commit a06f5ad2ba
6 files changed
+71 -12

No files matched your search

+7
View File
@@ -5918,6 +5918,13 @@ class TestBranchProfiles(unittest.TestCase):
["draft", "new"],
)
def test_an_unfetched_base_says_to_fetch(self):
"""`--base upstream/main` with upstream added and never fetched
stopped on git's "Not a valid object name" and no next step."""
with self.assertRaises(SystemExit) as raised:
profile_sync.branch_profiles("emulators", "upstream/main", added_only=True)
self.assertIn("git fetch upstream", str(raised.exception))
def test_the_flag_selects_those_profiles(self):
args = profile_sync.build_parser().parse_args(["--changed", "--base", "main"])
profiles = {"kept": {}, "edited": {}, "new": {}, "draft": {}}