Skip to content

Commit

Permalink
repopick: Use add_mutually_exclusive_group() where possible
Browse files Browse the repository at this point in the history
Change-Id: I7e38e2371d075afd53200d60703eb4466fff07e3
  • Loading branch information
luk1337 committed Dec 9, 2024
1 parent 8e7b779 commit be60f23
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions build/tools/repopick.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,11 @@ def main():
action="store_true",
help='shortcut to "--start-branch auto --abandon-first --ignore-missing"',
)
parser.add_argument(
group = parser.add_mutually_exclusive_group()
group.add_argument(
"-q", "--quiet", action="store_true", help="print as little as possible"
)
parser.add_argument(
group.add_argument(
"-v",
"--verbose",
action="store_true",
Expand All @@ -278,13 +279,14 @@ def main():
parser.add_argument(
"-P", "--path", metavar="", help="use the specified path for the change"
)
parser.add_argument(
group = parser.add_mutually_exclusive_group()
group.add_argument(
"-t", "--topic", metavar="", help="pick all commits from a specified topic"
)
parser.add_argument(
group.add_argument(
"-H", "--hashtag", metavar="", help="pick all commits from a specified hashtag"
)
parser.add_argument(
group.add_argument(
"-Q", "--query", metavar="", help="pick all commits using the specified query"
)
parser.add_argument(
Expand Down Expand Up @@ -327,13 +329,6 @@ def main():
args.ignore_missing = True
if not args.start_branch:
args.start_branch = ["auto"]
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.hashtag) << bool(args.query)) != 2:
parser.error(
"One (and only one) of change_number, topic, hashtag and query are allowed"
)

# Change current directory to the top of the tree
if "ANDROID_BUILD_TOP" in os.environ:
Expand Down

0 comments on commit be60f23

Please sign in to comment.