]> arthur.barton.de Git - bup.git/commitdiff
bup split: print extra output to stderr if -v or -vv is given.
authorAvery Pennarun <apenwarr@gmail.com>
Sat, 2 Jan 2010 07:36:13 +0000 (02:36 -0500)
committerAvery Pennarun <apenwarr@gmail.com>
Sat, 2 Jan 2010 07:36:45 +0000 (02:36 -0500)
Makefile
cmd-split.py
hashsplit.py

index 5b4fd4dc617c6b8b71248e751d8baa0d16aa577f..c3fdc6eb919332b188bf42b8e373198ff67d0fbb 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,7 @@ runtests: all
 runtests-cmdline: all
        @echo "Testing \"$@\" in Makefile:"
        ./bup split --bench -b <testfile1 >tags1
-       ./bup split -b testfile2 >tags2
+       ./bup split -vvvv -b testfile2 >tags2
        diff -u tags1 tags2 || true
        wc -c testfile1 testfile2
        wc -l tags1 tags2
index 29bbae31d1969e1f459f372b5a2c1ca354d0a952..18f2e05b8a6d401381bc38782e1d0c12d7e6544a 100755 (executable)
@@ -10,6 +10,7 @@ b,blobs    output a series of blob ids
 t,tree     output a tree id
 c,commit   output a commit id
 n,name=    name of backup set to update (if any)
+v,verbose  increase log output (can be used more than once)
 bench      print benchmark timings to stderr
 """
 o = options.Options('bup split', optspec)
@@ -19,6 +20,8 @@ if not (opt.blobs or opt.tree or opt.commit or opt.name):
     log("bup split: use one or more of -b, -t, -c, -n\n")
     o.usage()
 
+hashsplit.split_verbosely = opt.verbose
+
 start_time = time.time()
 
 (shalist,tree) = hashsplit.split_to_tree(hashsplit.autofiles(extra))
index 80b54b1ffee342953217a8c815141720d8bcbae1..4565f3a7dbfe21b30e231396e97949e54d8e7f8d 100644 (file)
@@ -5,7 +5,7 @@ from helpers import *
 BLOB_LWM = 8192*2
 BLOB_MAX = BLOB_LWM*2
 BLOB_HWM = 1024*1024
-
+split_verbosely = 0
 
 class Buf:
     def __init__(self):
@@ -34,9 +34,12 @@ class Buf:
 
 
 def splitbuf(buf):
+    global split_verbosely
     b = buf.peek(buf.used())
     ofs = chashsplit.splitbuf(b)
     if ofs:
+        if split_verbosely >= 2:
+            log('.')
         buf.eat(ofs)
         return buffer(b, 0, ofs)
     return None
@@ -61,6 +64,7 @@ def autofiles(filenames):
             
     
 def hashsplit_iter(files):
+    global split_verbosely
     ofs = 0
     buf = Buf()
     fi = blobiter(files)
@@ -89,7 +93,8 @@ def hashsplit_iter(files):
           
         nv = (ofs + buf.used())/1000000
         if nv != lv:
-            #log('%d\t' % nv)
+            if split_verbosely >= 1:
+                log('%d\t' % nv)
             lv = nv