pub struct RepositorySet { /* private fields */ }Implementations§
Source§impl RepositorySet
impl RepositorySet
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn id(&self, name: &str) -> Option<RepositoryId>
pub fn name(&self, id: RepositoryId) -> Option<&str>
pub fn repository(&self, id: RepositoryId) -> Option<&Repository>
pub fn resolve(&self, id: RepositoryId, revision: &str) -> Result<ObjectId>
pub fn find_object(&self, id: ObjectId) -> Vec<RepositoryId>
Sourcepub fn histories(
&self,
options: HistoryOptions,
) -> Result<Vec<RepositoryHistory>>
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 ¶llel,
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}Sourcepub fn histories_parallel(
&self,
options: HistoryOptions,
) -> Result<Vec<RepositoryHistory>>
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 ¶llel,
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}pub fn diff_commits( &self, old_repository: RepositoryId, old_revision: &str, new_repository: RepositoryId, new_revision: &str, ) -> Result<Vec<TreeChange>>
Auto Trait Implementations§
impl !RefUnwindSafe for RepositorySet
impl !UnwindSafe for RepositorySet
impl Freeze for RepositorySet
impl Send for RepositorySet
impl Sync for RepositorySet
impl Unpin for RepositorySet
impl UnsafeUnpin for RepositorySet
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more