refactor: treat a located value as a recalable move

This commit is contained in:
Abdessamad Derraz committed 2026-08-10 17:20:26 +02:00
1 parent 11677d6625
commit f430986361
2 files changed
+6 -4

No files matched your search

+4 -2
View File
@@ -725,9 +725,11 @@ def verify_at_pin(part: RefPart, pin_lines, tokens) -> PartResult:
part, "AMBIGUOUS", None, None, None, elsewhere,
"declared value carried by several lines",
)
# Content-level evidence, stronger than a line-shift heuristic: the value
# sits on exactly one line, so the recale target is not a guess.
return PartResult(
part, "CHANGED", None, elsewhere[0], elsewhere[0], elsewhere,
"declared value carried by another line",
part, "MOVED", None, elsewhere[0], elsewhere[0], elsewhere,
"declared value occurs once at the pinned revision",
)
+2 -2
View File
@@ -338,7 +338,7 @@ class TestVerifyAtPin(unittest.TestCase):
lines = ["load()", "", "", "", "", "", 'rom("cafebabe")']
part = RefPart("a.c", 1, 1, "a.c:1")
result = profile_sync.verify_at_pin(part, lines, ["cafebabe"])
self.assertEqual(result.status, "CHANGED")
self.assertEqual(result.status, "MOVED")
self.assertEqual(result.start, 7)
def test_declared_value_on_several_lines_is_ambiguous(self):
@@ -1016,7 +1016,7 @@ class TestBuildReport(unittest.TestCase):
profile["source_commit"] = "headsha"
profile["files"][0]["crc32"] = "deadbeef"
report = build_report("test", profile, self.dir)
self.assertEqual(report.entries[0].status, "CHANGED")
self.assertEqual(report.entries[0].status, "MOVED")
def test_a_value_absent_from_the_whole_file_is_not_held_against_the_ref(self):
# A ref citing loading logic never spells the value out; its absence