From 9fc2748d476066675dddaf54dfc6c6a8b5e5f450 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 14 Feb 2020 18:33:30 +0100 Subject: Add dry run mode to xtask release --- xtask/src/lib.rs | 12 +++++++----- xtask/src/main.rs | 3 ++- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'xtask') 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<()> { .with_context(|| format!("failed to remove {:?}", path)) } -pub fn run_release() -> Result<()> { - run!("git switch release")?; - run!("git fetch upstream")?; - run!("git reset --hard upstream/master")?; - run!("git push")?; +pub fn run_release(dry_run: bool) -> Result<()> { + if !dry_run { + run!("git switch release")?; + run!("git fetch upstream")?; + run!("git reset --hard upstream/master")?; + run!("git push")?; + } let changelog_dir = project_root().join("../rust-analyzer.github.io/thisweek/_posts"); 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: run_pre_cache() } "release" => { + let dry_run = args.contains("--dry-run"); args.finish()?; - run_release() + run_release(dry_run) } _ => { eprintln!( -- cgit v1.2.3