-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the resolution of the working directory +
Solve the case of file deletion / creation Refactor main.rs
- Loading branch information
Showing
7 changed files
with
56 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Package modifications controller | ||
|
||
Go to the `working_repository` directory and initialize a git repository. | ||
|
||
Changes that you commit will be tracked (on a commit basis) when executing this program. Pass a --reference (-r) argument to indicate the oldest commit, and an optional --last (-l) for the most recent one (HEAD commit by default). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,33 @@ | ||
pub mod args; | ||
pub mod check; | ||
pub mod commit; | ||
pub mod dependencies; | ||
pub mod error; | ||
|
||
use args::get_args; | ||
use git2::Repository; | ||
use std::env::current_dir; | ||
use std::process::exit; | ||
|
||
type Result<T> = std::result::Result<T, error::ModifError>; | ||
|
||
fn main() { | ||
let repo = match Repository::open(".").map_err(|e| error::ModifError::NoRepo(format!("{}", e))) | ||
{ | ||
Ok(repository) => repository, | ||
Err(e) => { | ||
println!("{}", e); | ||
exit(1); | ||
} | ||
}; | ||
let map = match dependencies::create_dep_map(".") { | ||
Ok(map) => map, | ||
Err(e) => { | ||
println!("{}", e); | ||
exit(1); | ||
} | ||
}; | ||
match get_args(&repo) { | ||
Ok((last, reference)) => { | ||
if let Err(e) = check::check_modifs(&repo, last, reference) { | ||
println!("{}", e); | ||
exit(1); | ||
} | ||
} | ||
Err(e) => { | ||
let working_dir = current_dir().unwrap_or_else(|e| { | ||
println!("{}", e); | ||
exit(1); | ||
}); | ||
|
||
let repo = Repository::open(&working_dir).unwrap_or_else(|e| { | ||
println!("{}", e); | ||
exit(1); | ||
}); | ||
let map = dependencies::create_dep_map(&working_dir).unwrap_or_else(|e| { | ||
println!("{}", e); | ||
exit(1); | ||
}); | ||
get_args(&repo) | ||
.and_then(|(last, reference)| check::check_modifs(&repo, last, reference)) | ||
.unwrap_or_else(|e| { | ||
println!("{}", e); | ||
exit(1); | ||
} | ||
}; | ||
}) | ||
} |