fix: include excludes list in exported settings (fixes #2414)#2418
fix: include excludes list in exported settings (fixes #2414)#2418xovishnukosuri wants to merge 3 commits intoborgbase:masterfrom
Conversation
m3nu
left a comment
There was a problem hiding this comment.
Good fix for #2414. The approach is clean and consistent with how SourceFileModel is already handled in the export/import flow. The del → pop(..., None) change also fixes a latent KeyError when importing with overwrite_settings=False from an export made with include_settings=False.
A few minor suggestions:
1. Backward compatibility when overwriting profiles
When importing an old export file (no ExclusionModel key) with overwrite_profile=True, existing exclusions on the target profile are silently preserved. This differs from SourceFileModel which always clears and replaces. Consider always clearing exclusions so that an overwrite is a full replacement:
ExclusionModel.delete().where(ExclusionModel.profile == self.id).execute()
if exclusions:
for exclusion in exclusions:
exclusion['profile'] = self.id
ExclusionModel.insert_many(exclusions).execute()2. Test could verify all round-tripped fields
The test only checks name. Asserting enabled and source too would give fuller confidence:
assert {(e.name, e.enabled, e.source) for e in imported_exclusions} == {
('*.tmp', True, 'custom'),
('Caches', True, 'preset'),
}3. Nit: comment wording
# Restore source dirs replaces the old two-line comment that also mentioned deleting existing sources to avoid duplicates. The new comment is a bit less descriptive about the delete step.
|
Thanks for the careful review. I’ve pushed updates: exclusions are now always cleared on overwrite for consistent behavior, the test asserts name+enabled+source, and I clarified the source-dir comment. Let me know if you want any tweaks. |
|
Pushed a small lint-friendly tweak: split the exclusion assertion into a named set variable. This should address the lint failure. |
This PR fixes #2414 where the excludes list was not included when exporting profile settings.
Changes in src/vorta/profile_export.py:
Added test in tests/unit/test_import_export.py:
Fixes #2414