diff options
author | Arthur Zamarin <arthurzam@gentoo.org> | 2023-08-24 20:25:48 +0300 |
---|---|---|
committer | Arthur Zamarin <arthurzam@gentoo.org> | 2023-08-24 20:48:51 +0300 |
commit | 047ac2bdcfe019107b13646825818a0bc5339b9d (patch) | |
tree | 3ae0ec47c9c59a14e076df02f6194ad33b9d0793 /src/pkgdev/scripts | |
parent | commit: add support to enable/disable gpg signing (diff) | |
download | pkgdev-047ac2bdcfe019107b13646825818a0bc5339b9d.tar.gz pkgdev-047ac2bdcfe019107b13646825818a0bc5339b9d.tar.bz2 pkgdev-047ac2bdcfe019107b13646825818a0bc5339b9d.zip |
push: `--ask` stops for confirmation on warnings
Resolves: https://github.com/pkgcore/pkgdev/issues/150
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'src/pkgdev/scripts')
-rw-r--r-- | src/pkgdev/scripts/pkgdev_push.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/pkgdev/scripts/pkgdev_push.py b/src/pkgdev/scripts/pkgdev_push.py index 7948336..cf510ab 100644 --- a/src/pkgdev/scripts/pkgdev_push.py +++ b/src/pkgdev/scripts/pkgdev_push.py @@ -2,6 +2,7 @@ import argparse import shlex from pkgcheck import reporters, scan +from pkgcheck.results import Warning as PkgcheckWarning from snakeoil.cli import arghparse from snakeoil.cli.input import userquery @@ -58,9 +59,12 @@ def _push(options, out, err): # scan commits for QA issues pipe = scan(options.scan_args) + has_warnings = False with reporters.FancyReporter(out) as reporter: for result in pipe: reporter.report(result) + if result.level == PkgcheckWarning.level: + has_warnings = True # fail on errors unless they're ignored if pipe.errors: @@ -68,7 +72,10 @@ def _push(options, out, err): out.write(out.bold, out.fg("red"), "\nFAILURES", out.reset) for result in sorted(pipe.errors): reporter.report(result) - if not (options.ask and userquery("Push commits anyway?", out, err)): + if not (options.ask and userquery("Push commits anyway?", out, err, default_answer=False)): + return 1 + elif has_warnings and options.ask: + if not userquery("warnings detected, push commits anyway?", out, err, default_answer=False): return 1 # push commits upstream |