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

View File

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

View File

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