From 8e7b7795dfda07ba6b69fa6953b5687ce6957775 Mon Sep 17 00:00:00 2001 From: Michael Bestas Date: Mon, 9 Dec 2024 20:06:48 +0200 Subject: [PATCH] repopick: Add support for hashtags Test: repopick -H redbull Change-Id: I1522be31e547a7f8917223e7eeae4389de083227 --- build/tools/repopick.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/build/tools/repopick.py b/build/tools/repopick.py index 8d2d8355..43cc2845 100755 --- a/build/tools/repopick.py +++ b/build/tools/repopick.py @@ -281,6 +281,9 @@ def main(): parser.add_argument( "-t", "--topic", metavar="", help="pick all commits from a specified topic" ) + parser.add_argument( + "-H", "--hashtag", metavar="", help="pick all commits from a specified hashtag" + ) parser.add_argument( "-Q", "--query", metavar="", help="pick all commits using the specified query" ) @@ -327,9 +330,9 @@ def main(): if args.quiet and args.verbose: parser.error("--quiet and --verbose cannot be specified together") - if (1 << bool(args.change_number) << bool(args.topic) << bool(args.query)) != 2: + if (1 << bool(args.change_number) << bool(args.topic) << bool(args.hashtag) << bool(args.query)) != 2: parser.error( - "One (and only one) of change_number, topic, and query are allowed" + "One (and only one) of change_number, topic, hashtag and query are allowed" ) # Change current directory to the top of the tree @@ -423,6 +426,11 @@ def main(): change_numbers = [ str(r["number"]) for r in sorted(reviews, key=cmp_to_key(cmp_reviews)) ] + elif args.hashtag: + reviews = fetch_query(args.gerrit, "hashtag:{0}".format(args.hashtag)) + change_numbers = [ + str(r["number"]) for r in sorted(reviews, key=cmp_to_key(cmp_reviews)) + ] elif args.query: reviews = fetch_query(args.gerrit, args.query) change_numbers = [