Compare commits
5 Commits
6e79dd318a
...
v0.7.12
| Author | SHA1 | Date | |
|---|---|---|---|
| 9b4ed2837e | |||
| 701e64df6f | |||
| 23fc942db7 | |||
| 38bba1472e | |||
| 7d131bbacf |
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -330,7 +330,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "git-repo-manager"
|
name = "git-repo-manager"
|
||||||
version = "0.7.11"
|
version = "0.7.12"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"comfy-table",
|
"comfy-table",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "git-repo-manager"
|
name = "git-repo-manager"
|
||||||
version = "0.7.11"
|
version = "0.7.12"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
authors = [
|
authors = [
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ def test_repos_find_remote_no_filter(provider, configtype, default, use_config):
|
|||||||
cmd = grm(args)
|
cmd = grm(args)
|
||||||
|
|
||||||
assert cmd.returncode == 0
|
assert cmd.returncode == 0
|
||||||
assert len(cmd.stderr) == 0
|
assert "did not specify any filters" in cmd.stderr.lower()
|
||||||
|
|
||||||
if default or configtype == "toml":
|
if default or configtype == "toml":
|
||||||
output = toml.loads(cmd.stdout)
|
output = toml.loads(cmd.stdout)
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ pub struct ConfigTrees {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct ConfigProviderFilter {
|
pub struct ConfigProviderFilter {
|
||||||
pub access: Option<bool>,
|
pub access: Option<bool>,
|
||||||
pub owner: Option<bool>,
|
pub owner: Option<bool>,
|
||||||
@@ -41,6 +42,7 @@ pub struct ConfigProviderFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct ConfigProvider {
|
pub struct ConfigProvider {
|
||||||
pub provider: RemoteProvider,
|
pub provider: RemoteProvider,
|
||||||
pub token_command: String,
|
pub token_command: String,
|
||||||
@@ -181,6 +183,12 @@ impl Config {
|
|||||||
filters.access.unwrap_or(false),
|
filters.access.unwrap_or(false),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if filter.empty() {
|
||||||
|
print_warning(
|
||||||
|
"The configuration does not contain any filters, so no repos will match",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
let repos = match config.provider {
|
let repos = match config.provider {
|
||||||
RemoteProvider::Github => {
|
RemoteProvider::Github => {
|
||||||
match provider::Github::new(filter, token, config.api_url) {
|
match provider::Github::new(filter, token, config.api_url) {
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ fn main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
print_error(&format!("Error syncing trees: {}", error));
|
print_error(&format!("Sync error: {}", error));
|
||||||
process::exit(1);
|
process::exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -55,6 +55,10 @@ fn main() {
|
|||||||
let filter =
|
let filter =
|
||||||
provider::Filter::new(args.users, args.groups, args.owner, args.access);
|
provider::Filter::new(args.users, args.groups, args.owner, args.access);
|
||||||
|
|
||||||
|
if filter.empty() {
|
||||||
|
print_warning("You did not specify any filters, so no repos will match");
|
||||||
|
}
|
||||||
|
|
||||||
let worktree = args.worktree == "true";
|
let worktree = args.worktree == "true";
|
||||||
|
|
||||||
let repos = match args.provider {
|
let repos = match args.provider {
|
||||||
@@ -62,7 +66,7 @@ fn main() {
|
|||||||
match provider::Github::new(filter, token, args.api_url) {
|
match provider::Github::new(filter, token, args.api_url) {
|
||||||
Ok(provider) => provider,
|
Ok(provider) => provider,
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
print_error(&format!("Error: {}", error));
|
print_error(&format!("Sync error: {}", error));
|
||||||
process::exit(1);
|
process::exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -76,7 +80,7 @@ fn main() {
|
|||||||
match provider::Gitlab::new(filter, token, args.api_url) {
|
match provider::Gitlab::new(filter, token, args.api_url) {
|
||||||
Ok(provider) => provider,
|
Ok(provider) => provider,
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
print_error(&format!("Error: {}", error));
|
print_error(&format!("Sync error: {}", error));
|
||||||
process::exit(1);
|
process::exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -112,13 +116,13 @@ fn main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
print_error(&format!("Error syncing trees: {}", error));
|
print_error(&format!("Sync error: {}", error));
|
||||||
process::exit(1);
|
process::exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
print_error(&format!("Error: {}", error));
|
print_error(&format!("Sync error: {}", error));
|
||||||
process::exit(1);
|
process::exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -278,6 +282,10 @@ fn main() {
|
|||||||
filters.access.unwrap_or(false),
|
filters.access.unwrap_or(false),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if filter.empty() {
|
||||||
|
print_warning("You did not specify any filters, so no repos will match");
|
||||||
|
}
|
||||||
|
|
||||||
let repos = match config.provider {
|
let repos = match config.provider {
|
||||||
provider::RemoteProvider::Github => {
|
provider::RemoteProvider::Github => {
|
||||||
match match provider::Github::new(filter, token, config.api_url) {
|
match match provider::Github::new(filter, token, config.api_url) {
|
||||||
@@ -383,6 +391,10 @@ fn main() {
|
|||||||
let filter =
|
let filter =
|
||||||
provider::Filter::new(args.users, args.groups, args.owner, args.access);
|
provider::Filter::new(args.users, args.groups, args.owner, args.access);
|
||||||
|
|
||||||
|
if filter.empty() {
|
||||||
|
print_warning("You did not specify any filters, so no repos will match");
|
||||||
|
}
|
||||||
|
|
||||||
let worktree = args.worktree == "true";
|
let worktree = args.worktree == "true";
|
||||||
|
|
||||||
let repos = match args.provider {
|
let repos = match args.provider {
|
||||||
|
|||||||
@@ -89,6 +89,10 @@ impl Filter {
|
|||||||
access,
|
access,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn empty(&self) -> bool {
|
||||||
|
self.users.is_empty() && self.groups.is_empty() && !self.owner && !self.access
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum ApiErrorResponse<T>
|
pub enum ApiErrorResponse<T>
|
||||||
@@ -270,11 +274,15 @@ pub trait Provider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for group in &self.filter().groups {
|
for group in &self.filter().groups {
|
||||||
let group_projects = self
|
let group_projects = self.get_group_projects(group).map_err(|error| {
|
||||||
.get_group_projects(group)
|
format!(
|
||||||
.map_err(|error| match error {
|
"group \"{}\": {}",
|
||||||
|
group,
|
||||||
|
match error {
|
||||||
ApiErrorResponse::Json(x) => x.to_string(),
|
ApiErrorResponse::Json(x) => x.to_string(),
|
||||||
ApiErrorResponse::String(s) => s,
|
ApiErrorResponse::String(s) => s,
|
||||||
|
}
|
||||||
|
)
|
||||||
})?;
|
})?;
|
||||||
for group_project in group_projects {
|
for group_project in group_projects {
|
||||||
let mut already_present = false;
|
let mut already_present = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user