|
1 | 1 | use std::fs;
|
2 |
| -use std::path::PathBuf; |
3 | 2 | use std::path::Path;
|
| 3 | +use std::path::PathBuf; |
4 | 4 | use std::process::Command;
|
5 | 5 |
|
6 | 6 | pub fn get_repositories(path: &Path) -> Vec<PathBuf> {
|
@@ -40,24 +40,28 @@ pub fn git_current_branch(repository: PathBuf) -> String {
|
40 | 40 | output
|
41 | 41 | }
|
42 | 42 |
|
43 |
| -pub fn sync_repositories_to_branch(repositories: &[PathBuf], branch: &str) { |
44 |
| - for repository in repositories { |
45 |
| - let repo_name = repository.file_name().unwrap().to_str().unwrap(); |
| 43 | +pub fn sync_repository_to_branch(repository: PathBuf, branch: &str) { |
| 44 | + let repo_name = repository.file_name().unwrap().to_str().unwrap(); |
46 | 45 |
|
47 |
| - println!("!> Syncing repository: [{}]", repo_name); |
| 46 | + println!("!> Syncing repository: [{}]", repo_name); |
48 | 47 |
|
49 |
| - println!("\t!> Running git fetch"); |
50 |
| - git_fetch(repository.to_path_buf()); |
| 48 | + println!("\t!> Running git fetch"); |
| 49 | + git_fetch(repository.to_path_buf()); |
51 | 50 |
|
52 |
| - println!("\t!> Running git stash"); |
53 |
| - git_stash(repository.to_path_buf()); |
| 51 | + println!("\t!> Running git stash"); |
| 52 | + git_stash(repository.to_path_buf()); |
54 | 53 |
|
55 |
| - println!("\t!> Running git checkout {}", &branch); |
56 |
| - git_checkout(repository.to_path_buf(), branch.to_string()); |
| 54 | + println!("\t!> Running git checkout {}", &branch); |
| 55 | + git_checkout(repository.to_path_buf(), branch.to_string()); |
57 | 56 |
|
58 |
| - println!("\t!> Running git pull"); |
59 |
| - git_pull(repository.to_path_buf()); |
60 |
| - println!("\n"); |
| 57 | + println!("\t!> Running git pull"); |
| 58 | + git_pull(repository.to_path_buf()); |
| 59 | + println!("\n"); |
| 60 | +} |
| 61 | + |
| 62 | +pub fn sync_repositories_to_branch(repositories: &[PathBuf], branch: &str) { |
| 63 | + for repository in repositories { |
| 64 | + sync_repository_to_branch(repository.to_path_buf(), branch) |
61 | 65 | }
|
62 | 66 | }
|
63 | 67 |
|
|
0 commit comments