aboutsummaryrefslogtreecommitdiff
path: root/apps/servers/octopus/supergit/src/bin/test.rs
blob: 6b9a67b758138dc10bc5a13c669e1778771e1629 (plain)
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
//! A test binary to use during development

use std::sync::mpsc::channel;
use supergit::{BranchCommit, Repository};

fn main() {
    let path = match std::env::args().nth(1) {
        Some(p) => p,
        None => {
            eprintln!("USAGE: supergit-test <path>");
            std::process::exit(2);
        }
    };

    let repo = Repository::open(path.as_str()).unwrap();
    let branches = repo.branches().unwrap();
    let main = branches
        .into_iter()
        .filter(|b| b.name() == Some("master".to_string()))
        .nth(0)
        .unwrap();

    let head = main.get_head();
    let tree = head.get_tree();
    
    println!(
        "{:#?}",
        tree.history(main.get_all(), "Cargo.toml")
            .into_iter()
            .map(|c| c.summary())
            .collect::<Vec<_>>()
    );
}