From 599fa49260b08149b15284b95252e14898592146 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Wei=C3=9Fmann?= Date: Wed, 15 May 2019 11:33:22 +0200 Subject: [PATCH] Adds support for 'myrepos' cli tool (#149) --- README.md | 1 + src/main.rs | 6 ++++++ src/steps/generic.rs | 20 ++++++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/README.md b/README.md index 925cfd6e..6d441865 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,7 @@ Just run `topgrade`. It will run the following steps: * Upgrade Emacs packages (You'll get a better output if you have [Paradox](https://github.com/Malabarba/paradox) installed) * Upgrade [OCaml packages](https://opam.ocaml.org/) * Upgrade [vcpkg](https://github.com/Microsoft/vcpkg) globally installed packages +* Upgrade [myrepos](https://myrepos.branchable.com/) managed sourcecode repositories * Upgrade Python packages installed using [pipx](https://github.com/cs01/pipx) * Upgrade [R globally installed packages](https://github.com/ankane/jetpack) * Upgrade Vim/Neovim packages. Works with the following plugin frameworks: diff --git a/src/main.rs b/src/main.rs index 029354ec..5d374b57 100644 --- a/src/main.rs +++ b/src/main.rs @@ -277,6 +277,12 @@ fn run() -> Result<(), Error> { || generic::run_pipx_update(run_type), config.no_retry(), )?; + execute( + &mut report, + "myrepos", + || generic::run_myrepos_update(&base_dirs, run_type), + config.no_retry(), + )?; #[cfg(unix)] execute(&mut report, "pearl", || unix::run_pearl(run_type), config.no_retry())?; execute( diff --git a/src/steps/generic.rs b/src/steps/generic.rs index 168ee5da..45a165d9 100644 --- a/src/steps/generic.rs +++ b/src/steps/generic.rs @@ -88,6 +88,26 @@ pub fn run_pipx_update(run_type: RunType) -> Result<(), Error> { run_type.execute(&pipx).arg("upgrade-all").check_run() } +pub fn run_myrepos_update(base_dirs: &BaseDirs, run_type: RunType) -> Result<(), Error> { + let myrepos = utils::require("mr")?; + base_dirs.home_dir().join(".mrconfig").require()?; + + print_separator("myrepos"); + + run_type + .execute(&myrepos) + .arg("--directory") + .arg(base_dirs.home_dir()) + .arg("checkout") + .check_run()?; + run_type + .execute(&myrepos) + .arg("--directory") + .arg(base_dirs.home_dir()) + .arg("update") + .check_run() +} + pub fn run_custom_command(name: &str, command: &str, run_type: RunType) -> Result<(), Error> { print_separator(name); run_type.execute("sh").arg("-c").arg(command).check_run()