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(',')
if any((first, last, prefix)):
archive_infos = self.manifest.archives.list(sort_by=sort_by, prefix=prefix, first=first, last=last)
if not archive_infos:
logger.warning('--first/--last/--prefix did not match any archives')
if prefix and not archive_infos:
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:
archive_infos = self.manifest.archives.list(sort_by=sort_by)
else:

View File

@ -11,9 +11,6 @@ from itertools import islice
import msgpack
import logging
logger = logging.getLogger(__name__)
from .constants import * # NOQA
from .hashindex import NSIndex
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 .crc32 import crc32
logger = create_logger(__name__)
MAX_OBJECT_SIZE = 20 * 1024 * 1024
MAGIC = b'BORG_SEG'
MAGIC_LEN = len(MAGIC)

View File

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

View File

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