mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-06 01:53:56 -06:00
fix: rank orphaned and moved pins first in triage
drift_score ignored orphaned pins and moved repositories although triage_state says they are fixed before any ref is read: pcem ranked last at 0 with an upstream_commit on no branch. Each now weighs more than a GONE ref.
This commit is contained in:
1 parent
a3c853316a
commit
651cabf412
2 files changed
+17
No files matched your search
@@ -2627,6 +2627,7 @@ def tree_diff(result: CompareResult, ref_dirs: set[str]) -> list[str]:
|
||||
|
||||
|
||||
DRIFT_WEIGHTS = {"GONE": 40, "CHANGED": 30, "AMBIGUOUS": 15, "SHIFTED": 1}
|
||||
PIN_WEIGHT = 50
|
||||
|
||||
|
||||
def drift_score(
|
||||
@@ -2644,6 +2645,10 @@ def drift_score(
|
||||
if version is not None and not version.tag_matches_declared:
|
||||
if version.latest_release and version.latest_release != version.declared:
|
||||
score += 10
|
||||
# A pin off its branch or a repository answering under another name is
|
||||
# set again before any ref can be read, so each outranks a GONE ref:
|
||||
# pcem ranked last at 0 with an orphaned upstream_commit.
|
||||
score += PIN_WEIGHT * (len(report.orphaned) + len(report.moved_repos))
|
||||
score += min(commits, 20) // 4
|
||||
return score
|
||||
|
||||
|
||||
@@ -3812,6 +3812,18 @@ class TestDriftScore(unittest.TestCase):
|
||||
report = ProfileReport(name="a", entries=[], counts={"ANCHORED": 5})
|
||||
self.assertEqual(drift_score(report, None, 0), 0)
|
||||
|
||||
def test_a_pin_to_set_again_outranks_a_gone_ref(self):
|
||||
"""pcem ranked last at 0 with "1 to review, 1 orphaned pin": its
|
||||
upstream_commit had left every branch of a force-pushed repository."""
|
||||
gone = ProfileReport(name="a", entries=[], counts={"GONE": 1})
|
||||
orphaned = ProfileReport(name="pcem", entries=[], counts={},
|
||||
orphaned=["upstream_commit 25b54e3f"])
|
||||
moved = ProfileReport(name="m", entries=[], counts={},
|
||||
moved_repos=["a/b answers as c/b"])
|
||||
for report in (orphaned, moved):
|
||||
with self.subTest(name=report.name):
|
||||
self.assertGreater(drift_score(report, None, 0), drift_score(gone, None, 0))
|
||||
|
||||
|
||||
class TestCollectCitations(unittest.TestCase):
|
||||
def test_files_refs_in_document_order(self):
|
||||
|
||||
Reference in new issue
Block a user