##// END OF EJS Templates
rust: blanket implementation of Graph for Graph references...
Georges Racinet -
r52512:b08c5fbe stable
parent child Browse files
Show More
@@ -423,6 +423,18 b' mod tests {'
423 ),
423 ),
424 vec![8, 7, 4, 3, 2, 1, 0]
424 vec![8, 7, 4, 3, 2, 1, 0]
425 );
425 );
426 // it works as well on references, because &Graph implements Graph
427 // this is needed as of this writing by RHGitaly
428 assert_eq!(
429 list_ancestors(
430 &SampleGraph,
431 vec![11.into(), 13.into()],
432 0.into(),
433 false
434 ),
435 vec![8, 7, 4, 3, 2, 1, 0]
436 );
437
426 assert_eq!(
438 assert_eq!(
427 list_ancestors(
439 list_ancestors(
428 SampleGraph,
440 SampleGraph,
@@ -132,6 +132,12 b' pub enum GraphError {'
132 ParentOutOfRange(Revision),
132 ParentOutOfRange(Revision),
133 }
133 }
134
134
135 impl<T: Graph> Graph for &T {
136 fn parents(&self, rev: Revision) -> Result<[Revision; 2], GraphError> {
137 (*self).parents(rev)
138 }
139 }
140
135 /// The Mercurial Revlog Index
141 /// The Mercurial Revlog Index
136 ///
142 ///
137 /// This is currently limited to the minimal interface that is needed for
143 /// This is currently limited to the minimal interface that is needed for
General Comments 0
You need to be logged in to leave comments. Login now