mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 04:53:34 +00:00
Merge #5253
5253: Automate rust-analyzer promotion r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
980a67f446
3 changed files with 47 additions and 3 deletions
|
@ -17,7 +17,7 @@ use xtask::{
|
||||||
install::{ClientOpt, InstallCmd, ServerOpt},
|
install::{ClientOpt, InstallCmd, ServerOpt},
|
||||||
not_bash::pushd,
|
not_bash::pushd,
|
||||||
pre_commit, project_root,
|
pre_commit, project_root,
|
||||||
release::ReleaseCmd,
|
release::{PromoteCmd, ReleaseCmd},
|
||||||
run_clippy, run_fuzzer, run_pre_cache, run_rustfmt, Result,
|
run_clippy, run_fuzzer, run_pre_cache, run_rustfmt, Result,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -105,6 +105,11 @@ FLAGS:
|
||||||
args.finish()?;
|
args.finish()?;
|
||||||
ReleaseCmd { dry_run }.run()
|
ReleaseCmd { dry_run }.run()
|
||||||
}
|
}
|
||||||
|
"promote" => {
|
||||||
|
let dry_run = args.contains("--dry-run");
|
||||||
|
args.finish()?;
|
||||||
|
PromoteCmd { dry_run }.run()
|
||||||
|
}
|
||||||
"dist" => {
|
"dist" => {
|
||||||
let nightly = args.contains("--nightly");
|
let nightly = args.contains("--nightly");
|
||||||
let client_version: Option<String> = args.opt_value_from_str("--client")?;
|
let client_version: Option<String> = args.opt_value_from_str("--client")?;
|
||||||
|
|
|
@ -153,7 +153,17 @@ fn run_process_inner(cmd: &str, echo: bool, stdin: Option<&[u8]>) -> Result<Stri
|
||||||
|
|
||||||
// FIXME: some real shell lexing here
|
// FIXME: some real shell lexing here
|
||||||
fn shelx(cmd: &str) -> Vec<String> {
|
fn shelx(cmd: &str) -> Vec<String> {
|
||||||
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 {
|
struct Env {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
codegen, is_release_tag,
|
codegen, is_release_tag,
|
||||||
not_bash::{date_iso, fs2, run},
|
not_bash::{date_iso, fs2, pushd, run},
|
||||||
project_root, Mode, Result,
|
project_root, Mode, Result,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -69,3 +69,32 @@ Release: release:{}[]
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct PromoteCmd {
|
||||||
|
pub dry_run: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PromoteCmd {
|
||||||
|
pub fn run(self) -> Result<()> {
|
||||||
|
let _dir = pushd("../rust-rust-analyzer");
|
||||||
|
run!("git switch master")?;
|
||||||
|
run!("git fetch upstream")?;
|
||||||
|
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(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue