|
|
|
|
@ -495,13 +495,13 @@ class StateManager:
|
|
|
|
|
modified_files.append(db_file.path)
|
|
|
|
|
|
|
|
|
|
return modified_files
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def get_modified_files_with_content(self) -> list[dict]:
|
|
|
|
|
"""
|
|
|
|
|
Return a list of new or modified files from the file system,
|
|
|
|
|
Return a list of new or modified files from the file system,
|
|
|
|
|
including their paths, old content, and new content.
|
|
|
|
|
|
|
|
|
|
:return: List of dictionaries containing paths, old content,
|
|
|
|
|
:return: List of dictionaries containing paths, old content,
|
|
|
|
|
and new content for new or modified files.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
@ -517,25 +517,29 @@ class StateManager:
|
|
|
|
|
|
|
|
|
|
if saved_file_content == content:
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
modified_files.append({
|
|
|
|
|
"path": path,
|
|
|
|
|
"file_old": saved_file_content, # Serialized content
|
|
|
|
|
"file_new": content
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
modified_files.append(
|
|
|
|
|
{
|
|
|
|
|
"path": path,
|
|
|
|
|
"file_old": saved_file_content, # Serialized content
|
|
|
|
|
"file_new": content,
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Handle files removed from disk
|
|
|
|
|
await self.current_state.awaitable_attrs.files
|
|
|
|
|
for db_file in self.current_state.files:
|
|
|
|
|
if db_file.path not in files_in_workspace:
|
|
|
|
|
modified_files.append({
|
|
|
|
|
"path": db_file.path,
|
|
|
|
|
"file_old": db_file.content.content, # Serialized content
|
|
|
|
|
"file_new": "" # Empty string as the file is removed
|
|
|
|
|
})
|
|
|
|
|
modified_files.append(
|
|
|
|
|
{
|
|
|
|
|
"path": db_file.path,
|
|
|
|
|
"file_old": db_file.content.content, # Serialized content
|
|
|
|
|
"file_new": "", # Empty string as the file is removed
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
return modified_files
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def workspace_is_empty(self) -> bool:
|
|
|
|
|
"""
|
|
|
|
|
Returns whether the workspace has any files in them or is empty.
|
|
|
|
|
|