Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli/discover: remove local collections if the remote collection is deleted #868

Closed

Conversation

dilyanpalauzov
Copy link
Contributor

This works when the destination backend is 'filesystem' and the source is CalDAV-calendar-home-set.

…leted

This works when the destination backend is 'filesystem' and the source is
CalDAV-calendar-home-set.
@lgtm-com
Copy link

lgtm-com bot commented Feb 28, 2021

This pull request introduces 1 alert when merging fc49ba8 into a42906b - view on LGTM.com

new alerts:

  • 1 for Except block handles 'BaseException'

@WhyNotHugo
Copy link
Member

I'm not a fan of doing this by default.

I've several times deleted a remote collection with the intent of pushing my local copy elsewhere. If my local copy were auto-deleted, I would have lost it permanently.

I'm sure there's other scenarios where it might lead to people inadvertently losing data. I don't want people finding out about this feature the hard way 😅

I'd be okay with this with any of these changes a dedicated flag to enable / disable the behaviour. For example, something like:

[pair calendars]
# ...
prune_collections = true

@dilyanpalauzov
Copy link
Contributor Author

I am utterly fine in anyway this is implemented. I provided my way of doing it. I have also

diff --git a/vdirsyncer/cli/utils.py b/vdirsyncer/cli/utils.py
--- a/vdirsyncer/cli/utils.py
+++ b/vdirsyncer/cli/utils.py
@@ -404,7 +404,7 @@ def handle_collection_not_found(config, collection, e=None):
                        .format(f'{e}\n' if e else '',
                                json.dumps(collection), storage_name))
 
-    if click.confirm('Should vdirsyncer attempt to create it?'):
+    if True or click.confirm('Should vdirsyncer attempt to create it?'):
         storage_type = config['type']
         cls, config = storage_class_from_config(config)
         config['collection'] = collection

to create automatically Calendars, once they are created on the server. I want to have a system that periodically syncs and gets the state on the server (incl. creating new calendars and deleting old ones). For implicit calendar creation, the name prune_collection is not good, if both options will get the same name.

@dilyanpalauzov
Copy link
Contributor Author

Moved to #869.

dilyanpalauzov added a commit to dilyanpalauzov/vdirsyncer that referenced this pull request Mar 7, 2021
…leted

This works when the destination backend is 'filesystem' and the source is
CalDAV-calendar-home-set.

pimutils#868
dilyanpalauzov added a commit to dilyanpalauzov/vdirsyncer that referenced this pull request Mar 7, 2021
…s deleted/created

This works when the destination backend is 'filesystem'.

-- add a new parameter to storage section:
   implicit = ["create", "delete"]

pimutils#868

Changes cli/utils.py:save_status(): when data is None, remove the
underlaying file.
dilyanpalauzov added a commit to dilyanpalauzov/vdirsyncer that referenced this pull request Mar 8, 2021
…leted

This works when the destination backend is 'filesystem' and the source is
CalDAV-calendar-home-set.

pimutils#868
dilyanpalauzov added a commit to dilyanpalauzov/vdirsyncer that referenced this pull request Mar 11, 2021
…leted

This works when the destination backend is 'filesystem' and the source is
CalDAV-calendar-home-set.

pimutils#868
dilyanpalauzov added a commit to dilyanpalauzov/vdirsyncer that referenced this pull request Apr 7, 2021
…leted

This works when the destination backend is 'filesystem' and the source is
CalDAV-calendar-home-set.

pimutils#868
dilyanpalauzov added a commit to dilyanpalauzov/vdirsyncer that referenced this pull request Jul 23, 2021
…leted

This works when the destination backend is 'filesystem' and the source is
CalDAV-calendar-home-set.

pimutils#868
dilyanpalauzov added a commit to dilyanpalauzov/vdirsyncer that referenced this pull request Jul 26, 2021
…leted

This works when the destination backend is 'filesystem' and the source is
CalDAV-calendar-home-set.

pimutils#868
dilyanpalauzov added a commit to dilyanpalauzov/vdirsyncer that referenced this pull request Jul 26, 2021
…leted

This works when the destination backend is 'filesystem' and the source is
CalDAV-calendar-home-set.

pimutils#868
dilyanpalauzov added a commit to dilyanpalauzov/vdirsyncer that referenced this pull request Jul 26, 2021
…leted

This works when the destination backend is 'filesystem' and the source is
CalDAV-calendar-home-set.

pimutils#868
dilyanpalauzov added a commit to dilyanpalauzov/vdirsyncer that referenced this pull request Jul 27, 2021
…leted

This works when the destination backend is 'filesystem' and the source is
CalDAV-calendar-home-set.

pimutils#868
dilyanpalauzov added a commit to dilyanpalauzov/vdirsyncer that referenced this pull request Jan 15, 2022
…leted

This works when the destination backend is 'filesystem' and the source is
CalDAV-calendar-home-set.

pimutils#868
dilyanpalauzov added a commit to dilyanpalauzov/vdirsyncer that referenced this pull request Jun 17, 2023
…leted

This works when the destination backend is 'filesystem' and the source is
CalDAV-calendar-home-set.

pimutils#868
dilyanpalauzov added a commit to dilyanpalauzov/vdirsyncer that referenced this pull request Oct 1, 2023
…leted

This works when the destination backend is 'filesystem' and the source is
CalDAV-calendar-home-set.

pimutils#868
dilyanpalauzov added a commit to dilyanpalauzov/vdirsyncer that referenced this pull request Dec 2, 2023
…leted

This works when the destination backend is 'filesystem' and the source is
CalDAV-calendar-home-set.

pimutils#868
dilyanpalauzov added a commit to dilyanpalauzov/vdirsyncer that referenced this pull request Dec 23, 2023
…leted

This works when the destination backend is 'filesystem' and the source is
CalDAV-calendar-home-set.

pimutils#868
dilyanpalauzov added a commit to dilyanpalauzov/vdirsyncer that referenced this pull request Feb 24, 2024
…leted

This works when the destination backend is 'filesystem' and the source is
CalDAV-calendar-home-set.

pimutils#868
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.

2 participants