@@ -39,12 +39,37 @@ pub mod engine {
39
39
40
40
/// Run on the existing set of repositories we have already seen or obtain them from `path` if there is none yet.
41
41
pub fn run ( & mut self , corpus_path : PathBuf ) -> anyhow:: Result < ( ) > {
42
+ let ( corpus_path, corpus_id) = self . prepare_corpus_path ( corpus_path) ?;
43
+ let gitoxide_id = self . gitoxide_version_id_or_insert ( ) ?;
44
+ let runner_id = self . runner_id_or_insert ( ) ?;
45
+ let repos = self . find_repos_or_insert ( & corpus_path, corpus_id) ?;
46
+ self . perform_run ( gitoxide_id, runner_id, repos)
47
+ }
48
+
49
+ pub fn refresh ( & mut self , corpus_path : PathBuf ) -> anyhow:: Result < ( ) > {
50
+ let ( corpus_path, corpus_id) = self . prepare_corpus_path ( corpus_path) ?;
51
+ let repos = self . refresh_repos ( & corpus_path, corpus_id) ?;
52
+ self . progress . set_name ( "refresh repos" ) ;
53
+ self . progress . info ( format ! (
54
+ "Added or updated {} repositories under {corpus_path:?}" ,
55
+ repos. len( )
56
+ ) ) ;
57
+ Ok ( ( ) )
58
+ }
59
+ }
60
+
61
+ impl < P > Engine < P >
62
+ where
63
+ P : gix:: Progress ,
64
+ {
65
+ fn perform_run ( & self , _gitoxide_id : Id , _runner_id : Id , _repos : Vec < db:: Repo > ) -> anyhow:: Result < ( ) > {
66
+ todo ! ( )
67
+ }
68
+
69
+ fn prepare_corpus_path ( & self , corpus_path : PathBuf ) -> anyhow:: Result < ( PathBuf , Id ) > {
42
70
let corpus_path = gix:: path:: realpath ( corpus_path) ?;
43
71
let corpus_id = self . corpus_id_or_insert ( & corpus_path) ?;
44
- let _gitoxide_id = self . gitoxide_version_id_or_insert ( ) ?;
45
- let _runner_id = self . runner_id_or_insert ( ) ?;
46
- let _repos = self . find_repos_or_insert ( & corpus_path, corpus_id) ?;
47
- todo ! ( "do run on repos" )
72
+ Ok ( ( corpus_path, corpus_id) )
48
73
}
49
74
50
75
fn find_repos ( & mut self , corpus_id : Id ) -> anyhow:: Result < Vec < db:: Repo > > {
0 commit comments