]> arthur.barton.de Git - bup.git/commitdiff
bup margin: Print explanation on tty's only
authorAlexander Barton <alex@barton.de>
Wed, 4 Feb 2015 09:44:25 +0000 (10:44 +0100)
committerAlexander Barton <alex@barton.de>
Wed, 4 Feb 2015 09:44:25 +0000 (10:44 +0100)
cmd/margin-cmd.py

index a7e51a37ca1aa5a88c6ccdda9609d1607dabc234..3775fa03fa5dae2e25a7e4a35e6e7017cb5497de 100755 (executable)
@@ -50,17 +50,20 @@ else:
         pm = _helpers.bitmatch(last, i)
         longmatch = max(longmatch, pm)
         last = i
-    log('')
-    log('%d matching prefix bits' % longmatch)
-    doublings = math.log(len(mi), 2)
-    bpd = longmatch / doublings
-    log('%.2f bits per doubling' % bpd)
-    remain = 160 - longmatch
-    rdoublings = remain / bpd
-    log('%d bits (%.2f doublings) remaining' % (remain, rdoublings))
-    larger = 2**rdoublings
-    log('%g times larger is possible' % larger)
-    perperson = larger/POPULATION_OF_EARTH
-    log('')
-    log('Everyone on earth could have %d data sets like yours,' % int(perperson))
-    log('all in one repository, and we would expect 1 object collision.')
+    if not istty1:
+        print longmatch
+    else:
+        log('')
+        log('%d matching prefix bits' % longmatch)
+        doublings = math.log(len(mi), 2)
+        bpd = longmatch / doublings
+        log('%.2f bits per doubling' % bpd)
+        remain = 160 - longmatch
+        rdoublings = remain / bpd
+        log('%d bits (%.2f doublings) remaining' % (remain, rdoublings))
+        larger = 2**rdoublings
+        log('%g times larger is possible' % larger)
+        perperson = larger/POPULATION_OF_EARTH
+        log('')
+        log('Everyone on earth could have %d data sets like yours,' % int(perperson))
+        log('all in one repository, and we would expect 1 object collision.')