|
7 | 7 | // TODO remove code once gleisbau API has stabilized |
8 | 8 | // Some of these features might return to the CLI tool (this application) |
9 | 9 | //mod config; |
10 | | -//mod print; |
| 10 | +mod print; |
11 | 11 |
|
| 12 | +use crate::print::svg::print_svg; |
12 | 13 | use clap::ArgMatches; |
13 | 14 | use clap::{crate_version, Arg, Command}; |
14 | 15 | use git2::Repository; |
15 | | -use gleisbau::config::{ |
16 | | - create_config, get_available_models, get_model, get_model_name, set_model, |
17 | | -}; |
| 16 | +use gleisbau::config::{create_config, get_available_models, get_model, get_model_name, set_model}; |
18 | 17 | use gleisbau::get_repo; |
19 | | -use gleisbau::graph::GitGraph; |
| 18 | +use gleisbau::graph::Builder as GraphBuilder; |
20 | 19 | use gleisbau::print::format::CommitFormat; |
21 | | -use gleisbau::print::svg::print_svg; |
22 | 20 | use gleisbau::print::unicode::print_unicode; |
23 | 21 | use gleisbau::settings::{ |
24 | 22 | BranchOrder, BranchSettings, BranchSettingsDef, Characters, MergePatterns, Settings, |
@@ -621,7 +619,14 @@ fn run( |
621 | 619 | refspecs: Vec<String>, |
622 | 620 | ) -> Result<(), String> { |
623 | 621 | let now = Instant::now(); |
624 | | - let graph = GitGraph::new(repository, settings, None, max_commits, refspecs)?; |
| 622 | + let mut graph_builder = GraphBuilder::new() |
| 623 | + .with_repository(repository) |
| 624 | + .with_settings(settings) |
| 625 | + .with_refspecs(refspecs); |
| 626 | + if let Some(max_commits) = max_commits { |
| 627 | + graph_builder = graph_builder.with_max_count(max_commits); |
| 628 | + } |
| 629 | + let graph = graph_builder.build()?; |
625 | 630 |
|
626 | 631 | let duration_graph = now.elapsed().as_micros(); |
627 | 632 |
|
|
0 commit comments