commit:     d8f4c5c7b198d6ad0dc6bfe88163b5ae0cff2b48
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 22 16:16:09 2023 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Thu Jun 22 16:16:09 2023 +0000
URL:        
https://gitweb.gentoo.org/proj/pkgcore/pkgdev.git/commit/?id=d8f4c5c7

bugs: fix bugs to open count

Resolves: https://github.com/pkgcore/pkgdev/issues/142
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 src/pkgdev/scripts/pkgdev_bugs.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/pkgdev/scripts/pkgdev_bugs.py 
b/src/pkgdev/scripts/pkgdev_bugs.py
index 0a3ff91..08da876 100644
--- a/src/pkgdev/scripts/pkgdev_bugs.py
+++ b/src/pkgdev/scripts/pkgdev_bugs.py
@@ -525,8 +525,13 @@ def main(options, out: Formatter, err: Formatter):
         d.output_dot(options.dot)
         out.write(out.fg("green"), f"Dot file written to {options.dot}", 
out.reset)
 
+    bugs_count = len(tuple(node for node in d.nodes if node.bugno is None))
+    if bugs_count == 0:
+        out.write(out.fg("red"), "Nothing to do, exiting", out.reset)
+        return 1
+
     if not userquery(
-        f"Continue and create {len(d.nodes)} stablereq bugs?", out, err, 
default_answer=False
+        f"Continue and create {bugs_count} stablereq bugs?", out, err, 
default_answer=False
     ):
         return 1
 

Reply via email to