MCPcopy
hub / github.com/borgbackup/borg / list

Method list

src/borg/manifest.py:353–402  ·  view source on GitHub ↗

Return list of ArchiveInfo instances according to the parameters. First match *match* (considering *match_end*), then filter by timestamp considering *older* and *newer*. Second, follow with a filter considering *oldest* and *newest*, then sort by the given *sort_by* argume

(
        self,
        *,
        match=None,
        match_end=r"\Z",
        sort_by=(),
        reverse=False,
        first=None,
        last=None,
        older=None,
        newer=None,
        oldest=None,
        newest=None,
        deleted=False,
    )

Source from the content-addressed store, hash-verified

351 self.repository.store_delete(f"archives/{bin_to_hex(id)}", deleted=True)
352
353 def list(
354 self,
355 *,
356 match=None,
357 match_end=r"\Z",
358 sort_by=(),
359 reverse=False,
360 first=None,
361 last=None,
362 older=None,
363 newer=None,
364 oldest=None,
365 newest=None,
366 deleted=False,
367 ):
368 """
369 Return list of ArchiveInfo instances according to the parameters.
370
371 First match *match* (considering *match_end*), then filter by timestamp considering *older* and *newer*.
372 Second, follow with a filter considering *oldest* and *newest*, then sort by the given *sort_by* argument.
373
374 Apply *first* and *last* filters, and then possibly *reverse* the list.
375
376 *sort_by* is a list of sort keys applied in reverse order.
377 *newer* and *older* are relative time markers that indicate offset from now.
378 *newest* and *oldest* are relative time markers that indicate offset from newest/oldest archive's timestamp.
379
380
381 Note: for better robustness, all filtering / limiting parameters must default to
382 "not limit / not filter", so a FULL archive list is produced by a simple .list().
383 some callers EXPECT to iterate over all archives in a repo for correct operation.
384 """
385 if isinstance(sort_by, (str, bytes)):
386 raise TypeError("sort_by must be a sequence of str")
387
388 archive_infos = self._matching_info_tuples(match, match_end, deleted=deleted)
389
390 if any([oldest, newest, older, newer]):
391 archive_infos = filter_archives_by_date(
392 archive_infos, oldest=oldest, newest=newest, newer=newer, older=older
393 )
394 for sortkey in reversed(sort_by):
395 archive_infos.sort(key=attrgetter(sortkey))
396 if first:
397 archive_infos = archive_infos[:first]
398 elif last:
399 archive_infos = archive_infos[max(len(archive_infos) - last, 0) :]
400 if reverse:
401 archive_infos.reverse()
402 return archive_infos
403
404 def list_considering(self, args):
405 """

Callers 15

list_consideringMethod · 0.95
_build_files_cacheMethod · 0.45
_get_locksMethod · 0.45
rebuild_archivesMethod · 0.45
analyze_archivesMethod · 0.45
report_and_deleteMethod · 0.45
do_repo_deleteMethod · 0.45
do_pruneMethod · 0.45
test_listFunction · 0.45

Calls 2

_matching_info_tuplesMethod · 0.95
filter_archives_by_dateFunction · 0.85

Tested by 5

test_listFunction · 0.36
list_objectsFunction · 0.36
test_listFunction · 0.36
test_empty_repositoryFunction · 0.36