Merge branch 'develop'

This commit is contained in:
2023-11-06 20:18:10 +01:00
6 changed files with 206 additions and 331 deletions

496
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "git-repo-manager" name = "git-repo-manager"
version = "0.7.14" version = "0.7.15"
edition = "2021" edition = "2021"
authors = [ authors = [
@@ -41,36 +41,36 @@ path = "src/grm/main.rs"
[dependencies] [dependencies]
[dependencies.toml] [dependencies.toml]
version = "=0.7.6" version = "=0.8.6"
[dependencies.serde] [dependencies.serde]
version = "=1.0.183" version = "=1.0.190"
features = ["derive"] features = ["derive"]
[dependencies.git2] [dependencies.git2]
version = "=0.17.2" version = "=0.18.1"
[dependencies.shellexpand] [dependencies.shellexpand]
version = "=3.1.0" version = "=3.1.0"
[dependencies.clap] [dependencies.clap]
version = "=4.3.21" version = "=4.4.7"
features = ["derive", "cargo"] features = ["derive", "cargo"]
[dependencies.console] [dependencies.console]
version = "=0.15.7" version = "=0.15.7"
[dependencies.regex] [dependencies.regex]
version = "=1.9.3" version = "=1.10.2"
[dependencies.comfy-table] [dependencies.comfy-table]
version = "=7.0.1" version = "=7.1.0"
[dependencies.serde_yaml] [dependencies.serde_yaml]
version = "=0.9.25" version = "=0.9.27"
[dependencies.serde_json] [dependencies.serde_json]
version = "=1.0.104" version = "=1.0.108"
[dependencies.isahc] [dependencies.isahc]
version = "=1.7.2" version = "=1.7.2"

View File

@@ -34,7 +34,7 @@ in once place?
This is how GRM came to be. I'm a fan of infrastructure-as-code, and GRM is a bit This is how GRM came to be. I'm a fan of infrastructure-as-code, and GRM is a bit
like Terraform for your local git repositories. Write a config, run the tool, and like Terraform for your local git repositories. Write a config, run the tool, and
your repos are ready. The only thing that is tracked by git it the list of your repos are ready. The only thing that is tracked by git is the list of
repositories itself. repositories itself.
# Crates # Crates

View File

@@ -313,7 +313,7 @@ pub trait Provider {
// about the data exchange format here. // about the data exchange format here.
repo.remove_namespace(); repo.remove_namespace();
ret.entry(namespace).or_insert(vec![]).push(repo); ret.entry(namespace).or_default().push(repo);
} }
Ok(ret) Ok(ret)

View File

@@ -4,6 +4,7 @@ use super::repo;
use comfy_table::{Cell, Table}; use comfy_table::{Cell, Table};
use std::fmt::Write;
use std::path::Path; use std::path::Path;
fn add_table_header(table: &mut Table) { fn add_table_header(table: &mut Table) {
@@ -56,9 +57,10 @@ fn add_repo_status(
repo_status repo_status
.branches .branches
.iter() .iter()
.map(|(branch_name, remote_branch)| { .fold(String::new(), |mut s, (branch_name, remote_branch)| {
format!( writeln!(
"branch: {}{}\n", &mut s,
"branch: {}{}",
&branch_name, &branch_name,
&match remote_branch { &match remote_branch {
None => String::from(" <!local>"), None => String::from(" <!local>"),
@@ -78,8 +80,9 @@ fn add_repo_status(
} }
} }
) )
.unwrap();
s
}) })
.collect::<String>()
.trim(), .trim(),
&match is_worktree { &match is_worktree {
true => String::from(""), true => String::from(""),
@@ -91,8 +94,10 @@ fn add_repo_status(
repo_status repo_status
.remotes .remotes
.iter() .iter()
.map(|r| format!("{}\n", r)) .fold(String::new(), |mut s, r| {
.collect::<String>() writeln!(&mut s, "{r}").unwrap();
s
})
.trim(), .trim(),
]); ]);

View File

@@ -179,7 +179,7 @@ fn sync_repo(root_path: &Path, repo: &repo::Repo, init_worktree: bool) -> Result
"Repo already exists, but is not using a worktree setup", "Repo already exists, but is not using a worktree setup",
)); ));
}; };
} else if matches!(&repo.remotes, None) || repo.remotes.as_ref().unwrap().is_empty() { } else if repo.remotes.is_none() || repo.remotes.as_ref().unwrap().is_empty() {
print_repo_action( print_repo_action(
&repo.name, &repo.name,
"Repository does not have remotes configured, initializing new", "Repository does not have remotes configured, initializing new",