From faa65d7856314d60e504ebd976a1162342d3b376 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 7 Jul 2020 18:12:22 +0200 Subject: [PATCH 1/2] . --- xtask/src/main.rs | 7 ++++++- xtask/src/release.rs | 13 +++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/xtask/src/main.rs b/xtask/src/main.rs index f7a79362d95..f447613d430 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -17,7 +17,7 @@ install::{ClientOpt, InstallCmd, ServerOpt}, not_bash::pushd, pre_commit, project_root, - release::ReleaseCmd, + release::{PromoteCmd, ReleaseCmd}, run_clippy, run_fuzzer, run_pre_cache, run_rustfmt, Result, }; @@ -105,6 +105,11 @@ fn main() -> Result<()> { args.finish()?; ReleaseCmd { dry_run }.run() } + "promote" => { + let dry_run = args.contains("--dry-run"); + args.finish()?; + PromoteCmd { dry_run }.run() + } "dist" => { let nightly = args.contains("--nightly"); let client_version: Option = args.opt_value_from_str("--client")?; diff --git a/xtask/src/release.rs b/xtask/src/release.rs index 46992c1cacd..d2d769099d6 100644 --- a/xtask/src/release.rs +++ b/xtask/src/release.rs @@ -69,3 +69,16 @@ pub fn run(self) -> Result<()> { Ok(()) } } + +pub struct PromoteCmd { + pub dry_run: bool, +} + +impl PromoteCmd { + pub fn run(self) -> Result<()> { + run!("git switch release")?; + run!("git fetch upstream")?; + run!("git reset --hard upstream/release")?; + Ok(()) + } +} From a614d84ff4b4edb43183e5d393ce042f186962a2 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 7 Jul 2020 18:38:34 +0200 Subject: [PATCH 2/2] Automate rust-analyzer promotion --- xtask/src/not_bash.rs | 12 +++++++++++- xtask/src/release.rs | 22 +++++++++++++++++++--- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/xtask/src/not_bash.rs b/xtask/src/not_bash.rs index a6431e58633..8844fa2168a 100644 --- a/xtask/src/not_bash.rs +++ b/xtask/src/not_bash.rs @@ -153,7 +153,17 @@ fn run_process_inner(cmd: &str, echo: bool, stdin: Option<&[u8]>) -> Result Vec { - cmd.split_whitespace().map(|it| it.to_string()).collect() + let mut res = Vec::new(); + for (string_piece, in_quotes) in cmd.split('\'').zip([false, true].iter().copied().cycle()) { + if in_quotes { + res.push(string_piece.to_string()) + } else { + if !string_piece.is_empty() { + res.extend(string_piece.split_ascii_whitespace().map(|it| it.to_string())) + } + } + } + res } struct Env { diff --git a/xtask/src/release.rs b/xtask/src/release.rs index d2d769099d6..170cfee9fe8 100644 --- a/xtask/src/release.rs +++ b/xtask/src/release.rs @@ -1,6 +1,6 @@ use crate::{ codegen, is_release_tag, - not_bash::{date_iso, fs2, run}, + not_bash::{date_iso, fs2, pushd, run}, project_root, Mode, Result, }; @@ -76,9 +76,25 @@ pub struct PromoteCmd { impl PromoteCmd { pub fn run(self) -> Result<()> { - run!("git switch release")?; + let _dir = pushd("../rust-rust-analyzer"); + run!("git switch master")?; run!("git fetch upstream")?; - run!("git reset --hard upstream/release")?; + run!("git reset --hard upstream/master")?; + run!("git submodule update --recursive")?; + + let branch = format!("rust-analyzer-{}", date_iso()?); + run!("git switch -c {}", branch)?; + { + let _dir = pushd("src/tools/rust-analyzer"); + run!("git fetch origin")?; + run!("git reset --hard origin/release")?; + } + run!("git add src/tools/rust-analyzer")?; + run!("git commit -m':arrow_up: rust-analyzer'")?; + if !self.dry_run { + run!("git push")?; + run!("xdg-open https://github.com/matklad/rust/pull/new/{}", branch)?; + } Ok(()) } }