repopick: Add support for hashtags

Test: repopick -H redbull
Change-Id: I1522be31e547a7f8917223e7eeae4389de083227
This commit is contained in:
Michael Bestas
2024-12-09 20:06:48 +02:00
committed by LuK1337
parent 87edd14894
commit 8e7b7795df

View File

@@ -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 = [