From 1baade32f5fed243782d2be9677491d0d3396d19 Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Fri, 25 Feb 2011 11:16:05 -0500 Subject: [PATCH] midx/bloom: use progress() and debug1() for non-critical messages Some messages in these two commands indicate progress but are not filtered out when the command is not run under a tty. This makes bup return some unwanted messages when run under cron. Using progress() and debug1() instead should fix that. (Changed a few from progress() to debug1() by apenwarr.) Signed-off-by: Gabriel Filion Signed-off-by: Avery Pennarun --- cmd/bloom-cmd.py | 12 ++++++------ cmd/midx-cmd.py | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/bloom-cmd.py b/cmd/bloom-cmd.py index 02b0a10..51e594b 100755 --- a/cmd/bloom-cmd.py +++ b/cmd/bloom-cmd.py @@ -81,14 +81,14 @@ def do_bloom(path, outfilename): if b: if len(b) != rest_count: - log("bloom: size %d != idx total %d, regenerating\n" - % (len(b), rest_count)) + debug1("bloom: size %d != idx total %d, regenerating\n" + % (len(b), rest_count)) b = None elif (b.bits < bloom.MAX_BLOOM_BITS and b.pfalse_positive(add_count) > bloom.MAX_PFALSE_POSITIVE): - log("bloom: regenerating: adding %d entries gives " - "%.2f%% false positives.\n" - % (add_count, b.pfalse_positive(add_count))) + debug1("bloom: regenerating: adding %d entries gives " + "%.2f%% false positives.\n" + % (add_count, b.pfalse_positive(add_count))) b = None else: b = bloom.ShaBloom(outfilename, readwrite=True, expected=add_count) @@ -101,7 +101,7 @@ def do_bloom(path, outfilename): msg = b is None and 'creating from' or 'adding' if not _first: _first = path dirprefix = (_first != path) and git.repo_rel(path)+': ' or '' - log('bloom: %s%s %d file%s (%d object%s).\n' + progress('bloom: %s%s %d file%s (%d object%s).\n' % (dirprefix, msg, len(add), len(add)!=1 and 's' or '', add_count, add_count!=1 and 's' or '')) diff --git a/cmd/midx-cmd.py b/cmd/midx-cmd.py index 8e8fbca..38a5fdf 100755 --- a/cmd/midx-cmd.py +++ b/cmd/midx-cmd.py @@ -97,8 +97,8 @@ def _do_midx(outdir, outfilename, infilenames, prefixstr): if not _first: _first = outdir dirprefix = (_first != outdir) and git.repo_rel(outdir)+': ' or '' - log('midx: %s%screating from %d files (%d objects).\n' - % (dirprefix, prefixstr, len(infilenames), total)) + debug1('midx: %s%screating from %d files (%d objects).\n' + % (dirprefix, prefixstr, len(infilenames), total)) if (opt.auto and (total < 1024 and len(infilenames) < 3)) \ or ((opt.auto or opt.force) and len(infilenames) < 2) \ or (opt.force and not total): -- 2.39.2