Skip to main content

RepositorySet

Struct RepositorySet 

Source
pub struct RepositorySet { /* private fields */ }

Implementations§

Source§

impl RepositorySet

Source

pub fn open<I, S, P>(repositories: I) -> Result<Self>
where I: IntoIterator<Item = (S, P)>, S: Into<String>, P: AsRef<Path>,

Examples found in repository?
examples/benchmark_cross_repo.rs (lines 85-90)
84fn open(paths: &[String]) -> weavatrix_git::Result<RepositorySet> {
85    RepositorySet::open(
86        paths
87            .iter()
88            .enumerate()
89            .map(|(index, path)| (format!("r{index}"), path)),
90    )
91}
Source

pub fn open_parallel<I, S, P>(repositories: I) -> Result<Self>
where I: IntoIterator<Item = (S, P)>, S: Into<String>, P: AsRef<Path>,

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn ids(&self) -> impl ExactSizeIterator<Item = RepositoryId> + '_

Source

pub fn id(&self, name: &str) -> Option<RepositoryId>

Source

pub fn name(&self, id: RepositoryId) -> Option<&str>

Source

pub fn repository(&self, id: RepositoryId) -> Option<&Repository>

Source

pub fn resolve(&self, id: RepositoryId, revision: &str) -> Result<ObjectId>

Source

pub fn find_object(&self, id: ObjectId) -> Vec<RepositoryId>

Source

pub fn histories( &self, options: HistoryOptions, ) -> Result<Vec<RepositoryHistory>>

Examples found in repository?
examples/benchmark_cross_repo.rs (line 38)
10fn main() -> Result<(), Box<dyn std::error::Error>> {
11    let args = env::args().skip(1).collect::<Vec<_>>();
12    if args.len() < 3 {
13        return Err("usage: benchmark_cross_repo <max-count> <iterations> <repo>...".into());
14    }
15    let max_count = args[0].parse()?;
16    let iterations = args[1].parse()?;
17    let paths = &args[2..];
18    let options = HistoryOptions {
19        max_commits: max_count,
20        first_parent: true,
21        ..HistoryOptions::default()
22    };
23    let set = open(paths)?;
24    let expected = git_histories(paths, max_count)?;
25    let actual = set.histories_parallel(options)?;
26    for (history, expected) in actual.iter().zip(&expected) {
27        let actual = history
28            .commits
29            .iter()
30            .map(ToString::to_string)
31            .collect::<Vec<_>>();
32        if actual != *expected {
33            return Err("cross-repository history differs from git rev-list".into());
34        }
35    }
36
37    let serial = measure(iterations, || {
38        set.histories(options).map(|items| item_count(&items))
39    })?;
40    let parallel = measure(iterations, || {
41        set.histories_parallel(options)
42            .map(|items| item_count(&items))
43    })?;
44    let reopen = measure(iterations, || {
45        open(paths)?
46            .histories_parallel(options)
47            .map(|items| item_count(&items))
48    })?;
49    let git = measure(iterations, || {
50        git_histories(paths, max_count).map(|items| items.iter().map(Vec::len).sum::<usize>())
51    })?;
52    println!("engine,mode,p50_ms,p95_ms,repositories,commits");
53    print_row(
54        "weavatrix-git",
55        "serial",
56        &serial,
57        paths.len(),
58        item_count(&actual),
59    );
60    print_row(
61        "weavatrix-git",
62        "parallel",
63        &parallel,
64        paths.len(),
65        item_count(&actual),
66    );
67    print_row(
68        "weavatrix-git",
69        "reopen-parallel",
70        &reopen,
71        paths.len(),
72        item_count(&actual),
73    );
74    print_row(
75        "git.exe",
76        "sequential-processes",
77        &git,
78        paths.len(),
79        item_count(&actual),
80    );
81    Ok(())
82}
Source

pub fn histories_parallel( &self, options: HistoryOptions, ) -> Result<Vec<RepositoryHistory>>

Examples found in repository?
examples/benchmark_cross_repo.rs (line 25)
10fn main() -> Result<(), Box<dyn std::error::Error>> {
11    let args = env::args().skip(1).collect::<Vec<_>>();
12    if args.len() < 3 {
13        return Err("usage: benchmark_cross_repo <max-count> <iterations> <repo>...".into());
14    }
15    let max_count = args[0].parse()?;
16    let iterations = args[1].parse()?;
17    let paths = &args[2..];
18    let options = HistoryOptions {
19        max_commits: max_count,
20        first_parent: true,
21        ..HistoryOptions::default()
22    };
23    let set = open(paths)?;
24    let expected = git_histories(paths, max_count)?;
25    let actual = set.histories_parallel(options)?;
26    for (history, expected) in actual.iter().zip(&expected) {
27        let actual = history
28            .commits
29            .iter()
30            .map(ToString::to_string)
31            .collect::<Vec<_>>();
32        if actual != *expected {
33            return Err("cross-repository history differs from git rev-list".into());
34        }
35    }
36
37    let serial = measure(iterations, || {
38        set.histories(options).map(|items| item_count(&items))
39    })?;
40    let parallel = measure(iterations, || {
41        set.histories_parallel(options)
42            .map(|items| item_count(&items))
43    })?;
44    let reopen = measure(iterations, || {
45        open(paths)?
46            .histories_parallel(options)
47            .map(|items| item_count(&items))
48    })?;
49    let git = measure(iterations, || {
50        git_histories(paths, max_count).map(|items| items.iter().map(Vec::len).sum::<usize>())
51    })?;
52    println!("engine,mode,p50_ms,p95_ms,repositories,commits");
53    print_row(
54        "weavatrix-git",
55        "serial",
56        &serial,
57        paths.len(),
58        item_count(&actual),
59    );
60    print_row(
61        "weavatrix-git",
62        "parallel",
63        &parallel,
64        paths.len(),
65        item_count(&actual),
66    );
67    print_row(
68        "weavatrix-git",
69        "reopen-parallel",
70        &reopen,
71        paths.len(),
72        item_count(&actual),
73    );
74    print_row(
75        "git.exe",
76        "sequential-processes",
77        &git,
78        paths.len(),
79        item_count(&actual),
80    );
81    Ok(())
82}
Source

pub fn shared_commits( &self, options: HistoryOptions, ) -> Result<Vec<SharedCommit>>

Source

pub fn diff_commits( &self, old_repository: RepositoryId, old_revision: &str, new_repository: RepositoryId, new_revision: &str, ) -> Result<Vec<TreeChange>>

Source§

impl RepositorySet

Source

pub fn histories_from( &self, revision: &str, options: HistoryOptions, ) -> Result<Vec<RepositoryHistory>>

Source

pub fn histories_from_parallel( &self, revision: &str, options: HistoryOptions, ) -> Result<Vec<RepositoryHistory>>

Source

pub fn snapshots(&self, revision: &str) -> Result<Vec<RepositorySnapshot>>

Source

pub fn snapshots_parallel( &self, revision: &str, ) -> Result<Vec<RepositorySnapshot>>

Source

pub fn timeline( &self, revision: &str, options: HistoryOptions, ) -> Result<Vec<RepositoryTimelineEntry>>

Source

pub fn shared_commits_from( &self, revision: &str, options: HistoryOptions, ) -> Result<Vec<SharedCommit>>

Source

pub fn changes( &self, old_revision: &str, new_revision: &str, ) -> Result<Vec<RepositoryChangeSet>>

Source

pub fn changes_parallel( &self, old_revision: &str, new_revision: &str, ) -> Result<Vec<RepositoryChangeSet>>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.