mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-23 09:03:22 -05:00
fix(tools): place resolved debt entries after their predecessor in the same file
debt_split resolve anchored an added entry to the previous entry of the whole index. When that entry was in another section or another library's file, the new entry was appended to the end of its section instead of being placed before the entry it precedes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b106f6f8c0
commit
104f54da7f
2 files changed
+11
-1
No files matched your search
+1
-1
@@ -197,7 +197,7 @@ def apply_change(root, base, new, index_text):
|
||||
for offset, fresh in enumerate(added):
|
||||
if offset in kept_new:
|
||||
continue
|
||||
anchor = after[j1 + offset - 1] if j1 + offset > 0 else None
|
||||
anchor = next((entry for entry in reversed(after[:j1 + offset]) if entry[1] == fresh[1] and entry[3] == fresh[3]), None)
|
||||
insert(fresh, anchor)
|
||||
for name, sections in files.items():
|
||||
write_debt(root, name, sections, order)
|
||||
|
||||
@@ -198,6 +198,16 @@ class DebtSplitTests(unittest.TestCase):
|
||||
"\n\n### Functional\n\n" + A_FUNCTIONAL.replace("../../", "../../../") + "\n")
|
||||
self.assertEqual(self.read(INDEX), self.git("show", "main:" + INDEX).stdout)
|
||||
|
||||
def test_resolve_places_an_entry_inserted_at_the_top_of_a_later_section(self):
|
||||
added = "- [libSceA](../../core/libs/prx/libSceA/Added.cpp) - `sceAAdded` returns 0"
|
||||
result = self.rebase([A_STUB, B_STUB, C_STUB], [added, A_FUNCTIONAL, SHADER, SHARED])
|
||||
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
|
||||
self.git("rebase", "--continue")
|
||||
self.assertEqual(self.read("docs/dev/debt/libSceA.md"),
|
||||
"# libSceA technical debt\n\n### Silent stubs\n\n" + A_STUB.replace("../../", "../../../") +
|
||||
"\n\n### Functional\n\n" +
|
||||
"\n".join(entry.replace("../../", "../../../") for entry in (added, A_FUNCTIONAL)) + "\n")
|
||||
|
||||
def test_indented_continuation_after_a_blank_line_moves_with_its_entry(self):
|
||||
note = " - sub note about sceAOne"
|
||||
self.write(INDEX, "# Project technical debt\n\n### Silent stubs\n\n" + A_STUB + "\n\n" + note + "\n")
|
||||
|
||||
Reference in new issue
Block a user