diff options
author | George Burgess IV <gbiv@google.com> | 2024-04-08 16:40:37 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2024-04-08 23:30:06 +0000 |
commit | ae16c1ddb4b3fca7bc7613e1a5b2f2dd95686bd4 (patch) | |
tree | 099d8fdfdbf5e2b923a9c96d8edf9400bee0d169 | |
parent | b5f88d7db8150006a24675d8db1376678f7e850a (diff) | |
download | toolchain-utils-ae16c1ddb4b3fca7bc7613e1a5b2f2dd95686bd4.tar.gz |
setup_for_workon: make --checkout or --no-checkout mandatory
As suggested by ryanbeltran@.
BUG=None
TEST=Ran with --checkout, --no-checkout, and neither of these.
TEST=Succeeded in the first two cases, failed with a helpful error
TEST=message in the last.
Change-Id: I418daaf64053aefcf454a0b4794db037f2fcc39b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5436086
Commit-Queue: George Burgess <gbiv@chromium.org>
Tested-by: George Burgess <gbiv@chromium.org>
Reviewed-by: Ryan Beltran <ryanbeltran@chromium.org>
-rwxr-xr-x | llvm_tools/setup_for_workon.py | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/llvm_tools/setup_for_workon.py b/llvm_tools/setup_for_workon.py index 41f3d45c..8c67f816 100755 --- a/llvm_tools/setup_for_workon.py +++ b/llvm_tools/setup_for_workon.py @@ -139,12 +139,6 @@ def main(argv: List[str]) -> None: """, ) parser.add_argument( - "--checkout", - help=""" - If specified, the llvm directory will be checked out to the given SHA. - """, - ) - parser.add_argument( "--clean-llvm", action="store_true", help=""" @@ -175,6 +169,26 @@ def main(argv: List[str]) -> None: Set to 'host' for working on the host system, and not a board. """, ) + + checkout_group = parser.add_mutually_exclusive_group(required=True) + checkout_group.add_argument( + "--checkout", + help=""" + If specified, the llvm directory will be checked out to the given SHA. + """, + ) + # The value of this isn't used anywhere; it's just used as an explicit + # nudge for checking LLVM out. + checkout_group.add_argument( + "--no-checkout", + action="store_true", + help=""" + Don't check llvm-project out to anything special before running. Useful + if you'd like to, for example, workon multiple LLVM projects + simultaneously and have already called `setup_for_workon` on another + one. + """, + ) opts = parser.parse_args(argv) ebuild_dir = opts.ebuild_dir @@ -199,7 +213,7 @@ def main(argv: List[str]) -> None: ["git", "reset", "--hard", "HEAD"], ) - if opts.checkout: + if opts.checkout is not None: git_housekeeping_commands.append( ["git", "checkout", "--quiet", opts.checkout], ) |