-
Notifications
You must be signed in to change notification settings - Fork 137
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
Show backup size with excludes applied #961
Conversation
Nice take on a hard problem. 👍 If this works, just put the new, more accurate size. No need to add a new column (except for debugging). I just dont think we can add this new globmatch dependency. Only 6 stars, 3 files with a few lines each. Would be too risky and hard to package. And it’s not really needed: we mainly need shell patterns and maybe fn. See here for the full list: https://borgbackup.readthedocs.io/en/stable/usage/help.html#borg-help-patterns Shell patterns are translated into Python regex by Borg. We can borrow from there: https://github.com/borgbackup/borg/blob/c88a37eea430d7ec2e5da1ae503e43519ee90cb1/src/borg/shellpattern.py |
Their code is already very similar to the one in Borg. They both say to have copied it from Python’s fnmatch to a degree. https://github.com/vidartf/globmatch/blob/master/globmatch/translation.py#L91 |
(how) would it work if we simply copied https://github.com/borgbackup/borg/blob/master/src/borg/shellpattern.py into this repo? would we only have to add their license to the one respective file and that's it? or what if we |
We cant import it because Borg is only called via their CLI. It may be installed in a different Python env. Copying the file will work, since they copied it from fnmatch anyways. Or adjust and integrate the relevant function only. |
Why not to call Example: show all excluded files in
List of the included files could be parsed from the same logfile + |
Vorta doesn't interface with Borg via Python, but via the CLI. So we can't use private Borg functions and classes. This is because there are different ways to install Borg and it may not be in the same Python environment. |
Understood, but in that case same can be achieved via |
If |
borg create \
--list \
--dry-run \
--exclude='...' \
--exclude='...' \
/path/to/archive::DRYRUN \
/path/to/path \
2>&1 \
| perl -lne 'if (/- (.*)/) { print $1 }' \
| while read p ; do \
[ -f "$p" ] && echo "$p" ; \
done prints the paths of all files that are going to be included in the backup. unfortunately |
|
what do you guys think? |
Could be a good addition. Is it ready to merge? |
67bc6e2
to
fca5fc5
Compare
I rebased and cleaned up. should be good to go now. |
Good stuff. And timely to add while v0.8 is under heavy development. 2 thoughts:
|
it's probably a good idea to refactor in a separate PR, or not? |
True. Thanks for the other change. Will locally test and merge it tomorrow morning. |
Thanks for the valuable addition! Now merged. |
👍 |
since I want this feature and I believe it has been requested elsewhere already, I had a first stab at it, as a proof-of-concept.
I'm currently not sure if the
globmatch
package handles patterns the same wayborg
does.