updated coder test

This commit is contained in:
Paul Gauthier 2024-07-18 16:35:27 +01:00
parent 6fdb4f8214
commit c99c5db35c
3 changed files with 22 additions and 23 deletions

View file

@ -668,9 +668,7 @@ class Coder:
return inp
def check_for_urls(self, inp):
url_pattern = re.compile(
r"(https?://[^\s/$.?#].[^\s]*[^\s,.])"
)
url_pattern = re.compile(r"(https?://[^\s/$.?#].[^\s]*[^\s,.])")
urls = url_pattern.findall(inp)
for url in urls:
if self.io.confirm_ask(f"Add {url} to the chat?"):
@ -1062,8 +1060,8 @@ class Coder:
mentioned_rel_fnames = set()
fname_to_rel_fnames = {}
for rel_fname in addable_rel_fnames:
normalized_rel_fname = rel_fname.replace('\\', '/')
normalized_words = set(word.replace('\\', '/') for word in words)
normalized_rel_fname = rel_fname.replace("\\", "/")
normalized_words = set(word.replace("\\", "/") for word in words)
if normalized_rel_fname in normalized_words:
mentioned_rel_fnames.add(rel_fname)
@ -1297,9 +1295,10 @@ class Coder:
if not self.repo.is_dirty(path):
return
fullp = Path(self.abs_root_path(path))
if not fullp.stat().st_size:
return
# We need a committed copy of the file in order to /undo, so skip this
# fullp = Path(self.abs_root_path(path))
# if not fullp.stat().st_size:
# return
self.io.tool_output(f"Committing {path} before applying edits.")
self.need_commit_before_edits.add(path)