comparison rust/hg-cpython/src/cindex.rs @ 48555:8e8737a1fa7d

hg-cpython: implement vcsgraph::Graph for our Index Differential Revision: https://phab.mercurial-scm.org/D11946
author pacien <pacien.trangirard@pacien.net>
date Fri, 10 Dec 2021 15:27:22 +0100
parents 9d1a8829f959
children e633e660158f
comparison
equal deleted inserted replaced
48554:99a0b5422cf5 48555:8e8737a1fa7d
149 ) 149 )
150 }; 150 };
151 match code { 151 match code {
152 0 => Ok(res), 152 0 => Ok(res),
153 _ => Err(GraphError::ParentOutOfRange(rev)), 153 _ => Err(GraphError::ParentOutOfRange(rev)),
154 }
155 }
156 }
157
158 impl vcsgraph::graph::Graph for Index {
159 fn parents(
160 &self,
161 rev: Revision,
162 ) -> Result<vcsgraph::graph::Parents, vcsgraph::graph::GraphReadError>
163 {
164 match Graph::parents(self, rev) {
165 Ok(parents) => Ok(vcsgraph::graph::Parents(parents)),
166 Err(GraphError::ParentOutOfRange(rev)) => {
167 Err(vcsgraph::graph::GraphReadError::KeyedInvalidKey(rev))
168 }
169 Err(GraphError::WorkingDirectoryUnsupported) => Err(
170 vcsgraph::graph::GraphReadError::WorkingDirectoryUnsupported,
171 ),
154 } 172 }
155 } 173 }
156 } 174 }
157 175
158 impl RevlogIndex for Index { 176 impl RevlogIndex for Index {