Commit 9a092304 authored by Jelmer Vernooij's avatar Jelmer Vernooij

Use progress bars.

parent 940385b8
......@@ -26,6 +26,8 @@ import subprocess
import sys
import warnings
from breezy import ui
from breezy.clean_tree import (
iter_deletables,
)
......@@ -297,17 +299,25 @@ def run_lintian_fixers(local_tree, fixers, update_changelog=True,
Returns:
List of tuples with (lintian-tag, description)
"""
fixers = list(fixers)
ret = []
for fixer in fixers:
if verbose:
note('Running fixer %r on %s', fixer, local_tree.basedir)
try:
fixed_lintian_tags, summary = run_lintian_fixer(
local_tree, fixer, update_changelog)
except ScriptFailed:
note('Fixer %r failed to run', fixer)
except NoChanges:
pass
else:
ret.append((fixed_lintian_tags, summary))
pb = ui.ui_factory.nested_progress_bar()
try:
for i, fixer in enumerate(fixers):
pb.update('Running fixer %r on %s' % (fixer, local_tree.basedir),
i, len(fixers))
try:
fixed_lintian_tags, summary = run_lintian_fixer(
local_tree, fixer, update_changelog)
except ScriptFailed:
note('Fixer %r failed to run.', fixer)
except NoChanges:
if verbose:
note('Fixer %r made no changes.', fixer)
else:
if verbose:
note('Fixer %r made changes.', fixer)
ret.append((fixed_lintian_tags, summary))
finally:
pb.finished()
return ret
......@@ -30,7 +30,7 @@ breezy.initialize()
import breezy.git # noqa: E402
import breezy.bzr # noqa: E402
from breezy.trace import note
from breezy.trace import note # noqa: E402
from . import ( # noqa: E402
NotDebianPackage,
......@@ -86,11 +86,10 @@ else:
wt, fixers, update_changelog=(not args.no_update_changelog),
verbose=args.verbose)
except NotDebianPackage:
note("%s: Not a debian package." % wt.basedir, file=sys.stderr)
note("%s: Not a debian package.", wt.basedir)
sys.exit(1)
except PendingChanges:
note("%s: Please commit pending changes first." % wt.basedir,
file=sys.stderr)
note("%s: Please commit pending changes first.", wt.basedir)
sys.exit(1)
if applied:
all_tags = set()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment