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

Add an option to keep/backup old files after overwrite/update #69

Open
Mr-Pine opened this issue Nov 20, 2022 · 2 comments
Open

Add an option to keep/backup old files after overwrite/update #69

Mr-Pine opened this issue Nov 20, 2022 · 2 comments

Comments

@Mr-Pine
Copy link
Contributor

Mr-Pine commented Nov 20, 2022

Feature

I would like an option to keep the old version of a file when the file is overwritten due to a change of the remote.

Reason

If you depend on a specific version of a file and update the file unknowingly (either using on_conflict: no-delete or not knowing the new version will break things) there is currently no possibility to retrieve the old version.

Alternatives

Adding a on_conflict option similar to no-delete that promts you when overwriting files would solve the issue that files might be updated unintentionally. This would let the user do manually what this feature would do for them.

How it could work

There would be a new crawler option called keep_backups
When it would be enabled and there is an incoming change from the remote, pferd would rename the local file to <filename>.pferdbackup.<extension> (keeping the original extension for Windows support) before saving the new version. I think one backed up version (so if a third option appears on the remote the backup file would contain the second version) would be enough since the user could check whether they need the old version when the change appears in the report.

Further ideas

  • (Optionally) keeping all (or a user set number of) versions of updated files in a separate folder (not the pferd output directory)
  • ...
@Garmelon
Copy link
Owner

Adding a on_conflict option similar to no-delete that promts you when overwriting files would solve the issue that files might be updated unintentionally. This would let the user do manually what this feature would do for them.

Isn't that what on_conflict = prompt does (the default value for on_conflict)?

I have my crawlers set to on_conflict = prompt. If I'm interested in what the change was, I diff the old version of a file (e. g. foo/bar.baz against the new version (e. g. foo/.bar/baz.tmp.wsho3k) before answering the prompt. To keep the old version, just copy it somewhere else before answering the prompt.

@I-Al-Istannen
Copy link
Collaborator

I-Al-Istannen commented Nov 20, 2022

Prompt also prompts for deletions which can be a bit annoying if you have many files not present in ILIAS (see e.g. #65). This might happen when you unzip files or start to solve exercises in a synchronized folder from what I gathered.

EDIT: And you have to read carefully whether it prompts for deletion or overwriting

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

No branches or pull requests

3 participants