summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2014-03-05 22:26:32 +0000
committerLars Wirzenius <liw@liw.fi>2014-03-05 22:26:32 +0000
commitd73553e70ba8a0708cbfebd878633072129c6d15 (patch)
tree281706654847d59078902fed1541e7359a4f737f
parente5a5ca123457430e83d8172e73d97fde1c0d5c8d (diff)
downloadobnam-d73553e70ba8a0708cbfebd878633072129c6d15.tar.gz
Show verify progress based on file size as well
-rw-r--r--NEWS3
-rw-r--r--obnamlib/plugins/verify_plugin.py9
2 files changed, 11 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 67a2b560..60bf34f9 100644
--- a/NEWS
+++ b/NEWS
@@ -48,6 +48,9 @@ Version 1.7, released UNRELEASED
data: filenames, permission bits, extended attributes, etc, plus
Obnam internal bookkeeping.
+* `obnam verify` now shows progress both based on number of files and
+ amount of data.
+
Bug fixes:
* Obnam now creates a `trustdb.gpg` in the temporary GNUPGHOME it uses
diff --git a/obnamlib/plugins/verify_plugin.py b/obnamlib/plugins/verify_plugin.py
index 5eedabc2..096aee68 100644
--- a/obnamlib/plugins/verify_plugin.py
+++ b/obnamlib/plugins/verify_plugin.py
@@ -79,12 +79,15 @@ class VerifyPlugin(obnamlib.ObnamPlugin):
self.app.ts['done'] = 0
self.app.ts['total'] = 0
+ self.app.ts['done_bytes'] = 0
+ self.app.ts['total_bytes'] = 0
self.app.ts['filename'] = ''
if not self.app.settings['quiet']:
self.app.ts.format(
'%ElapsedTime() '
'verifying file %Counter(filename)/%Integer(total) '
- '%PercentDone(done,total): '
+ '%ByteSize(done_bytes)/%ByteSize(total_bytes) '
+ '%PercentDone(done_bytes,total_bytes): '
'%Pathname(filename)')
num_randomly = self.app.settings['verify-randomly']
@@ -92,6 +95,9 @@ class VerifyPlugin(obnamlib.ObnamPlugin):
self.app.ts['total'] = \
self.repo.get_generation_key(
gen_id, obnamlib.REPO_GENERATION_FILE_COUNT)
+ self.app.ts['total_bytes'] = \
+ self.repo.get_generation_key(
+ gen_id, obnamlib.REPO_GENERATION_TOTAL_DATA)
for filename in self.walk(gen_id, args):
self.app.ts['filename'] = filename
try:
@@ -197,6 +203,7 @@ class VerifyPlugin(obnamlib.ObnamPlugin):
for chunkid in chunkids:
backed_up = self.repo.get_chunk_content(chunkid)
live_data = f.read(len(backed_up))
+ self.app.ts['done_bytes'] += len(backed_up)
if backed_up != live_data:
return False
return True