Skip to content

fix: include excludes list in exported settings (fixes #2414)#2418

Open
xovishnukosuri wants to merge 3 commits intoborgbase:masterfrom
xovishnukosuri:fix/export-excludes-list
Open

fix: include excludes list in exported settings (fixes #2414)#2418
xovishnukosuri wants to merge 3 commits intoborgbase:masterfrom
xovishnukosuri:fix/export-excludes-list

Conversation

@xovishnukosuri
Copy link

This PR fixes #2414 where the excludes list was not included when exporting profile settings.

Changes in src/vorta/profile_export.py:

  • Export now includes ExclusionModel rows in the profile dict
  • Import now restores exclusions after saving the profile
  • Existing exclusions are cleared before import to avoid duplicates
  • Made dict cleanup resilient via pop(..., None)

Added test in tests/unit/test_import_export.py:

  • test_export_import_includes_exclusion_list verifies round-trip

Fixes #2414

m3nu
m3nu previously approved these changes Mar 5, 2026
Copy link
Contributor

@m3nu m3nu left a comment

Choose a reason for hiding this comment

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

Good fix for #2414. The approach is clean and consistent with how SourceFileModel is already handled in the export/import flow. The delpop(..., 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.

@xovishnukosuri
Copy link
Author

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.

@xovishnukosuri
Copy link
Author

Pushed a small lint-friendly tweak: split the exclusion assertion into a named set variable. This should address the lint failure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

excludes list is not added to the exported settings

2 participants