aboutsummaryrefslogtreecommitdiff
path: root/xtask/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-07-07 17:38:34 +0100
committerAleksey Kladov <[email protected]>2020-07-07 17:38:34 +0100
commita614d84ff4b4edb43183e5d393ce042f186962a2 (patch)
treee954e38adb5ac1702f3c93cb08763af1a6a855bb /xtask/src
parentfaa65d7856314d60e504ebd976a1162342d3b376 (diff)
Automate rust-analyzer promotion
Diffstat (limited to 'xtask/src')
-rw-r--r--xtask/src/not_bash.rs12
-rw-r--r--xtask/src/release.rs22
2 files changed, 30 insertions, 4 deletions
diff --git a/xtask/src/not_bash.rs b/xtask/src/not_bash.rs
index a6431e586..8844fa216 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<Stri
153 153
154// FIXME: some real shell lexing here 154// FIXME: some real shell lexing here
155fn shelx(cmd: &str) -> Vec<String> { 155fn shelx(cmd: &str) -> Vec<String> {
156 cmd.split_whitespace().map(|it| it.to_string()).collect() 156 let mut res = Vec::new();
157 for (string_piece, in_quotes) in cmd.split('\'').zip([false, true].iter().copied().cycle()) {
158 if in_quotes {
159 res.push(string_piece.to_string())
160 } else {
161 if !string_piece.is_empty() {
162 res.extend(string_piece.split_ascii_whitespace().map(|it| it.to_string()))
163 }
164 }
165 }
166 res
157} 167}
158 168
159struct Env { 169struct Env {
diff --git a/xtask/src/release.rs b/xtask/src/release.rs
index d2d769099..170cfee9f 100644
--- a/xtask/src/release.rs
+++ b/xtask/src/release.rs
@@ -1,6 +1,6 @@
1use crate::{ 1use crate::{
2 codegen, is_release_tag, 2 codegen, is_release_tag,
3 not_bash::{date_iso, fs2, run}, 3 not_bash::{date_iso, fs2, pushd, run},
4 project_root, Mode, Result, 4 project_root, Mode, Result,
5}; 5};
6 6
@@ -76,9 +76,25 @@ pub struct PromoteCmd {
76 76
77impl PromoteCmd { 77impl PromoteCmd {
78 pub fn run(self) -> Result<()> { 78 pub fn run(self) -> Result<()> {
79 run!("git switch release")?; 79 let _dir = pushd("../rust-rust-analyzer");
80 run!("git switch master")?;
80 run!("git fetch upstream")?; 81 run!("git fetch upstream")?;
81 run!("git reset --hard upstream/release")?; 82 run!("git reset --hard upstream/master")?;
83 run!("git submodule update --recursive")?;
84
85 let branch = format!("rust-analyzer-{}", date_iso()?);
86 run!("git switch -c {}", branch)?;
87 {
88 let _dir = pushd("src/tools/rust-analyzer");
89 run!("git fetch origin")?;
90 run!("git reset --hard origin/release")?;
91 }
92 run!("git add src/tools/rust-analyzer")?;
93 run!("git commit -m':arrow_up: rust-analyzer'")?;
94 if !self.dry_run {
95 run!("git push")?;
96 run!("xdg-open https://github.com/matklad/rust/pull/new/{}", branch)?;
97 }
82 Ok(()) 98 Ok(())
83 } 99 }
84} 100}