mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-23 13:54:59 +00:00
handle filenames above the triple quotes
This commit is contained in:
parent
9ef50d8f3d
commit
d45b7ae752
2 changed files with 23 additions and 2 deletions
|
@ -174,9 +174,11 @@ def find_original_update_blocks(content):
|
|||
|
||||
processed.append(cur) # original_marker
|
||||
|
||||
filename = processed[-2].splitlines()[-1]
|
||||
filename = processed[-2].splitlines()[-1].strip()
|
||||
if not len(filename) or "`" in filename:
|
||||
raise ValueError(f"Bad/missing filename: {filename}")
|
||||
filename = processed[-2].splitlines()[-2].strip()
|
||||
if not len(filename) or "`" in filename:
|
||||
raise ValueError(f"Bad/missing filename. It should go right above {ORIGINAL}")
|
||||
|
||||
original_text = pieces.pop()
|
||||
processed.append(original_text)
|
||||
|
|
|
@ -54,6 +54,25 @@ Tooooo
|
|||
>>>>>>> UPDATED
|
||||
```
|
||||
|
||||
Hope you like it!
|
||||
"""
|
||||
|
||||
edits = list(utils.find_original_update_blocks(edit))
|
||||
self.assertEqual(edits, [("foo.txt", "Two\n", "Tooooo\n")])
|
||||
|
||||
def test_find_original_update_blocks_quote_below_filename(self):
|
||||
edit = """
|
||||
Here's the change:
|
||||
|
||||
foo.txt
|
||||
```text
|
||||
<<<<<<< ORIGINAL
|
||||
Two
|
||||
=======
|
||||
Tooooo
|
||||
>>>>>>> UPDATED
|
||||
```
|
||||
|
||||
Hope you like it!
|
||||
"""
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue