From b120e5f11965b4c69d6f52bb03b66c2e7f3dde8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= Date: Thu, 15 Oct 2015 21:16:31 -0400 Subject: [PATCH] output more progress information without this, there would be a solid 20 seconds here without any sort of output on the console, regardless of the verbosity level. this makes nice incremental messages telling the user that borg is not stalled (or waiting for a lock, for that matter) the "processing files" message is a little clunky, as we somewhat abuse the cache to figure out if we are just starting... but it helps if there are problems reading the actual files: it tells us the initialization is basically complete and we're going ahead with the reading of all the files. --- borg/archive.py | 3 +++ borg/cache.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/borg/archive.py b/borg/archive.py index 2829769f2..ba06850c5 100644 --- a/borg/archive.py +++ b/borg/archive.py @@ -503,7 +503,10 @@ Number of files: {0.stats.nfiles} else: self.hard_links[st.st_ino, st.st_dev] = safe_path path_hash = self.key.id_hash(os.path.join(self.cwd, path).encode('utf-8', 'surrogateescape')) + first_run = not cache.files ids = cache.file_known_and_unchanged(path_hash, st) + if first_run: + logger.info('processing files') chunks = None if ids is not None: # Make sure all ids are available diff --git a/borg/cache.py b/borg/cache.py index e793f0f5d..3fab7cef2 100644 --- a/borg/cache.py +++ b/borg/cache.py @@ -48,6 +48,7 @@ class Cache: self.manifest = manifest self.path = path or os.path.join(get_cache_dir(), hexlify(repository.id).decode('ascii')) self.do_files = do_files + logger.info('initializing cache') # Warn user before sending data to a never seen before unencrypted repository if not os.path.exists(self.path): if warn_if_unencrypted and isinstance(key, PlaintextKey): @@ -69,6 +70,7 @@ class Cache: # Make sure an encrypted repository has not been swapped for an unencrypted repository if self.key_type is not None and self.key_type != str(key.TYPE): raise self.EncryptionMethodMismatch() + logger.info('synchronizing cache') self.sync() self.commit() @@ -163,6 +165,7 @@ Chunk index: {0.total_unique_chunks:20d} {0.total_chunks:20d}""") def _read_files(self): self.files = {} self._newest_mtime = 0 + logger.info('reading files cache') with open(os.path.join(self.path, 'files'), 'rb') as fd: u = msgpack.Unpacker(use_list=True) while True: