diff options
author | Jordan R Abrahams <ajordanr@google.com> | 2022-01-12 00:29:50 +0000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-01-13 19:19:58 +0000 |
commit | 500f764595891c07c8de9e6bfaa2b16d8628e561 (patch) | |
tree | 69365007ee1bdd2cc962be63cd1ac0771f253b29 /llvm_tools/patch_sync/src/main.rs | |
parent | c5b1bd6c4bb4f3e753c25872b58f1b9a53f3165b (diff) | |
download | toolchain-utils-500f764595891c07c8de9e6bfaa2b16d8628e561.tar.gz |
patch_sync: Commit features
This adds several important version control features:
* Changes branches on set up.
* Cleans up any changes made, even if upload fails.
* Sends commits for review (enabled via CLI).
* Enables CQ for CrOS.
BUG=b:209493133
TEST=cargo test
Change-Id: I8ab2650aae301c08fd80358162a285e46d44e3e1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3379479
Reviewed-by: George Burgess <gbiv@chromium.org>
Commit-Queue: Jordan Abrahams-Whitehead <ajordanr@google.com>
Tested-by: Jordan Abrahams-Whitehead <ajordanr@google.com>
Diffstat (limited to 'llvm_tools/patch_sync/src/main.rs')
-rw-r--r-- | llvm_tools/patch_sync/src/main.rs | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/llvm_tools/patch_sync/src/main.rs b/llvm_tools/patch_sync/src/main.rs index f2d70edb..cec523bb 100644 --- a/llvm_tools/patch_sync/src/main.rs +++ b/llvm_tools/patch_sync/src/main.rs @@ -2,6 +2,7 @@ mod patch_parsing; mod version_control; use anyhow::{Context, Result}; +use std::borrow::ToOwned; use std::path::PathBuf; use structopt::StructOpt; @@ -14,8 +15,10 @@ fn main() -> Result<()> { } => show_subcmd(cros_checkout_path, android_checkout_path, sync), Opt::Transpose { cros_checkout_path, + cros_reviewers, old_cros_ref, android_checkout_path, + android_reviewers, old_android_ref, sync, verbose, @@ -23,8 +26,13 @@ fn main() -> Result<()> { no_commit, } => transpose_subcmd(TransposeOpt { cros_checkout_path, + cros_reviewers: cros_reviewers.split(',').map(ToOwned::to_owned).collect(), old_cros_ref, android_checkout_path, + android_reviewers: android_reviewers + .split(',') + .map(ToOwned::to_owned) + .collect(), old_android_ref, sync, verbose, @@ -67,6 +75,8 @@ struct TransposeOpt { verbose: bool, dry_run: bool, no_commit: bool, + cros_reviewers: Vec<String>, + android_reviewers: Vec<String>, } fn transpose_subcmd(args: TransposeOpt) -> Result<()> { @@ -128,11 +138,11 @@ fn transpose_subcmd(args: TransposeOpt) -> Result<()> { // Note we want to check if the android patches are empty for CrOS, and // vice versa. This is a little counterintuitive. if !new_android_patches.is_empty() { - ctx.cros_repo_upload() + ctx.cros_repo_upload(&args.cros_reviewers) .context("uploading chromiumos changes")?; } if !new_cros_patches.is_empty() { - ctx.android_repo_upload() + ctx.android_repo_upload(&args.android_reviewers) .context("uploading android changes")?; } Ok(()) @@ -158,6 +168,11 @@ enum Opt { #[structopt(long = "cros-checkout", parse(from_os_str))] cros_checkout_path: PathBuf, + /// Emails to send review requests to during Chromium OS upload. + /// Comma separated. + #[structopt(long = "cros-rev")] + cros_reviewers: String, + /// Git ref (e.g. hash) for the ChromiumOS overlay to use as the base. #[structopt(long = "overlay-base-ref")] old_cros_ref: String, @@ -166,6 +181,11 @@ enum Opt { #[structopt(long = "aosp-checkout", parse(from_os_str))] android_checkout_path: PathBuf, + /// Emails to send review requests to during Android upload. + /// Comma separated. + #[structopt(long = "aosp-rev")] + android_reviewers: String, + /// Git ref (e.g. hash) for the llvm_android repo to use as the base. #[structopt(long = "aosp-base-ref")] old_android_ref: String, @@ -179,12 +199,11 @@ enum Opt { verbose: bool, /// Do not change any files. Useful in combination with `--verbose` - /// Implies `--no-commit` and `--no-upload`. + /// Implies `--no-commit`. #[structopt(long)] dry_run: bool, - /// Do not commit any changes made. - /// Implies `--no-upload`. + /// Do not commit or upload any changes made. #[structopt(long)] no_commit: bool, }, |