rust/hg-core/src/dagops.rs
changeset 50003 e98fd81bb151
parent 44998 26114bd6ec60
child 50990 4c5f6e95df84
equal deleted inserted replaced
50002:5f1cd6839c69 50003:e98fd81bb151
   179         revs: &[Revision],
   179         revs: &[Revision],
   180     ) -> Result<Vec<Revision>, GraphError> {
   180     ) -> Result<Vec<Revision>, GraphError> {
   181         let mut revs: HashSet<Revision> = revs.iter().cloned().collect();
   181         let mut revs: HashSet<Revision> = revs.iter().cloned().collect();
   182         retain_heads(graph, &mut revs)?;
   182         retain_heads(graph, &mut revs)?;
   183         let mut as_vec: Vec<Revision> = revs.iter().cloned().collect();
   183         let mut as_vec: Vec<Revision> = revs.iter().cloned().collect();
   184         as_vec.sort();
   184         as_vec.sort_unstable();
   185         Ok(as_vec)
   185         Ok(as_vec)
   186     }
   186     }
   187 
   187 
   188     #[test]
   188     #[test]
   189     fn test_retain_heads() -> Result<(), GraphError> {
   189     fn test_retain_heads() -> Result<(), GraphError> {
   204         graph: &impl Graph,
   204         graph: &impl Graph,
   205         revs: &[Revision],
   205         revs: &[Revision],
   206     ) -> Result<Vec<Revision>, GraphError> {
   206     ) -> Result<Vec<Revision>, GraphError> {
   207         let heads = heads(graph, revs.iter())?;
   207         let heads = heads(graph, revs.iter())?;
   208         let mut as_vec: Vec<Revision> = heads.iter().cloned().collect();
   208         let mut as_vec: Vec<Revision> = heads.iter().cloned().collect();
   209         as_vec.sort();
   209         as_vec.sort_unstable();
   210         Ok(as_vec)
   210         Ok(as_vec)
   211     }
   211     }
   212 
   212 
   213     #[test]
   213     #[test]
   214     fn test_heads() -> Result<(), GraphError> {
   214     fn test_heads() -> Result<(), GraphError> {
   229         graph: &impl Graph,
   229         graph: &impl Graph,
   230         revs: &[Revision],
   230         revs: &[Revision],
   231     ) -> Result<Vec<Revision>, GraphError> {
   231     ) -> Result<Vec<Revision>, GraphError> {
   232         let set: HashSet<_> = revs.iter().cloned().collect();
   232         let set: HashSet<_> = revs.iter().cloned().collect();
   233         let mut as_vec = roots(graph, &set)?;
   233         let mut as_vec = roots(graph, &set)?;
   234         as_vec.sort();
   234         as_vec.sort_unstable();
   235         Ok(as_vec)
   235         Ok(as_vec)
   236     }
   236     }
   237 
   237 
   238     #[test]
   238     #[test]
   239     fn test_roots() -> Result<(), GraphError> {
   239     fn test_roots() -> Result<(), GraphError> {