Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions mergin/local_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class FileChange:
history: Optional[dict] = None
# some functions (MerginProject.compare_file_sets) are adding location dict to the change from project info
location: Optional[str] = None
# list of diff filenames associated with this change
diffs: Optional[List[str]] = None
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new diffs field defaults to None, but its doc comment describes it as a list of diff filenames. To avoid forcing callers to guard against None (and to align with how chunks is modeled), consider using field(default_factory=list) and a non-optional List[str] (or normalize None to [] in __post_init__).

Suggested change
diffs: Optional[List[str]] = None
diffs: List[str] = field(default_factory=list)

Copilot uses AI. Check for mistakes.

def get_diff(self) -> Optional[FileDiffChange]:
if self.diff:
Expand Down
1 change: 1 addition & 0 deletions mergin/test/test_local_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def test_local_changes_from_dict():
"path": "base.gpkg",
"size": 98304,
"version": "v1",
"diffs": ["diff"],
}
Comment on lines +31 to 32
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test adds the diffs key to the input dict, but it never asserts that FileChange actually stores it. Adding an assertion like local_changes.removed[0].diffs == ["diff"] would ensure the new field is covered (and avoid the test passing if the key is silently dropped elsewhere).

Copilot uses AI. Check for mistakes.
],
}
Expand Down
Loading