1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
use thiserror::Error;
#[derive(Debug)]
pub struct Mirror {
pub origin: String,
pub destination: String,
pub refspec: Option<Vec<String>>,
}
#[derive(Debug, Error)]
pub enum MirrorError {
#[error("data store disconnected")]
Description(String, serde_yaml::Error),
#[error("entry explicitly skiped")]
Skip(String),
}
pub type MirrorResult = Result<Mirror, MirrorError>;
#[derive(Deserialize, Debug)]
struct Desc {
origin: String,
#[serde(default)]
skip: bool,
refspec: Option<Vec<String>>,
}
pub trait Provider {
fn get_mirror_repos(&self) -> Result<Vec<MirrorResult>, String>;
fn get_label(&self) -> String;
}
mod gitlab;
pub use self::gitlab::GitLab;
mod github;
pub use self::github::GitHub;