-
Notifications
You must be signed in to change notification settings - Fork 126
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
Added new 'sync' action for easy local <-> remote copying #20
Conversation
Sorry for the delay getting back to you. I've been enjoying the holidays and haven't been on the computer much. I think this would be a useful addition to the program. Using last-modified timestamps would be good. The recommended way of doing that is documented in the b2_upload_file API. |
FWIW, I am wondering if this should be part of the, or rather a program which uses the b2 python library. This functionality can almost be used as a backup application, which was not the original intent of this repository (if I understood the intent correctly). Don't get me wrong - I think the idea of creating something like this is marvelous, but new features for the backup application part can easily overtake the rest of the b2 command line tool. To name a few features:
Also, as progress bars are supported now, progress bar of the sync operation should also be supported. Therefore I gently suggest to consider putting this functionality in a separate tool (b2sync?), which would use the current b2 tool or the library interface from #11. |
@ppolewicz: A
Also, don't mixup sync with backup. Being used by a backup implementation isn't the same as being one. This is similar to |
Ok, that's a good point. Are you willing to do some more work on the implementation of the |
…ctions. Also added support for setting last modified timestamp on upload.
I've improved upon a few things (see updated PR comment at the top). Tried to avoid modifying existing functions as much as possible, in order to keep the patch reasonable in size. In the future, the command-line option parsing and the API calls shoud probably share more code with other functions. In particular, the |
Long-running branches (with massive refactorings) always cause conflicts. That's exactly why they should be avoided. In particular for collaborative projects. If you don't intend to block all other activity on this project, #11 must be split into multiple small patches. Ones that can be inspected, understood and merged separately (in order of course). |
At the time it seemed like a good idea: when #11 was started, there was almost no other activity in this project. |
I'm going to try resolving the merge conflicts, now that #11 is merged in. In the future, smaller, more incremental changes would be better. |
@cederberg now that #11 is merged, I tried merging your changes. They apply with just minor problems. The When trying to fix it, I noticed something and I am wondering if you'd agree with me, that I also have another question - do you want my help in resolving the interface changes or do you prefer to do it yourself? |
I have it just about working. There will be a few TODO items in comments, but it's working. |
Merge is done. Let me know if you see any problems. |
Not the very cleanest of implementations. A few rough corners:
Doesn't preserve last modified timestamps.FIXEDRe-uses other actions as helpers, which is non-optimal...FIXEDOutput is not understandable (each action outputs differently)FIXED--delete
option doesn't work if multiple B2 file versions exists.The comparison should reuse the SHA-1 calculated during the upload, but it doesn't seem to be available via the API.
Most other issues above seem easy enough to address with a few refactorings here and there. But I won't embark on that unless this PR seems interesting to you.