Skip to content

Commit

Permalink
midx/bloom: use progress() and debug1() for non-critical messages
Browse files Browse the repository at this point in the history
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 <lelutin@gmail.com>
Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
  • Loading branch information
lelutin authored and apenwarr committed Feb 26, 2011
1 parent c8a4adc commit 1baade3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions cmd/bloom-cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 ''))
Expand Down
4 changes: 2 additions & 2 deletions cmd/midx-cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 1baade3

Please sign in to comment.