Skip to main content

Repository

Struct Repository 

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

Implementations§

Source§

impl Repository

Source

pub fn multi_pack_index_count(&self) -> usize

Source

pub fn commit_graph_layer_count(&self) -> usize

Source

pub fn commit_maybe_changed_path( &self, id: ObjectId, path: impl AsRef<[u8]>, ) -> Result<Option<PathBloom>>

Source

pub fn bitmap_reachable( &self, commit: ObjectId, ) -> Result<Option<Vec<ObjectId>>>

Examples found in repository?
examples/benchmark_storage.rs (line 24)
11fn main() -> Result<(), Box<dyn std::error::Error>> {
12    let args = env::args().skip(1).collect::<Vec<_>>();
13    let path = args.first().map_or(".", String::as_str);
14    let iterations = args
15        .get(1)
16        .map(|value| value.parse())
17        .transpose()?
18        .unwrap_or(50);
19    let repository = Repository::open(path)?;
20    let head = repository.resolve("HEAD")?;
21
22    let expected_objects = git_object_ids(path)?;
23    let actual_objects = repository
24        .bitmap_reachable(head)?
25        .ok_or("repository has no reachability bitmap")?
26        .into_iter()
27        .map(|id| id.to_string())
28        .collect::<BTreeSet<_>>();
29    if actual_objects != expected_objects {
30        return Err("bitmap reachability differs from git rev-list --objects".into());
31    }
32    let expected_paths = git_paths(path)?;
33    let actual_paths = repository
34        .index()?
35        .entries()
36        .iter()
37        .map(|entry| entry.path.clone())
38        .collect::<Vec<_>>();
39    if actual_paths != expected_paths {
40        return Err("index paths differ from git ls-files".into());
41    }
42    let expected_status = git_status(path)?;
43    let actual_status = repository.status()?;
44    if !expected_status.is_empty() || !actual_status.is_empty() {
45        return Err(format!(
46            "status benchmark requires a clean tracked worktree (git={} bytes, weavatrix={actual_status:?})",
47            expected_status.len()
48        )
49        .into());
50    }
51
52    println!("operation,engine,p50_ms,p95_ms,items");
53    row(
54        "reachability",
55        "weavatrix-git",
56        &measure(iterations, || {
57            repository
58                .bitmap_reachable(head)
59                .map(|value| value.map_or(0, |ids| ids.len()))
60        })?,
61        actual_objects.len(),
62    );
63    row(
64        "reachability",
65        "git.exe",
66        &measure(iterations, || git_object_ids(path).map(|ids| ids.len()))?,
67        expected_objects.len(),
68    );
69    row(
70        "index",
71        "weavatrix-git",
72        &measure(iterations, || {
73            repository.index().map(|index| index.entries().len())
74        })?,
75        actual_paths.len(),
76    );
77    row(
78        "index",
79        "git.exe",
80        &measure(iterations, || git_paths(path).map(|paths| paths.len()))?,
81        expected_paths.len(),
82    );
83    row(
84        "tracked-status",
85        "weavatrix-git",
86        &measure(iterations, || {
87            repository.status().map(|entries| entries.len())
88        })?,
89        0,
90    );
91    row(
92        "tracked-status",
93        "git.exe",
94        &measure(iterations, || git_status(path).map(|entries| entries.len()))?,
95        0,
96    );
97    row(
98        "cached-commit",
99        "weavatrix-git",
100        &measure(iterations, || repository.commit(head).map(|_| 1))?,
101        1,
102    );
103    row(
104        "cached-commit",
105        "git.exe",
106        &measure(iterations, || git_exists(path, &head.to_string()))?,
107        1,
108    );
109    Ok(())
110}
Source

pub fn objects_parallel(&self, ids: &[ObjectId]) -> Vec<Result<Object>>

Source

pub fn commit_metadata_parallel( &self, ids: &[ObjectId], ) -> Vec<Result<CommitMetadata>>

Source§

impl Repository

Source

pub fn index(&self) -> Result<Index>

Examples found in repository?
examples/benchmark_storage.rs (line 34)
11fn main() -> Result<(), Box<dyn std::error::Error>> {
12    let args = env::args().skip(1).collect::<Vec<_>>();
13    let path = args.first().map_or(".", String::as_str);
14    let iterations = args
15        .get(1)
16        .map(|value| value.parse())
17        .transpose()?
18        .unwrap_or(50);
19    let repository = Repository::open(path)?;
20    let head = repository.resolve("HEAD")?;
21
22    let expected_objects = git_object_ids(path)?;
23    let actual_objects = repository
24        .bitmap_reachable(head)?
25        .ok_or("repository has no reachability bitmap")?
26        .into_iter()
27        .map(|id| id.to_string())
28        .collect::<BTreeSet<_>>();
29    if actual_objects != expected_objects {
30        return Err("bitmap reachability differs from git rev-list --objects".into());
31    }
32    let expected_paths = git_paths(path)?;
33    let actual_paths = repository
34        .index()?
35        .entries()
36        .iter()
37        .map(|entry| entry.path.clone())
38        .collect::<Vec<_>>();
39    if actual_paths != expected_paths {
40        return Err("index paths differ from git ls-files".into());
41    }
42    let expected_status = git_status(path)?;
43    let actual_status = repository.status()?;
44    if !expected_status.is_empty() || !actual_status.is_empty() {
45        return Err(format!(
46            "status benchmark requires a clean tracked worktree (git={} bytes, weavatrix={actual_status:?})",
47            expected_status.len()
48        )
49        .into());
50    }
51
52    println!("operation,engine,p50_ms,p95_ms,items");
53    row(
54        "reachability",
55        "weavatrix-git",
56        &measure(iterations, || {
57            repository
58                .bitmap_reachable(head)
59                .map(|value| value.map_or(0, |ids| ids.len()))
60        })?,
61        actual_objects.len(),
62    );
63    row(
64        "reachability",
65        "git.exe",
66        &measure(iterations, || git_object_ids(path).map(|ids| ids.len()))?,
67        expected_objects.len(),
68    );
69    row(
70        "index",
71        "weavatrix-git",
72        &measure(iterations, || {
73            repository.index().map(|index| index.entries().len())
74        })?,
75        actual_paths.len(),
76    );
77    row(
78        "index",
79        "git.exe",
80        &measure(iterations, || git_paths(path).map(|paths| paths.len()))?,
81        expected_paths.len(),
82    );
83    row(
84        "tracked-status",
85        "weavatrix-git",
86        &measure(iterations, || {
87            repository.status().map(|entries| entries.len())
88        })?,
89        0,
90    );
91    row(
92        "tracked-status",
93        "git.exe",
94        &measure(iterations, || git_status(path).map(|entries| entries.len()))?,
95        0,
96    );
97    row(
98        "cached-commit",
99        "weavatrix-git",
100        &measure(iterations, || repository.commit(head).map(|_| 1))?,
101        1,
102    );
103    row(
104        "cached-commit",
105        "git.exe",
106        &measure(iterations, || git_exists(path, &head.to_string()))?,
107        1,
108    );
109    Ok(())
110}
Source

pub fn index_shared(&self) -> Result<Arc<Index>>

Source§

impl Repository

Source

pub fn reflog(&self, name: &str) -> Result<Vec<ReflogEntry>>

Source§

impl Repository

Source

pub fn open(path: impl AsRef<Path>) -> Result<Self>

Examples found in repository?
examples/benchmark.rs (line 16)
10fn main() -> Result<(), Box<dyn std::error::Error>> {
11    let args = env::args().skip(1).collect::<Vec<_>>();
12    let path = args.first().map_or(".", String::as_str);
13    let max_count = parse(&args, 1, 500)?;
14    let iterations = parse(&args, 2, 20)?;
15    let expected = git_ids(path, max_count)?;
16    let repository = Repository::open(path)?;
17    let start = repository.resolve("HEAD")?;
18    let options = HistoryOptions {
19        max_commits: max_count,
20        first_parent: true,
21        ..HistoryOptions::default()
22    };
23    let actual = repository
24        .history_ids(start, options)?
25        .into_iter()
26        .map(|id| id.to_string())
27        .collect::<Vec<_>>();
28    if actual != expected {
29        return Err("history identifiers differ from git rev-list".into());
30    }
31
32    let warm = measure(iterations, || {
33        repository
34            .history_ids(start, options)
35            .map(|identifiers| identifiers.len())
36    })?;
37    let reopen = measure(iterations, || {
38        let repo = Repository::open(path)?;
39        repo.history_ids(repo.resolve("HEAD")?, options)
40            .map(|identifiers| identifiers.len())
41    })?;
42    let git = measure(iterations, || git_ids(path, max_count).map(|ids| ids.len()))?;
43    println!("engine,mode,p50_ms,p95_ms,commits");
44    print_row("weavatrix-git", "warm", &warm, actual.len());
45    print_row("weavatrix-git", "reopen", &reopen, actual.len());
46    print_row("git.exe", "process", &git, expected.len());
47    Ok(())
48}
More examples
Hide additional examples
examples/benchmark_storage.rs (line 19)
11fn main() -> Result<(), Box<dyn std::error::Error>> {
12    let args = env::args().skip(1).collect::<Vec<_>>();
13    let path = args.first().map_or(".", String::as_str);
14    let iterations = args
15        .get(1)
16        .map(|value| value.parse())
17        .transpose()?
18        .unwrap_or(50);
19    let repository = Repository::open(path)?;
20    let head = repository.resolve("HEAD")?;
21
22    let expected_objects = git_object_ids(path)?;
23    let actual_objects = repository
24        .bitmap_reachable(head)?
25        .ok_or("repository has no reachability bitmap")?
26        .into_iter()
27        .map(|id| id.to_string())
28        .collect::<BTreeSet<_>>();
29    if actual_objects != expected_objects {
30        return Err("bitmap reachability differs from git rev-list --objects".into());
31    }
32    let expected_paths = git_paths(path)?;
33    let actual_paths = repository
34        .index()?
35        .entries()
36        .iter()
37        .map(|entry| entry.path.clone())
38        .collect::<Vec<_>>();
39    if actual_paths != expected_paths {
40        return Err("index paths differ from git ls-files".into());
41    }
42    let expected_status = git_status(path)?;
43    let actual_status = repository.status()?;
44    if !expected_status.is_empty() || !actual_status.is_empty() {
45        return Err(format!(
46            "status benchmark requires a clean tracked worktree (git={} bytes, weavatrix={actual_status:?})",
47            expected_status.len()
48        )
49        .into());
50    }
51
52    println!("operation,engine,p50_ms,p95_ms,items");
53    row(
54        "reachability",
55        "weavatrix-git",
56        &measure(iterations, || {
57            repository
58                .bitmap_reachable(head)
59                .map(|value| value.map_or(0, |ids| ids.len()))
60        })?,
61        actual_objects.len(),
62    );
63    row(
64        "reachability",
65        "git.exe",
66        &measure(iterations, || git_object_ids(path).map(|ids| ids.len()))?,
67        expected_objects.len(),
68    );
69    row(
70        "index",
71        "weavatrix-git",
72        &measure(iterations, || {
73            repository.index().map(|index| index.entries().len())
74        })?,
75        actual_paths.len(),
76    );
77    row(
78        "index",
79        "git.exe",
80        &measure(iterations, || git_paths(path).map(|paths| paths.len()))?,
81        expected_paths.len(),
82    );
83    row(
84        "tracked-status",
85        "weavatrix-git",
86        &measure(iterations, || {
87            repository.status().map(|entries| entries.len())
88        })?,
89        0,
90    );
91    row(
92        "tracked-status",
93        "git.exe",
94        &measure(iterations, || git_status(path).map(|entries| entries.len()))?,
95        0,
96    );
97    row(
98        "cached-commit",
99        "weavatrix-git",
100        &measure(iterations, || repository.commit(head).map(|_| 1))?,
101        1,
102    );
103    row(
104        "cached-commit",
105        "git.exe",
106        &measure(iterations, || git_exists(path, &head.to_string()))?,
107        1,
108    );
109    Ok(())
110}
Source

pub fn open_with_limits(path: impl AsRef<Path>, limits: Limits) -> Result<Self>

Source

pub fn open_with_backends( path: impl AsRef<Path>, limits: Limits, backends: Vec<Arc<dyn ObjectBackend>>, ) -> Result<Self>

Source

pub fn work_dir(&self) -> Option<&Path>

Source

pub fn git_dir(&self) -> &Path

Source

pub fn common_dir(&self) -> &Path

Source

pub const fn hash_kind(&self) -> HashKind

Source

pub const fn limits(&self) -> &Limits

Source

pub fn pack_count(&self) -> usize

Source

pub fn head(&self) -> Result<Head>

Source

pub fn reference(&self, name: &str) -> Result<Reference>

Source

pub fn resolve(&self, value: &str) -> Result<ObjectId>

Examples found in repository?
examples/benchmark.rs (line 17)
10fn main() -> Result<(), Box<dyn std::error::Error>> {
11    let args = env::args().skip(1).collect::<Vec<_>>();
12    let path = args.first().map_or(".", String::as_str);
13    let max_count = parse(&args, 1, 500)?;
14    let iterations = parse(&args, 2, 20)?;
15    let expected = git_ids(path, max_count)?;
16    let repository = Repository::open(path)?;
17    let start = repository.resolve("HEAD")?;
18    let options = HistoryOptions {
19        max_commits: max_count,
20        first_parent: true,
21        ..HistoryOptions::default()
22    };
23    let actual = repository
24        .history_ids(start, options)?
25        .into_iter()
26        .map(|id| id.to_string())
27        .collect::<Vec<_>>();
28    if actual != expected {
29        return Err("history identifiers differ from git rev-list".into());
30    }
31
32    let warm = measure(iterations, || {
33        repository
34            .history_ids(start, options)
35            .map(|identifiers| identifiers.len())
36    })?;
37    let reopen = measure(iterations, || {
38        let repo = Repository::open(path)?;
39        repo.history_ids(repo.resolve("HEAD")?, options)
40            .map(|identifiers| identifiers.len())
41    })?;
42    let git = measure(iterations, || git_ids(path, max_count).map(|ids| ids.len()))?;
43    println!("engine,mode,p50_ms,p95_ms,commits");
44    print_row("weavatrix-git", "warm", &warm, actual.len());
45    print_row("weavatrix-git", "reopen", &reopen, actual.len());
46    print_row("git.exe", "process", &git, expected.len());
47    Ok(())
48}
More examples
Hide additional examples
examples/benchmark_storage.rs (line 20)
11fn main() -> Result<(), Box<dyn std::error::Error>> {
12    let args = env::args().skip(1).collect::<Vec<_>>();
13    let path = args.first().map_or(".", String::as_str);
14    let iterations = args
15        .get(1)
16        .map(|value| value.parse())
17        .transpose()?
18        .unwrap_or(50);
19    let repository = Repository::open(path)?;
20    let head = repository.resolve("HEAD")?;
21
22    let expected_objects = git_object_ids(path)?;
23    let actual_objects = repository
24        .bitmap_reachable(head)?
25        .ok_or("repository has no reachability bitmap")?
26        .into_iter()
27        .map(|id| id.to_string())
28        .collect::<BTreeSet<_>>();
29    if actual_objects != expected_objects {
30        return Err("bitmap reachability differs from git rev-list --objects".into());
31    }
32    let expected_paths = git_paths(path)?;
33    let actual_paths = repository
34        .index()?
35        .entries()
36        .iter()
37        .map(|entry| entry.path.clone())
38        .collect::<Vec<_>>();
39    if actual_paths != expected_paths {
40        return Err("index paths differ from git ls-files".into());
41    }
42    let expected_status = git_status(path)?;
43    let actual_status = repository.status()?;
44    if !expected_status.is_empty() || !actual_status.is_empty() {
45        return Err(format!(
46            "status benchmark requires a clean tracked worktree (git={} bytes, weavatrix={actual_status:?})",
47            expected_status.len()
48        )
49        .into());
50    }
51
52    println!("operation,engine,p50_ms,p95_ms,items");
53    row(
54        "reachability",
55        "weavatrix-git",
56        &measure(iterations, || {
57            repository
58                .bitmap_reachable(head)
59                .map(|value| value.map_or(0, |ids| ids.len()))
60        })?,
61        actual_objects.len(),
62    );
63    row(
64        "reachability",
65        "git.exe",
66        &measure(iterations, || git_object_ids(path).map(|ids| ids.len()))?,
67        expected_objects.len(),
68    );
69    row(
70        "index",
71        "weavatrix-git",
72        &measure(iterations, || {
73            repository.index().map(|index| index.entries().len())
74        })?,
75        actual_paths.len(),
76    );
77    row(
78        "index",
79        "git.exe",
80        &measure(iterations, || git_paths(path).map(|paths| paths.len()))?,
81        expected_paths.len(),
82    );
83    row(
84        "tracked-status",
85        "weavatrix-git",
86        &measure(iterations, || {
87            repository.status().map(|entries| entries.len())
88        })?,
89        0,
90    );
91    row(
92        "tracked-status",
93        "git.exe",
94        &measure(iterations, || git_status(path).map(|entries| entries.len()))?,
95        0,
96    );
97    row(
98        "cached-commit",
99        "weavatrix-git",
100        &measure(iterations, || repository.commit(head).map(|_| 1))?,
101        1,
102    );
103    row(
104        "cached-commit",
105        "git.exe",
106        &measure(iterations, || git_exists(path, &head.to_string()))?,
107        1,
108    );
109    Ok(())
110}
Source

pub fn object(&self, id: ObjectId) -> Result<Object>

Source

pub fn contains(&self, id: ObjectId) -> bool

Source

pub fn contains_checked(&self, id: ObjectId) -> Result<bool>

Source

pub fn commit(&self, id: ObjectId) -> Result<Commit>

Examples found in repository?
examples/benchmark_storage.rs (line 100)
11fn main() -> Result<(), Box<dyn std::error::Error>> {
12    let args = env::args().skip(1).collect::<Vec<_>>();
13    let path = args.first().map_or(".", String::as_str);
14    let iterations = args
15        .get(1)
16        .map(|value| value.parse())
17        .transpose()?
18        .unwrap_or(50);
19    let repository = Repository::open(path)?;
20    let head = repository.resolve("HEAD")?;
21
22    let expected_objects = git_object_ids(path)?;
23    let actual_objects = repository
24        .bitmap_reachable(head)?
25        .ok_or("repository has no reachability bitmap")?
26        .into_iter()
27        .map(|id| id.to_string())
28        .collect::<BTreeSet<_>>();
29    if actual_objects != expected_objects {
30        return Err("bitmap reachability differs from git rev-list --objects".into());
31    }
32    let expected_paths = git_paths(path)?;
33    let actual_paths = repository
34        .index()?
35        .entries()
36        .iter()
37        .map(|entry| entry.path.clone())
38        .collect::<Vec<_>>();
39    if actual_paths != expected_paths {
40        return Err("index paths differ from git ls-files".into());
41    }
42    let expected_status = git_status(path)?;
43    let actual_status = repository.status()?;
44    if !expected_status.is_empty() || !actual_status.is_empty() {
45        return Err(format!(
46            "status benchmark requires a clean tracked worktree (git={} bytes, weavatrix={actual_status:?})",
47            expected_status.len()
48        )
49        .into());
50    }
51
52    println!("operation,engine,p50_ms,p95_ms,items");
53    row(
54        "reachability",
55        "weavatrix-git",
56        &measure(iterations, || {
57            repository
58                .bitmap_reachable(head)
59                .map(|value| value.map_or(0, |ids| ids.len()))
60        })?,
61        actual_objects.len(),
62    );
63    row(
64        "reachability",
65        "git.exe",
66        &measure(iterations, || git_object_ids(path).map(|ids| ids.len()))?,
67        expected_objects.len(),
68    );
69    row(
70        "index",
71        "weavatrix-git",
72        &measure(iterations, || {
73            repository.index().map(|index| index.entries().len())
74        })?,
75        actual_paths.len(),
76    );
77    row(
78        "index",
79        "git.exe",
80        &measure(iterations, || git_paths(path).map(|paths| paths.len()))?,
81        expected_paths.len(),
82    );
83    row(
84        "tracked-status",
85        "weavatrix-git",
86        &measure(iterations, || {
87            repository.status().map(|entries| entries.len())
88        })?,
89        0,
90    );
91    row(
92        "tracked-status",
93        "git.exe",
94        &measure(iterations, || git_status(path).map(|entries| entries.len()))?,
95        0,
96    );
97    row(
98        "cached-commit",
99        "weavatrix-git",
100        &measure(iterations, || repository.commit(head).map(|_| 1))?,
101        1,
102    );
103    row(
104        "cached-commit",
105        "git.exe",
106        &measure(iterations, || git_exists(path, &head.to_string()))?,
107        1,
108    );
109    Ok(())
110}
Source

pub fn commit_metadata(&self, id: ObjectId) -> Result<CommitMetadata>

Source

pub fn tree(&self, id: ObjectId) -> Result<Tree>

Source

pub fn tag(&self, id: ObjectId) -> Result<Tag>

Source

pub fn history( &self, start: ObjectId, options: HistoryOptions, ) -> Result<Vec<HistoryRecord>>

Source

pub fn history_ids( &self, start: ObjectId, options: HistoryOptions, ) -> Result<Vec<ObjectId>>

Examples found in repository?
examples/benchmark.rs (line 24)
10fn main() -> Result<(), Box<dyn std::error::Error>> {
11    let args = env::args().skip(1).collect::<Vec<_>>();
12    let path = args.first().map_or(".", String::as_str);
13    let max_count = parse(&args, 1, 500)?;
14    let iterations = parse(&args, 2, 20)?;
15    let expected = git_ids(path, max_count)?;
16    let repository = Repository::open(path)?;
17    let start = repository.resolve("HEAD")?;
18    let options = HistoryOptions {
19        max_commits: max_count,
20        first_parent: true,
21        ..HistoryOptions::default()
22    };
23    let actual = repository
24        .history_ids(start, options)?
25        .into_iter()
26        .map(|id| id.to_string())
27        .collect::<Vec<_>>();
28    if actual != expected {
29        return Err("history identifiers differ from git rev-list".into());
30    }
31
32    let warm = measure(iterations, || {
33        repository
34            .history_ids(start, options)
35            .map(|identifiers| identifiers.len())
36    })?;
37    let reopen = measure(iterations, || {
38        let repo = Repository::open(path)?;
39        repo.history_ids(repo.resolve("HEAD")?, options)
40            .map(|identifiers| identifiers.len())
41    })?;
42    let git = measure(iterations, || git_ids(path, max_count).map(|ids| ids.len()))?;
43    println!("engine,mode,p50_ms,p95_ms,commits");
44    print_row("weavatrix-git", "warm", &warm, actual.len());
45    print_row("weavatrix-git", "reopen", &reopen, actual.len());
46    print_row("git.exe", "process", &git, expected.len());
47    Ok(())
48}
Source

pub fn diff_trees( &self, old: ObjectId, new: ObjectId, ) -> Result<Vec<TreeChange>>

Source

pub fn diff_commits( &self, old: ObjectId, new: ObjectId, ) -> Result<Vec<TreeChange>>

Source§

impl Repository

Source

pub fn revwalk(&self) -> RevWalk<'_>

Source§

impl Repository

Source

pub fn snapshot(&self, revision: &str) -> Result<CommitSnapshot>

Source

pub fn tree_manifest(&self, tree: ObjectId) -> Result<Vec<SnapshotEntry>>

Source§

impl Repository

Source

pub fn status(&self) -> Result<Vec<StatusEntry>>

Examples found in repository?
examples/benchmark_storage.rs (line 43)
11fn main() -> Result<(), Box<dyn std::error::Error>> {
12    let args = env::args().skip(1).collect::<Vec<_>>();
13    let path = args.first().map_or(".", String::as_str);
14    let iterations = args
15        .get(1)
16        .map(|value| value.parse())
17        .transpose()?
18        .unwrap_or(50);
19    let repository = Repository::open(path)?;
20    let head = repository.resolve("HEAD")?;
21
22    let expected_objects = git_object_ids(path)?;
23    let actual_objects = repository
24        .bitmap_reachable(head)?
25        .ok_or("repository has no reachability bitmap")?
26        .into_iter()
27        .map(|id| id.to_string())
28        .collect::<BTreeSet<_>>();
29    if actual_objects != expected_objects {
30        return Err("bitmap reachability differs from git rev-list --objects".into());
31    }
32    let expected_paths = git_paths(path)?;
33    let actual_paths = repository
34        .index()?
35        .entries()
36        .iter()
37        .map(|entry| entry.path.clone())
38        .collect::<Vec<_>>();
39    if actual_paths != expected_paths {
40        return Err("index paths differ from git ls-files".into());
41    }
42    let expected_status = git_status(path)?;
43    let actual_status = repository.status()?;
44    if !expected_status.is_empty() || !actual_status.is_empty() {
45        return Err(format!(
46            "status benchmark requires a clean tracked worktree (git={} bytes, weavatrix={actual_status:?})",
47            expected_status.len()
48        )
49        .into());
50    }
51
52    println!("operation,engine,p50_ms,p95_ms,items");
53    row(
54        "reachability",
55        "weavatrix-git",
56        &measure(iterations, || {
57            repository
58                .bitmap_reachable(head)
59                .map(|value| value.map_or(0, |ids| ids.len()))
60        })?,
61        actual_objects.len(),
62    );
63    row(
64        "reachability",
65        "git.exe",
66        &measure(iterations, || git_object_ids(path).map(|ids| ids.len()))?,
67        expected_objects.len(),
68    );
69    row(
70        "index",
71        "weavatrix-git",
72        &measure(iterations, || {
73            repository.index().map(|index| index.entries().len())
74        })?,
75        actual_paths.len(),
76    );
77    row(
78        "index",
79        "git.exe",
80        &measure(iterations, || git_paths(path).map(|paths| paths.len()))?,
81        expected_paths.len(),
82    );
83    row(
84        "tracked-status",
85        "weavatrix-git",
86        &measure(iterations, || {
87            repository.status().map(|entries| entries.len())
88        })?,
89        0,
90    );
91    row(
92        "tracked-status",
93        "git.exe",
94        &measure(iterations, || git_status(path).map(|entries| entries.len()))?,
95        0,
96    );
97    row(
98        "cached-commit",
99        "weavatrix-git",
100        &measure(iterations, || repository.commit(head).map(|_| 1))?,
101        1,
102    );
103    row(
104        "cached-commit",
105        "git.exe",
106        &measure(iterations, || git_exists(path, &head.to_string()))?,
107        1,
108    );
109    Ok(())
110}
Source§

impl Repository

Source

pub fn object_shared(&self, id: ObjectId) -> Result<Arc<Object>>

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.