mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-06 01:53:56 -06:00
fix: keep upstream HEAD for a pin past the fork
_follow_fork_base swapped the fork merge base in as upstream HEAD even when upstream_commit was newer than that base, as for melonds and easyrpg whose upstream is the standalone build they document. melonds read its Qt refs 825 commits back and reported 4 to review. A pin that descends from the base now keeps the HEAD, melonds shows 0 to review.
This commit is contained in:
1 parent
651cabf412
commit
f8dce8f8c3
2 files changed
+23
-2
No files matched your search
@@ -1257,6 +1257,14 @@ def _follow_fork_base(
|
||||
base = upstream.fork_base(
|
||||
view.repo, view.head, source.repo, source.head, cache_dir, offline
|
||||
)
|
||||
if base and base != view.pin:
|
||||
# A pin newer than the merge base names code the port does not
|
||||
# carry: the upstream is a build of its own, the Qt melonDS or the
|
||||
# EasyRPG Player a standalone + libretro profile documents, and
|
||||
# its HEAD stays the reference. melonds read 825 commits back.
|
||||
moved = upstream.ancestry(view.repo, base, view.pin, cache_dir, offline)
|
||||
if moved and moved[0] > 0 and moved[1] == 0:
|
||||
base = None
|
||||
followed.append(
|
||||
replace(view, head=base, origin=f"{view.origin}, fork base of {source.repo.slug}")
|
||||
if base else view
|
||||
|
||||
@@ -5465,7 +5465,7 @@ class UpstreamForkedByThePort(unittest.TestCase):
|
||||
upstream with the fork. Compared to upstream's own HEAD, a bump moved it
|
||||
past anything the port carries."""
|
||||
|
||||
def _views(self, base):
|
||||
def _views(self, base, ancestry=None):
|
||||
from unittest import mock # noqa: PLC0415
|
||||
|
||||
fork = profile_sync.upstream.make_repo("github.com", "f", "port")
|
||||
@@ -5477,7 +5477,9 @@ class UpstreamForkedByThePort(unittest.TestCase):
|
||||
]
|
||||
with mock.patch.object(
|
||||
profile_sync.upstream, "fork_base", return_value=base
|
||||
) as asked:
|
||||
) as asked, mock.patch.object(
|
||||
profile_sync.upstream, "ancestry", return_value=ancestry
|
||||
):
|
||||
followed = profile_sync._follow_fork_base(views, "cache", True)
|
||||
return followed, asked
|
||||
|
||||
@@ -5492,6 +5494,17 @@ class UpstreamForkedByThePort(unittest.TestCase):
|
||||
views, _ = self._views(None)
|
||||
self.assertEqual(views[1].head, "up-tip")
|
||||
|
||||
def test_a_pin_newer_than_the_base_keeps_the_tip(self):
|
||||
"""melonds documents the Qt standalone from melonDS-emu/melonDS: its
|
||||
upstream_commit is 825 commits past the merge base with the libretro
|
||||
fork, and reading its refs at the 2021 base reported them CHANGED."""
|
||||
views, _ = self._views("old-merge", ancestry=(825, 0))
|
||||
self.assertEqual(views[1].head, "up-tip")
|
||||
|
||||
def test_a_pin_behind_the_base_follows_it(self):
|
||||
views, _ = self._views("new-base", ancestry=(0, 12))
|
||||
self.assertEqual(views[1].head, "new-base")
|
||||
|
||||
|
||||
class ACachedTipOlderThanThePin(TestBuildReport):
|
||||
"""scummvm-standalone was pinned on 6f7b060d while the cached tip was
|
||||
|
||||
Reference in new issue
Block a user