Archives filters - #1554
Conversation
|
strange, locally 42cd980 appears as second of these commits. |
Current coverage is 84.68% (diff: 84.74%)@@ master #1554 diff @@
==========================================
Files 20 20
Lines 6481 6548 +67
Methods 0 0
Messages 0 0
Branches 1093 1112 +19
==========================================
+ Hits 5493 5545 +52
- Misses 727 735 +8
- Partials 261 268 +7
|
| group.add_argument('--first', dest='first', metavar='N', default=0, type=int, | ||
| help='delete N first archives') | ||
| group.add_argument('--last', dest='last', metavar='N', default=0, type=int, | ||
| help='delete N last archives') |
There was a problem hiding this comment.
it always says "delete", no matter to where you add these filter args.
so, how about "consider N first/last archives".
please create a fixup commit just for this.
|
ai'ght, thanks for the feedback. i changed the commits where the solution was clear to me. |
| group.add_argument('--first', dest='first', metavar='N', default=0, type=int, | ||
| help='select first N archives') | ||
| group.add_argument('--last', dest='last', metavar='N', default=0, type=int, | ||
| help='delete last N archives') |
There was a problem hiding this comment.
you call this method from list, delete, check, ... right?
so the help texts are still wrong.
i suggested the wording "consider first/last N archives" in a previous review.
There was a problem hiding this comment.
oops. i made it a little more explicit now: consider last N archives after other filter args were applied. that okay?
|
okay, i did a fix commit concerning the remaining issues. to rebase it is kind of a pita. |
|
any idea how to review d61c778 ? |
|
maybe with two screens, reading both revisions side-by-side rather than with a diff view |
|
Sorry, I can't review d61c778 . It somehow looks better than the old code, but I can not see whether it still does the same thing and works correctly (except what is covered by the still succeeding unit tests). At the same time, this is critical code with the capability to either not repair your repo or make stuff even worse, if things go wrong. So, anybody else wants to review this? Or, remove it from this PR to get the rest adopted more quickly? In general, I would advise doing less complex/big changesets and especially hold back from refactoring / cleaning up and introducing new features within the same changeset (or even PR) - it just messes up the limited diff view on github and makes things hard to review. |
|
since you changed the ArchiveChecker and i was really not keen to rebase onto that, i removed the commit in question. concerning the review, i have no other idea than (more?!) tests and reading. |
|
Can you rebase this on current master? Thanks! |
|
|
||
| group = filters_group.add_mutually_exclusive_group() | ||
| group.add_argument('--first', dest='first', metavar='N', default=0, type=int, | ||
| help='consider first N archives after other filter args were applied') |
There was a problem hiding this comment.
nitpick: "after other filters were applied"
| group.add_argument('--first', dest='first', metavar='N', default=0, type=int, | ||
| help='consider first N archives after other filter args were applied') | ||
| group.add_argument('--last', dest='last', metavar='N', default=0, type=int, | ||
| help='consider last N archives after other filter args were applied') |
| def list(self, sort_by=None, reverse=False, prefix=''): | ||
| """ Inexpensive Archive.list_archives replacement if we just need .name, .id, .ts | ||
| Returns list of borg.helpers.ArchiveInfo instances | ||
| """ |
There was a problem hiding this comment.
docstring style:
"""
like
this
"""
or
"""like this"""
| if not archives: | ||
| logger.critical('There are no archives.') | ||
| self.exit_code = self.exit_code or EXIT_WARNING | ||
| return [] |
There was a problem hiding this comment.
please remove the complete if-block, it is rather harmful than doing anything good.
if archives is empty here, the rest of the code here will still work normally and return a empty list at the end, no special casing needed.
|
@funkyfuture if we can finish this quickly, it can go into 1.1.0b2 still, release is tomorrow. |
|
i'll try to get it done this night.
|
|
Cool, thanks. |
These are: --sort-by, --first and --last Includes a method to obtain a list of archive infos filtered by these Archives.list: - ensure reverse is always applied - always return a list
- adds prefix argument to helpers.Archives.list - also renames function PrefixSpec to prefix_spec
|
can you give me a hint what is suddenly causing this: |
|
Recompile the extensions ( |
|
i incorporated the demanded changes, but did not squash these as the effort and risk to break things are too high. |
|
./src/borg/testsuite/archiver.py:1830:5: E303 too many blank lines (2) |
|
lgtm modulo test results. |
|
got it. |
ThomasWaldmann
left a comment
There was a problem hiding this comment.
Thanks! Code definitely more clean now.
Please note that there are some followup tickets with bounties on the issue tracker.
follow-up of #1369
this adds the arguments
--first,--lastand--sort-by, and groups them with--prefixas archives filters that can be applied on repository targets.usable with
check,delete,infoandlist.use-case in a script: