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
pub mod git;
pub mod hg;
pub mod util;
use std::path::Path;
use super::metadata::Proxy;
pub trait Vcs {
fn clone(&self, url: &str, path: &Path, bare: bool, proxy: Option<&Proxy>);
fn update(&self, path: &Path, bare: bool, proxy: Option<&Proxy>);
}
pub fn clone(vcs: &str, url: &str, path: &Path, bare: bool, proxy: Option<&Proxy>) {
match vcs {
"git" => git::Git::new().clone(url, path, bare, proxy),
"hg" => hg::Hg::new().clone(url, path, bare, proxy),
_ => println!("Unsupported vcs '{}'.", vcs),
}
}
pub fn update(vcs: &str, path: &Path, bare: bool, proxy: Option<&Proxy>) {
match vcs {
"git" => git::Git::new().update(path, bare, proxy),
"hg" => hg::Hg::new().update(path, bare, proxy),
_ => println!("Unsupported vcs '{}'.", vcs),
}
}