aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--llvm_tools/patch_sync/src/main.rs18
-rw-r--r--llvm_tools/patch_sync/src/patch_parsing.rs14
2 files changed, 18 insertions, 14 deletions
diff --git a/llvm_tools/patch_sync/src/main.rs b/llvm_tools/patch_sync/src/main.rs
index 8c1eff1c..033691e4 100644
--- a/llvm_tools/patch_sync/src/main.rs
+++ b/llvm_tools/patch_sync/src/main.rs
@@ -37,13 +37,14 @@ fn main() -> Result<()> {
no_commit,
} => transpose_subcmd(TransposeOpt {
cros_checkout_path,
- cros_reviewers: cros_reviewers.split(',').map(ToOwned::to_owned).collect(),
+ cros_reviewers: cros_reviewers
+ .map(|r| r.split(',').map(ToOwned::to_owned).collect())
+ .unwrap_or_default(),
old_cros_ref,
android_checkout_path,
android_reviewers: android_reviewers
- .split(',')
- .map(ToOwned::to_owned)
- .collect(),
+ .map(|r| r.split(',').map(ToOwned::to_owned).collect())
+ .unwrap_or_default(),
old_android_ref,
sync,
verbose,
@@ -80,8 +81,11 @@ fn show_subcmd(args: ShowOpt) -> Result<()> {
parsed_collection
} else {
filter_patches_by_platform(&parsed_collection, platform).map_patches(|p| {
+ // Need to do this platforms creation as Rust 1.55 cannot use "from".
+ let mut platforms = BTreeSet::new();
+ platforms.insert(platform.to_string());
PatchDictSchema {
- platforms: BTreeSet::from([platform.to_string()]),
+ platforms,
..p.clone()
}
})
@@ -230,7 +234,7 @@ enum Opt {
/// Emails to send review requests to during Chromium OS upload.
/// Comma separated.
#[structopt(long = "cros-rev")]
- cros_reviewers: String,
+ cros_reviewers: Option<String>,
/// Git ref (e.g. hash) for the ChromiumOS overlay to use as the base.
#[structopt(long = "overlay-base-ref")]
@@ -243,7 +247,7 @@ enum Opt {
/// Emails to send review requests to during Android upload.
/// Comma separated.
#[structopt(long = "aosp-rev")]
- android_reviewers: String,
+ android_reviewers: Option<String>,
/// Git ref (e.g. hash) for the llvm_android repo to use as the base.
#[structopt(long = "aosp-base-ref")]
diff --git a/llvm_tools/patch_sync/src/patch_parsing.rs b/llvm_tools/patch_sync/src/patch_parsing.rs
index 2f0fbc87..581b1899 100644
--- a/llvm_tools/patch_sync/src/patch_parsing.rs
+++ b/llvm_tools/patch_sync/src/patch_parsing.rs
@@ -253,13 +253,13 @@ pub fn new_patches(
let old_collection = old_collection.filter_patches(|p| old_collection.patch_exists(p));
cur_collection.subtract(&old_collection)?
};
- let new_patches = new_patches.map_patches(|p| PatchDictSchema {
- platforms: BTreeSet::from(["android".to_string(), "chromiumos".to_string()])
- .union(&p.platforms)
- .cloned()
- .collect(),
-
- ..p.to_owned()
+ let new_patches = new_patches.map_patches(|p| {
+ let mut platforms = BTreeSet::new();
+ platforms.extend(["android".to_string(), "chromiumos".to_string()]);
+ PatchDictSchema {
+ platforms: platforms.union(&p.platforms).cloned().collect(),
+ ..p.to_owned()
+ }
});
Ok((cur_collection, new_patches))
}