-
Notifications
You must be signed in to change notification settings - Fork 937
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
Feature mode copy and code refactoring #1117
base: master
Are you sure you want to change the base?
Conversation
To be clear, I haven't looked at the code yet, as it's a bit much for right now, but some points missing from the overview: So, just for clarity, what does Second, how does it handle filename conflicts? Say there's an older copy in the backup folder already |
The copy mode replaces the current linking mode. This is enabled by adding the following in
The commands remain the same, with exception the
Copy operations are implemented with distutils.dir_util.copy_tree(src, dst, update=1):
At the moment there is no detection on if the user changed configuration from My time is limited but I will do my best to reply on this thread. I tend to have more time in weekends for coding/fixing. Let me know if you require more information. |
Thanks for the quick reply. Seeing how intensive this PR is I think I'll leave the decision to @lra but good work nonetheless |
As mentioned in #859 how is this better than directly using rsync? |
Hey @xkef, although I don't see this PR ever merging, your sh implementation would also do as minimal implementation. However, you would need to extend with the restore (and maybe
|
ty @urban-1 for your insights. I guess the only value (except for the nicely written python code) in this repo is the applications db. However, it still is not handling my standard configs of vscode insider versions or non-std dotfiles paths well - it is very opinionated in this respect. I don't even want to mention handling complex zsh/vim configs with deep symbolic / hardlinks... I will stick with my ansible orchestration combined with rsync and git for synchronization. |
Hi @lra / all,
This is an attempt to introduce
copy
mode in Mackup. However, while going through the code I could not resist restructuring things a bit... So I will explain this PR in two main sub-sections:Code Refactoring
The changes are mainly focused on defining clear interfaces between components and thus code has been moved around but not changed a lot. The most notable changes are:
Mackup
class which serves as an entry point to mackup api and acts as a controller for individual commands.Mackup
now holds:ApplicationsDatabase
is now loadingApplicationProfile
instances instead ofdict
s. Helper methods have been removed and replaced by__getitem__
implementation which allows[<appname>]
. This way theMackup
instance (and previously themain.py
) does not need to loop over the DB and create profiles, it just loops and applies the operation requested.ApplicationProfile
is mostly the same. One difference is that instead of passing individual config or runtime values (likedry_run
) down to its methods, we now use theMackup
instance (which contains all of those). Although a minor modification, allows for more attributes to be added intoMackup
(and thus the cmd line args or global config) without modifying theApplicationProfile
method signatures...I wanna believe that most of the refactoring makes senses and makes the code easier to extend and maintain.
Copy Mode
The implementation of the copy mode is a global one as opposed to a per-INI/app. This simplifies the code, keeps config-file changes to minimum and avoids few issues that need resolving. These include:
ApplicationProfile
, especially given that a user might change configuration of an already backed up app! The implementation of this tho with the new code is pretty straight forward (ApplicationProfile.backup can override mode)Due to the above I believe that a global configuration option is a fast win and the safest way to go. We will need to think of the reconfiguration problem and how we detect it (Mackup metadata file in storage, including version, mode, etc?)
Merging
I understand that such code changes are risky, especially given the nature of this app. If you review the code and decide that we should proceed with a merge, I would suggest that a new branch is created on the upstream repo (lets say
rc-0.9.0
):feature_copy_mode
torc-0.9.0
0.8.x
0.8.x
will only receive bug fixes (if any)rc-0.9.0
rc-0.9.0
rc-0.9.0
is deemed stable, we merge it tomaster
Some conflicts are to be expected on any code changes in
0.8.x
but these shouldn't be too many.Notes:
mackup show git
feature is included. This breaks atm the clean API and needs to be defined better and moved intoMackup
class...Let me know what you think and if we should proceed with merging.
Cheers,
Andreas