mirror of
https://github.com/facebook/sapling.git
synced 2024-12-25 14:05:00 +03:00
dag: rename some anyhow::Result
to dag::Result
Summary: Prefix some `Result` with `dag::Result`. Since `dag::Result` is just `anyhow::Result` for now, this does not change anything but makes it more compatible with upcoming changes. Reviewed By: sfilipco Differential Revision: D22883864 fbshipit-source-id: 95a26897ed026f1bb8000b7caddeb461dcaad0e7
This commit is contained in:
parent
ff9c979b07
commit
8d0f48c4da
@ -199,7 +199,7 @@ impl Dag {
|
||||
.insert_many(ctx, self.repo_id, mem_idmap.iter().collect::<Vec<_>>())
|
||||
.await?;
|
||||
|
||||
let get_vertex_parents = |vertex: Vertex| -> Result<Vec<Vertex>> {
|
||||
let get_vertex_parents = |vertex: Vertex| -> dag::Result<Vec<Vertex>> {
|
||||
let cs_id = match mem_idmap.find_changeset_id(vertex) {
|
||||
None => start_state.assignments.get_changeset_id(vertex)?,
|
||||
Some(v) => v,
|
||||
|
@ -147,126 +147,126 @@ impl commits {
|
||||
// Delegate trait implementations to `inner`.
|
||||
|
||||
impl DagAlgorithm for commits {
|
||||
fn sort(&self, set: &Set) -> Result<Set> {
|
||||
fn sort(&self, set: &Set) -> dag::Result<Set> {
|
||||
// commits are used by other Python objects: the other Python objects hold the GIL.
|
||||
let py = unsafe { Python::assume_gil_acquired() };
|
||||
self.inner(py).borrow().sort(set)
|
||||
}
|
||||
|
||||
fn parent_names(&self, name: Vertex) -> Result<Vec<Vertex>> {
|
||||
fn parent_names(&self, name: Vertex) -> dag::Result<Vec<Vertex>> {
|
||||
let py = unsafe { Python::assume_gil_acquired() };
|
||||
self.inner(py).borrow().parent_names(name)
|
||||
}
|
||||
|
||||
fn all(&self) -> Result<Set> {
|
||||
fn all(&self) -> dag::Result<Set> {
|
||||
let py = unsafe { Python::assume_gil_acquired() };
|
||||
self.inner(py).borrow().all()
|
||||
}
|
||||
|
||||
fn ancestors(&self, set: Set) -> Result<Set> {
|
||||
fn ancestors(&self, set: Set) -> dag::Result<Set> {
|
||||
let py = unsafe { Python::assume_gil_acquired() };
|
||||
self.inner(py).borrow().ancestors(set)
|
||||
}
|
||||
|
||||
fn parents(&self, set: Set) -> Result<Set> {
|
||||
fn parents(&self, set: Set) -> dag::Result<Set> {
|
||||
let py = unsafe { Python::assume_gil_acquired() };
|
||||
self.inner(py).borrow().parents(set)
|
||||
}
|
||||
|
||||
fn first_ancestor_nth(&self, name: Vertex, n: u64) -> Result<Vertex> {
|
||||
fn first_ancestor_nth(&self, name: Vertex, n: u64) -> dag::Result<Vertex> {
|
||||
let py = unsafe { Python::assume_gil_acquired() };
|
||||
self.inner(py).borrow().first_ancestor_nth(name, n)
|
||||
}
|
||||
|
||||
fn heads(&self, set: Set) -> Result<Set> {
|
||||
fn heads(&self, set: Set) -> dag::Result<Set> {
|
||||
let py = unsafe { Python::assume_gil_acquired() };
|
||||
self.inner(py).borrow().heads(set)
|
||||
}
|
||||
|
||||
fn children(&self, set: Set) -> Result<Set> {
|
||||
fn children(&self, set: Set) -> dag::Result<Set> {
|
||||
let py = unsafe { Python::assume_gil_acquired() };
|
||||
self.inner(py).borrow().children(set)
|
||||
}
|
||||
|
||||
fn roots(&self, set: Set) -> Result<Set> {
|
||||
fn roots(&self, set: Set) -> dag::Result<Set> {
|
||||
let py = unsafe { Python::assume_gil_acquired() };
|
||||
self.inner(py).borrow().roots(set)
|
||||
}
|
||||
|
||||
fn gca_one(&self, set: Set) -> Result<Option<Vertex>> {
|
||||
fn gca_one(&self, set: Set) -> dag::Result<Option<Vertex>> {
|
||||
let py = unsafe { Python::assume_gil_acquired() };
|
||||
self.inner(py).borrow().gca_one(set)
|
||||
}
|
||||
|
||||
fn gca_all(&self, set: Set) -> Result<Set> {
|
||||
fn gca_all(&self, set: Set) -> dag::Result<Set> {
|
||||
let py = unsafe { Python::assume_gil_acquired() };
|
||||
self.inner(py).borrow().gca_all(set)
|
||||
}
|
||||
|
||||
fn common_ancestors(&self, set: Set) -> Result<Set> {
|
||||
fn common_ancestors(&self, set: Set) -> dag::Result<Set> {
|
||||
let py = unsafe { Python::assume_gil_acquired() };
|
||||
self.inner(py).borrow().common_ancestors(set)
|
||||
}
|
||||
|
||||
fn is_ancestor(&self, ancestor: Vertex, descendant: Vertex) -> Result<bool> {
|
||||
fn is_ancestor(&self, ancestor: Vertex, descendant: Vertex) -> dag::Result<bool> {
|
||||
let py = unsafe { Python::assume_gil_acquired() };
|
||||
self.inner(py).borrow().is_ancestor(ancestor, descendant)
|
||||
}
|
||||
|
||||
fn heads_ancestors(&self, set: Set) -> Result<Set> {
|
||||
fn heads_ancestors(&self, set: Set) -> dag::Result<Set> {
|
||||
let py = unsafe { Python::assume_gil_acquired() };
|
||||
self.inner(py).borrow().heads_ancestors(set)
|
||||
}
|
||||
|
||||
fn range(&self, roots: Set, heads: Set) -> Result<Set> {
|
||||
fn range(&self, roots: Set, heads: Set) -> dag::Result<Set> {
|
||||
let py = unsafe { Python::assume_gil_acquired() };
|
||||
self.inner(py).borrow().range(roots, heads)
|
||||
}
|
||||
|
||||
fn only(&self, reachable: Set, unreachable: Set) -> Result<Set> {
|
||||
fn only(&self, reachable: Set, unreachable: Set) -> dag::Result<Set> {
|
||||
let py = unsafe { Python::assume_gil_acquired() };
|
||||
self.inner(py).borrow().only(reachable, unreachable)
|
||||
}
|
||||
|
||||
fn only_both(&self, reachable: Set, unreachable: Set) -> Result<(Set, Set)> {
|
||||
fn only_both(&self, reachable: Set, unreachable: Set) -> dag::Result<(Set, Set)> {
|
||||
let py = unsafe { Python::assume_gil_acquired() };
|
||||
self.inner(py).borrow().only_both(reachable, unreachable)
|
||||
}
|
||||
|
||||
fn descendants(&self, set: Set) -> Result<Set> {
|
||||
fn descendants(&self, set: Set) -> dag::Result<Set> {
|
||||
let py = unsafe { Python::assume_gil_acquired() };
|
||||
self.inner(py).borrow().descendants(set)
|
||||
}
|
||||
|
||||
fn reachable_roots(&self, roots: Set, heads: Set) -> Result<Set> {
|
||||
fn reachable_roots(&self, roots: Set, heads: Set) -> dag::Result<Set> {
|
||||
let py = unsafe { Python::assume_gil_acquired() };
|
||||
self.inner(py).borrow().reachable_roots(roots, heads)
|
||||
}
|
||||
}
|
||||
|
||||
impl IdConvert for commits {
|
||||
fn vertex_id(&self, name: Vertex) -> Result<Id> {
|
||||
fn vertex_id(&self, name: Vertex) -> dag::Result<Id> {
|
||||
let py = unsafe { Python::assume_gil_acquired() };
|
||||
self.inner(py).borrow().vertex_id(name)
|
||||
}
|
||||
fn vertex_id_with_max_group(&self, name: &Vertex, max_group: Group) -> Result<Option<Id>> {
|
||||
fn vertex_id_with_max_group(&self, name: &Vertex, max_group: Group) -> dag::Result<Option<Id>> {
|
||||
let py = unsafe { Python::assume_gil_acquired() };
|
||||
self.inner(py)
|
||||
.borrow()
|
||||
.vertex_id_with_max_group(name, max_group)
|
||||
}
|
||||
fn vertex_name(&self, id: Id) -> Result<Vertex> {
|
||||
fn vertex_name(&self, id: Id) -> dag::Result<Vertex> {
|
||||
let py = unsafe { Python::assume_gil_acquired() };
|
||||
self.inner(py).borrow().vertex_name(id)
|
||||
}
|
||||
fn contains_vertex_name(&self, name: &Vertex) -> Result<bool> {
|
||||
fn contains_vertex_name(&self, name: &Vertex) -> dag::Result<bool> {
|
||||
let py = unsafe { Python::assume_gil_acquired() };
|
||||
self.inner(py).borrow().contains_vertex_name(name)
|
||||
}
|
||||
}
|
||||
|
||||
impl PrefixLookup for commits {
|
||||
fn vertexes_by_hex_prefix(&self, hex_prefix: &[u8], limit: usize) -> Result<Vec<Vertex>> {
|
||||
fn vertexes_by_hex_prefix(&self, hex_prefix: &[u8], limit: usize) -> dag::Result<Vec<Vertex>> {
|
||||
let py = unsafe { Python::assume_gil_acquired() };
|
||||
self.inner(py)
|
||||
.borrow()
|
||||
|
@ -185,7 +185,7 @@ impl PyNameIter {
|
||||
}
|
||||
|
||||
impl Iterator for PyNameIter {
|
||||
type Item = Result<Vertex>;
|
||||
type Item = dag::Result<Vertex>;
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
if self.errored {
|
||||
|
@ -97,7 +97,7 @@ impl AppendCommits for HgCommits {
|
||||
.cloned()
|
||||
.map(|c| (c.vertex.clone(), c))
|
||||
.collect();
|
||||
let parent_func = |v: Vertex| -> Result<Vec<Vertex>> {
|
||||
let parent_func = |v: Vertex| -> dag::Result<Vec<Vertex>> {
|
||||
match commits.get(&v) {
|
||||
Some(commit) => Ok(commit.parents.clone()),
|
||||
None => bail!("unknown commit ({:?}) at add_commits", &v),
|
||||
@ -148,94 +148,94 @@ impl StripCommits for HgCommits {
|
||||
}
|
||||
|
||||
impl IdConvert for HgCommits {
|
||||
fn vertex_id(&self, name: Vertex) -> Result<Id> {
|
||||
fn vertex_id(&self, name: Vertex) -> dag::Result<Id> {
|
||||
self.dag.vertex_id(name)
|
||||
}
|
||||
fn vertex_id_with_max_group(&self, name: &Vertex, max_group: Group) -> Result<Option<Id>> {
|
||||
fn vertex_id_with_max_group(&self, name: &Vertex, max_group: Group) -> dag::Result<Option<Id>> {
|
||||
self.dag.vertex_id_with_max_group(name, max_group)
|
||||
}
|
||||
fn vertex_name(&self, id: Id) -> Result<Vertex> {
|
||||
fn vertex_name(&self, id: Id) -> dag::Result<Vertex> {
|
||||
self.dag.vertex_name(id)
|
||||
}
|
||||
fn contains_vertex_name(&self, name: &Vertex) -> Result<bool> {
|
||||
fn contains_vertex_name(&self, name: &Vertex) -> dag::Result<bool> {
|
||||
self.dag.contains_vertex_name(name)
|
||||
}
|
||||
}
|
||||
|
||||
impl PrefixLookup for HgCommits {
|
||||
fn vertexes_by_hex_prefix(&self, hex_prefix: &[u8], limit: usize) -> Result<Vec<Vertex>> {
|
||||
fn vertexes_by_hex_prefix(&self, hex_prefix: &[u8], limit: usize) -> dag::Result<Vec<Vertex>> {
|
||||
self.dag.vertexes_by_hex_prefix(hex_prefix, limit)
|
||||
}
|
||||
}
|
||||
|
||||
impl DagAlgorithm for HgCommits {
|
||||
fn sort(&self, set: &Set) -> Result<Set> {
|
||||
fn sort(&self, set: &Set) -> dag::Result<Set> {
|
||||
self.dag.sort(set)
|
||||
}
|
||||
fn parent_names(&self, name: Vertex) -> Result<Vec<Vertex>> {
|
||||
fn parent_names(&self, name: Vertex) -> dag::Result<Vec<Vertex>> {
|
||||
self.dag.parent_names(name)
|
||||
}
|
||||
fn all(&self) -> Result<Set> {
|
||||
fn all(&self) -> dag::Result<Set> {
|
||||
self.dag.all()
|
||||
}
|
||||
fn ancestors(&self, set: Set) -> Result<Set> {
|
||||
fn ancestors(&self, set: Set) -> dag::Result<Set> {
|
||||
self.dag.ancestors(set)
|
||||
}
|
||||
fn parents(&self, set: Set) -> Result<Set> {
|
||||
fn parents(&self, set: Set) -> dag::Result<Set> {
|
||||
self.dag.parents(set)
|
||||
}
|
||||
fn first_ancestor_nth(&self, name: Vertex, n: u64) -> Result<Vertex> {
|
||||
fn first_ancestor_nth(&self, name: Vertex, n: u64) -> dag::Result<Vertex> {
|
||||
self.dag.first_ancestor_nth(name, n)
|
||||
}
|
||||
fn heads(&self, set: Set) -> Result<Set> {
|
||||
fn heads(&self, set: Set) -> dag::Result<Set> {
|
||||
self.dag.heads(set)
|
||||
}
|
||||
fn children(&self, set: Set) -> Result<Set> {
|
||||
fn children(&self, set: Set) -> dag::Result<Set> {
|
||||
self.dag.children(set)
|
||||
}
|
||||
fn roots(&self, set: Set) -> Result<Set> {
|
||||
fn roots(&self, set: Set) -> dag::Result<Set> {
|
||||
self.dag.roots(set)
|
||||
}
|
||||
fn gca_one(&self, set: Set) -> Result<Option<Vertex>> {
|
||||
fn gca_one(&self, set: Set) -> dag::Result<Option<Vertex>> {
|
||||
self.dag.gca_one(set)
|
||||
}
|
||||
fn gca_all(&self, set: Set) -> Result<Set> {
|
||||
fn gca_all(&self, set: Set) -> dag::Result<Set> {
|
||||
self.dag.gca_all(set)
|
||||
}
|
||||
fn common_ancestors(&self, set: Set) -> Result<Set> {
|
||||
fn common_ancestors(&self, set: Set) -> dag::Result<Set> {
|
||||
self.dag.common_ancestors(set)
|
||||
}
|
||||
fn is_ancestor(&self, ancestor: Vertex, descendant: Vertex) -> Result<bool> {
|
||||
fn is_ancestor(&self, ancestor: Vertex, descendant: Vertex) -> dag::Result<bool> {
|
||||
self.dag.is_ancestor(ancestor, descendant)
|
||||
}
|
||||
fn heads_ancestors(&self, set: Set) -> Result<Set> {
|
||||
fn heads_ancestors(&self, set: Set) -> dag::Result<Set> {
|
||||
self.dag.heads_ancestors(set)
|
||||
}
|
||||
fn range(&self, roots: Set, heads: Set) -> Result<Set> {
|
||||
fn range(&self, roots: Set, heads: Set) -> dag::Result<Set> {
|
||||
self.dag.range(roots, heads)
|
||||
}
|
||||
fn only(&self, reachable: Set, unreachable: Set) -> Result<Set> {
|
||||
fn only(&self, reachable: Set, unreachable: Set) -> dag::Result<Set> {
|
||||
self.dag.only(reachable, unreachable)
|
||||
}
|
||||
fn only_both(&self, reachable: Set, unreachable: Set) -> Result<(Set, Set)> {
|
||||
fn only_both(&self, reachable: Set, unreachable: Set) -> dag::Result<(Set, Set)> {
|
||||
self.dag.only_both(reachable, unreachable)
|
||||
}
|
||||
fn descendants(&self, set: Set) -> Result<Set> {
|
||||
fn descendants(&self, set: Set) -> dag::Result<Set> {
|
||||
self.dag.descendants(set)
|
||||
}
|
||||
fn reachable_roots(&self, roots: Set, heads: Set) -> Result<Set> {
|
||||
fn reachable_roots(&self, roots: Set, heads: Set) -> dag::Result<Set> {
|
||||
self.dag.reachable_roots(roots, heads)
|
||||
}
|
||||
}
|
||||
|
||||
impl ToIdSet for HgCommits {
|
||||
fn to_id_set(&self, set: &Set) -> Result<IdSet> {
|
||||
fn to_id_set(&self, set: &Set) -> dag::Result<IdSet> {
|
||||
self.dag.to_id_set(set)
|
||||
}
|
||||
}
|
||||
|
||||
impl ToSet for HgCommits {
|
||||
fn to_set(&self, set: &IdSet) -> Result<Set> {
|
||||
fn to_set(&self, set: &IdSet) -> dag::Result<Set> {
|
||||
self.dag.to_set(set)
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ impl AppendCommits for MemHgCommits {
|
||||
.cloned()
|
||||
.map(|c| (c.vertex.clone(), c))
|
||||
.collect();
|
||||
let parent_func = |v: Vertex| -> Result<Vec<Vertex>> {
|
||||
let parent_func = |v: Vertex| -> dag::Result<Vec<Vertex>> {
|
||||
match commits.get(&v) {
|
||||
Some(commit) => Ok(commit.parents.clone()),
|
||||
None => bail!("unknown commit ({:?}) at add_commits", &v),
|
||||
@ -99,94 +99,94 @@ impl StripCommits for MemHgCommits {
|
||||
}
|
||||
|
||||
impl IdConvert for MemHgCommits {
|
||||
fn vertex_id(&self, name: Vertex) -> Result<Id> {
|
||||
fn vertex_id(&self, name: Vertex) -> dag::Result<Id> {
|
||||
self.dag.vertex_id(name)
|
||||
}
|
||||
fn vertex_id_with_max_group(&self, name: &Vertex, max_group: Group) -> Result<Option<Id>> {
|
||||
fn vertex_id_with_max_group(&self, name: &Vertex, max_group: Group) -> dag::Result<Option<Id>> {
|
||||
self.dag.vertex_id_with_max_group(name, max_group)
|
||||
}
|
||||
fn vertex_name(&self, id: Id) -> Result<Vertex> {
|
||||
fn vertex_name(&self, id: Id) -> dag::Result<Vertex> {
|
||||
self.dag.vertex_name(id)
|
||||
}
|
||||
fn contains_vertex_name(&self, name: &Vertex) -> Result<bool> {
|
||||
fn contains_vertex_name(&self, name: &Vertex) -> dag::Result<bool> {
|
||||
self.dag.contains_vertex_name(name)
|
||||
}
|
||||
}
|
||||
|
||||
impl PrefixLookup for MemHgCommits {
|
||||
fn vertexes_by_hex_prefix(&self, hex_prefix: &[u8], limit: usize) -> Result<Vec<Vertex>> {
|
||||
fn vertexes_by_hex_prefix(&self, hex_prefix: &[u8], limit: usize) -> dag::Result<Vec<Vertex>> {
|
||||
self.dag.vertexes_by_hex_prefix(hex_prefix, limit)
|
||||
}
|
||||
}
|
||||
|
||||
impl DagAlgorithm for MemHgCommits {
|
||||
fn sort(&self, set: &Set) -> Result<Set> {
|
||||
fn sort(&self, set: &Set) -> dag::Result<Set> {
|
||||
self.dag.sort(set)
|
||||
}
|
||||
fn parent_names(&self, name: Vertex) -> Result<Vec<Vertex>> {
|
||||
fn parent_names(&self, name: Vertex) -> dag::Result<Vec<Vertex>> {
|
||||
self.dag.parent_names(name)
|
||||
}
|
||||
fn all(&self) -> Result<Set> {
|
||||
fn all(&self) -> dag::Result<Set> {
|
||||
self.dag.all()
|
||||
}
|
||||
fn ancestors(&self, set: Set) -> Result<Set> {
|
||||
fn ancestors(&self, set: Set) -> dag::Result<Set> {
|
||||
self.dag.ancestors(set)
|
||||
}
|
||||
fn parents(&self, set: Set) -> Result<Set> {
|
||||
fn parents(&self, set: Set) -> dag::Result<Set> {
|
||||
self.dag.parents(set)
|
||||
}
|
||||
fn first_ancestor_nth(&self, name: Vertex, n: u64) -> Result<Vertex> {
|
||||
fn first_ancestor_nth(&self, name: Vertex, n: u64) -> dag::Result<Vertex> {
|
||||
self.dag.first_ancestor_nth(name, n)
|
||||
}
|
||||
fn heads(&self, set: Set) -> Result<Set> {
|
||||
fn heads(&self, set: Set) -> dag::Result<Set> {
|
||||
self.dag.heads(set)
|
||||
}
|
||||
fn children(&self, set: Set) -> Result<Set> {
|
||||
fn children(&self, set: Set) -> dag::Result<Set> {
|
||||
self.dag.children(set)
|
||||
}
|
||||
fn roots(&self, set: Set) -> Result<Set> {
|
||||
fn roots(&self, set: Set) -> dag::Result<Set> {
|
||||
self.dag.roots(set)
|
||||
}
|
||||
fn gca_one(&self, set: Set) -> Result<Option<Vertex>> {
|
||||
fn gca_one(&self, set: Set) -> dag::Result<Option<Vertex>> {
|
||||
self.dag.gca_one(set)
|
||||
}
|
||||
fn gca_all(&self, set: Set) -> Result<Set> {
|
||||
fn gca_all(&self, set: Set) -> dag::Result<Set> {
|
||||
self.dag.gca_all(set)
|
||||
}
|
||||
fn common_ancestors(&self, set: Set) -> Result<Set> {
|
||||
fn common_ancestors(&self, set: Set) -> dag::Result<Set> {
|
||||
self.dag.common_ancestors(set)
|
||||
}
|
||||
fn is_ancestor(&self, ancestor: Vertex, descendant: Vertex) -> Result<bool> {
|
||||
fn is_ancestor(&self, ancestor: Vertex, descendant: Vertex) -> dag::Result<bool> {
|
||||
self.dag.is_ancestor(ancestor, descendant)
|
||||
}
|
||||
fn heads_ancestors(&self, set: Set) -> Result<Set> {
|
||||
fn heads_ancestors(&self, set: Set) -> dag::Result<Set> {
|
||||
self.dag.heads_ancestors(set)
|
||||
}
|
||||
fn range(&self, roots: Set, heads: Set) -> Result<Set> {
|
||||
fn range(&self, roots: Set, heads: Set) -> dag::Result<Set> {
|
||||
self.dag.range(roots, heads)
|
||||
}
|
||||
fn only(&self, reachable: Set, unreachable: Set) -> Result<Set> {
|
||||
fn only(&self, reachable: Set, unreachable: Set) -> dag::Result<Set> {
|
||||
self.dag.only(reachable, unreachable)
|
||||
}
|
||||
fn only_both(&self, reachable: Set, unreachable: Set) -> Result<(Set, Set)> {
|
||||
fn only_both(&self, reachable: Set, unreachable: Set) -> dag::Result<(Set, Set)> {
|
||||
self.dag.only_both(reachable, unreachable)
|
||||
}
|
||||
fn descendants(&self, set: Set) -> Result<Set> {
|
||||
fn descendants(&self, set: Set) -> dag::Result<Set> {
|
||||
self.dag.descendants(set)
|
||||
}
|
||||
fn reachable_roots(&self, roots: Set, heads: Set) -> Result<Set> {
|
||||
fn reachable_roots(&self, roots: Set, heads: Set) -> dag::Result<Set> {
|
||||
self.dag.reachable_roots(roots, heads)
|
||||
}
|
||||
}
|
||||
|
||||
impl ToIdSet for MemHgCommits {
|
||||
fn to_id_set(&self, set: &Set) -> Result<IdSet> {
|
||||
fn to_id_set(&self, set: &Set) -> dag::Result<IdSet> {
|
||||
self.dag.to_id_set(set)
|
||||
}
|
||||
}
|
||||
|
||||
impl ToSet for MemHgCommits {
|
||||
fn to_set(&self, set: &IdSet) -> Result<Set> {
|
||||
fn to_set(&self, set: &IdSet) -> dag::Result<Set> {
|
||||
self.dag.to_set(set)
|
||||
}
|
||||
}
|
||||
|
@ -88,94 +88,94 @@ impl StripCommits for RevlogCommits {
|
||||
}
|
||||
|
||||
impl IdConvert for RevlogCommits {
|
||||
fn vertex_id(&self, name: Vertex) -> Result<Id> {
|
||||
fn vertex_id(&self, name: Vertex) -> dag::Result<Id> {
|
||||
self.revlog.vertex_id(name)
|
||||
}
|
||||
fn vertex_id_with_max_group(&self, name: &Vertex, max_group: Group) -> Result<Option<Id>> {
|
||||
fn vertex_id_with_max_group(&self, name: &Vertex, max_group: Group) -> dag::Result<Option<Id>> {
|
||||
self.revlog.vertex_id_with_max_group(name, max_group)
|
||||
}
|
||||
fn vertex_name(&self, id: Id) -> Result<Vertex> {
|
||||
fn vertex_name(&self, id: Id) -> dag::Result<Vertex> {
|
||||
self.revlog.vertex_name(id)
|
||||
}
|
||||
fn contains_vertex_name(&self, name: &Vertex) -> Result<bool> {
|
||||
fn contains_vertex_name(&self, name: &Vertex) -> dag::Result<bool> {
|
||||
self.revlog.contains_vertex_name(name)
|
||||
}
|
||||
}
|
||||
|
||||
impl PrefixLookup for RevlogCommits {
|
||||
fn vertexes_by_hex_prefix(&self, hex_prefix: &[u8], limit: usize) -> Result<Vec<Vertex>> {
|
||||
fn vertexes_by_hex_prefix(&self, hex_prefix: &[u8], limit: usize) -> dag::Result<Vec<Vertex>> {
|
||||
self.revlog.vertexes_by_hex_prefix(hex_prefix, limit)
|
||||
}
|
||||
}
|
||||
|
||||
impl DagAlgorithm for RevlogCommits {
|
||||
fn sort(&self, set: &Set) -> Result<Set> {
|
||||
fn sort(&self, set: &Set) -> dag::Result<Set> {
|
||||
self.revlog.sort(set)
|
||||
}
|
||||
fn parent_names(&self, name: Vertex) -> Result<Vec<Vertex>> {
|
||||
fn parent_names(&self, name: Vertex) -> dag::Result<Vec<Vertex>> {
|
||||
self.revlog.parent_names(name)
|
||||
}
|
||||
fn all(&self) -> Result<Set> {
|
||||
fn all(&self) -> dag::Result<Set> {
|
||||
self.revlog.all()
|
||||
}
|
||||
fn ancestors(&self, set: Set) -> Result<Set> {
|
||||
fn ancestors(&self, set: Set) -> dag::Result<Set> {
|
||||
self.revlog.ancestors(set)
|
||||
}
|
||||
fn parents(&self, set: Set) -> Result<Set> {
|
||||
fn parents(&self, set: Set) -> dag::Result<Set> {
|
||||
self.revlog.parents(set)
|
||||
}
|
||||
fn first_ancestor_nth(&self, name: Vertex, n: u64) -> Result<Vertex> {
|
||||
fn first_ancestor_nth(&self, name: Vertex, n: u64) -> dag::Result<Vertex> {
|
||||
self.revlog.first_ancestor_nth(name, n)
|
||||
}
|
||||
fn heads(&self, set: Set) -> Result<Set> {
|
||||
fn heads(&self, set: Set) -> dag::Result<Set> {
|
||||
self.revlog.heads(set)
|
||||
}
|
||||
fn children(&self, set: Set) -> Result<Set> {
|
||||
fn children(&self, set: Set) -> dag::Result<Set> {
|
||||
self.revlog.children(set)
|
||||
}
|
||||
fn roots(&self, set: Set) -> Result<Set> {
|
||||
fn roots(&self, set: Set) -> dag::Result<Set> {
|
||||
self.revlog.roots(set)
|
||||
}
|
||||
fn gca_one(&self, set: Set) -> Result<Option<Vertex>> {
|
||||
fn gca_one(&self, set: Set) -> dag::Result<Option<Vertex>> {
|
||||
self.revlog.gca_one(set)
|
||||
}
|
||||
fn gca_all(&self, set: Set) -> Result<Set> {
|
||||
fn gca_all(&self, set: Set) -> dag::Result<Set> {
|
||||
self.revlog.gca_all(set)
|
||||
}
|
||||
fn common_ancestors(&self, set: Set) -> Result<Set> {
|
||||
fn common_ancestors(&self, set: Set) -> dag::Result<Set> {
|
||||
self.revlog.common_ancestors(set)
|
||||
}
|
||||
fn is_ancestor(&self, ancestor: Vertex, descendant: Vertex) -> Result<bool> {
|
||||
fn is_ancestor(&self, ancestor: Vertex, descendant: Vertex) -> dag::Result<bool> {
|
||||
self.revlog.is_ancestor(ancestor, descendant)
|
||||
}
|
||||
fn heads_ancestors(&self, set: Set) -> Result<Set> {
|
||||
fn heads_ancestors(&self, set: Set) -> dag::Result<Set> {
|
||||
self.revlog.heads_ancestors(set)
|
||||
}
|
||||
fn range(&self, roots: Set, heads: Set) -> Result<Set> {
|
||||
fn range(&self, roots: Set, heads: Set) -> dag::Result<Set> {
|
||||
self.revlog.range(roots, heads)
|
||||
}
|
||||
fn only(&self, reachable: Set, unreachable: Set) -> Result<Set> {
|
||||
fn only(&self, reachable: Set, unreachable: Set) -> dag::Result<Set> {
|
||||
self.revlog.only(reachable, unreachable)
|
||||
}
|
||||
fn only_both(&self, reachable: Set, unreachable: Set) -> Result<(Set, Set)> {
|
||||
fn only_both(&self, reachable: Set, unreachable: Set) -> dag::Result<(Set, Set)> {
|
||||
self.revlog.only_both(reachable, unreachable)
|
||||
}
|
||||
fn descendants(&self, set: Set) -> Result<Set> {
|
||||
fn descendants(&self, set: Set) -> dag::Result<Set> {
|
||||
self.revlog.descendants(set)
|
||||
}
|
||||
fn reachable_roots(&self, roots: Set, heads: Set) -> Result<Set> {
|
||||
fn reachable_roots(&self, roots: Set, heads: Set) -> dag::Result<Set> {
|
||||
self.revlog.reachable_roots(roots, heads)
|
||||
}
|
||||
}
|
||||
|
||||
impl ToIdSet for RevlogCommits {
|
||||
fn to_id_set(&self, set: &Set) -> Result<IdSet> {
|
||||
fn to_id_set(&self, set: &Set) -> dag::Result<IdSet> {
|
||||
self.revlog.to_id_set(set)
|
||||
}
|
||||
}
|
||||
|
||||
impl ToSet for RevlogCommits {
|
||||
fn to_set(&self, set: &IdSet) -> Result<Set> {
|
||||
fn to_set(&self, set: &IdSet) -> dag::Result<Set> {
|
||||
self.revlog.to_set(set)
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ pub(crate) fn migrate_commits(
|
||||
let heads: Vec<Vertex> = orig
|
||||
.heads(set.clone())?
|
||||
.iter_rev()?
|
||||
.collect::<Result<Vec<_>>>()?;
|
||||
.collect::<dag::Result<Vec<_>>>()?;
|
||||
let commits: Vec<HgCommit> = set
|
||||
.iter_rev()?
|
||||
.map(|vertex| -> Result<HgCommit> {
|
||||
|
@ -289,7 +289,7 @@ impl MutationStore {
|
||||
.iter()
|
||||
.map(|s| VertexName::copy_from(s.as_ref()))
|
||||
.collect::<Vec<_>>();
|
||||
let parent_func = move |node| -> Result<Vec<VertexName>> {
|
||||
let parent_func = move |node| -> dag::Result<Vec<VertexName>> {
|
||||
let mut result = Vec::new();
|
||||
for entry in self.log.lookup(INDEX_SUCC, &node)? {
|
||||
let entry = MutationEntry::deserialize(&mut Cursor::new(entry?))?;
|
||||
|
@ -17,7 +17,7 @@ pub fn render_namedag(
|
||||
) -> Result<String> {
|
||||
let mut renderer = crate::GraphRowRenderer::new().output().build_box_drawing();
|
||||
|
||||
let iter: Vec<_> = dag.all()?.iter()?.collect::<Result<_>>()?;
|
||||
let iter: Vec<_> = dag.all()?.iter()?.collect::<dag::Result<_>>()?;
|
||||
|
||||
let mut out = String::new();
|
||||
for node in iter {
|
||||
|
Loading…
Reference in New Issue
Block a user