diff options
author | Aleksey Kladov <[email protected]> | 2020-02-14 17:33:30 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-02-14 17:42:48 +0000 |
commit | 9fc2748d476066675dddaf54dfc6c6a8b5e5f450 (patch) | |
tree | b69434c3de621771e19dcde4d3ae1617bc3fbdb5 | |
parent | 082dd87b328e8cdf1b99999f9332e056a8bc916b (diff) |
Add dry run mode to xtask release
-rw-r--r-- | xtask/src/lib.rs | 12 | ||||
-rw-r--r-- | xtask/src/main.rs | 3 |
2 files changed, 9 insertions, 6 deletions
diff --git a/xtask/src/lib.rs b/xtask/src/lib.rs index d2ef2e95b..301a88324 100644 --- a/xtask/src/lib.rs +++ b/xtask/src/lib.rs | |||
@@ -158,11 +158,13 @@ fn rm_rf(path: &Path) -> Result<()> { | |||
158 | .with_context(|| format!("failed to remove {:?}", path)) | 158 | .with_context(|| format!("failed to remove {:?}", path)) |
159 | } | 159 | } |
160 | 160 | ||
161 | pub fn run_release() -> Result<()> { | 161 | pub fn run_release(dry_run: bool) -> Result<()> { |
162 | run!("git switch release")?; | 162 | if !dry_run { |
163 | run!("git fetch upstream")?; | 163 | run!("git switch release")?; |
164 | run!("git reset --hard upstream/master")?; | 164 | run!("git fetch upstream")?; |
165 | run!("git push")?; | 165 | run!("git reset --hard upstream/master")?; |
166 | run!("git push")?; | ||
167 | } | ||
166 | 168 | ||
167 | let changelog_dir = project_root().join("../rust-analyzer.github.io/thisweek/_posts"); | 169 | let changelog_dir = project_root().join("../rust-analyzer.github.io/thisweek/_posts"); |
168 | 170 | ||
diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 7ca727bde..a7dffe2cc 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs | |||
@@ -93,8 +93,9 @@ FLAGS: | |||
93 | run_pre_cache() | 93 | run_pre_cache() |
94 | } | 94 | } |
95 | "release" => { | 95 | "release" => { |
96 | let dry_run = args.contains("--dry-run"); | ||
96 | args.finish()?; | 97 | args.finish()?; |
97 | run_release() | 98 | run_release(dry_run) |
98 | } | 99 | } |
99 | _ => { | 100 | _ => { |
100 | eprintln!( | 101 | eprintln!( |