ok/jj
1
0
Fork 0
forked from mirrors/jj

op_walk: sort current heads to stabilize multiple ops error message

This commit is contained in:
Yuya Nishihara 2024-08-03 22:43:37 +09:00
parent 8cac8fba5a
commit 4e3a5de6e9

View file

@ -174,14 +174,17 @@ pub fn get_current_head_ops(
op_store: &Arc<dyn OpStore>,
op_heads_store: &dyn OpHeadsStore,
) -> OpStoreResult<Vec<Operation>> {
op_heads_store
let mut head_ops: Vec<_> = op_heads_store
.get_op_heads()
.into_iter()
.map(|id| -> OpStoreResult<Operation> {
let data = op_store.read_operation(&id)?;
Ok(Operation::new(op_store.clone(), id, data))
})
.try_collect()
.try_collect()?;
// To stabilize output, sort in the same order as resolve_op_heads()
head_ops.sort_by_key(|op| op.metadata().end_time.timestamp);
Ok(head_ops)
}
/// Looks up children of the `root_op_id` by traversing from the `head_ops`.