check: pick better insufficent archives matched warning from TW's merge

This commit is contained in:
Marian Beermann 2017-01-12 17:03:51 +01:00
parent 1d40675ce4
commit 7923088ff9
4 changed files with 13 additions and 10 deletions

View File

@ -1360,8 +1360,12 @@ class ArchiveChecker:
sort_by = sort_by.split(',') sort_by = sort_by.split(',')
if any((first, last, prefix)): if any((first, last, prefix)):
archive_infos = self.manifest.archives.list(sort_by=sort_by, prefix=prefix, first=first, last=last) archive_infos = self.manifest.archives.list(sort_by=sort_by, prefix=prefix, first=first, last=last)
if not archive_infos: if prefix and not archive_infos:
logger.warning('--first/--last/--prefix did not match any archives') logger.warning('--prefix %s does not match any archives', prefix)
if first and len(archive_infos) < first:
logger.warning('--first %d archives: only found %d archives', first, len(archive_infos))
if last and len(archive_infos) < last:
logger.warning('--last %d archives: only found %d archives', last, len(archive_infos))
else: else:
archive_infos = self.manifest.archives.list(sort_by=sort_by) archive_infos = self.manifest.archives.list(sort_by=sort_by)
else: else:

View File

@ -11,9 +11,6 @@ from itertools import islice
import msgpack import msgpack
import logging
logger = logging.getLogger(__name__)
from .constants import * # NOQA from .constants import * # NOQA
from .hashindex import NSIndex from .hashindex import NSIndex
from .helpers import Error, ErrorWithTraceback, IntegrityError, format_file_size, parse_file_size from .helpers import Error, ErrorWithTraceback, IntegrityError, format_file_size, parse_file_size
@ -27,6 +24,8 @@ from .lrucache import LRUCache
from .platform import SaveFile, SyncFile, sync_dir from .platform import SaveFile, SyncFile, sync_dir
from .crc32 import crc32 from .crc32 import crc32
logger = create_logger(__name__)
MAX_OBJECT_SIZE = 20 * 1024 * 1024 MAX_OBJECT_SIZE = 20 * 1024 * 1024
MAGIC = b'BORG_SEG' MAGIC = b'BORG_SEG'
MAGIC_LEN = len(MAGIC) MAGIC_LEN = len(MAGIC)

View File

@ -31,8 +31,8 @@ def test_stats_basic(stats):
assert stats.usize == 10 assert stats.usize == 10
def tests_stats_progress(stats, columns=80): def tests_stats_progress(stats, monkeypatch, columns=80):
os.environ['COLUMNS'] = str(columns) monkeypatch.setenv('COLUMNS', str(columns))
out = StringIO() out = StringIO()
stats.show_progress(stream=out) stats.show_progress(stream=out)
s = '20 B O 10 B C 10 B D 0 N ' s = '20 B O 10 B C 10 B D 0 N '

View File

@ -3,15 +3,15 @@ import os
import shutil import shutil
import time import time
import logging
logger = logging.getLogger(__name__)
from .constants import REPOSITORY_README from .constants import REPOSITORY_README
from .helpers import get_home_dir, get_keys_dir, get_cache_dir from .helpers import get_home_dir, get_keys_dir, get_cache_dir
from .helpers import ProgressIndicatorPercent from .helpers import ProgressIndicatorPercent
from .key import KeyfileKey, KeyfileNotFoundError from .key import KeyfileKey, KeyfileNotFoundError
from .locking import Lock from .locking import Lock
from .repository import Repository, MAGIC from .repository import Repository, MAGIC
from .logger import create_logger
logger = create_logger(__name__)
ATTIC_MAGIC = b'ATTICSEG' ATTIC_MAGIC = b'ATTICSEG'