mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-12 23:23:20 +00:00
op_heads_store: return operations sorted by timestamp (#111)
It's cheap to sort them, so let's have them always sorted, so all callers can rely on that order.
This commit is contained in:
parent
d62cc15ff0
commit
d45a25b1ee
2 changed files with 2 additions and 2 deletions
|
@ -184,6 +184,7 @@ impl OpHeadsStore {
|
||||||
return Ok(OpHeads::Single(op_heads.pop().unwrap()));
|
return Ok(OpHeads::Single(op_heads.pop().unwrap()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
op_heads.sort_by_key(|op| op.store_operation().metadata.end_time.timestamp.clone());
|
||||||
Ok(OpHeads::Unresolved {
|
Ok(OpHeads::Unresolved {
|
||||||
locked_op_heads,
|
locked_op_heads,
|
||||||
op_heads,
|
op_heads,
|
||||||
|
|
|
@ -387,9 +387,8 @@ impl RepoLoader {
|
||||||
fn merge_op_heads(
|
fn merge_op_heads(
|
||||||
&self,
|
&self,
|
||||||
user_settings: &UserSettings,
|
user_settings: &UserSettings,
|
||||||
mut op_heads: Vec<Operation>,
|
op_heads: Vec<Operation>,
|
||||||
) -> UnpublishedOperation {
|
) -> UnpublishedOperation {
|
||||||
op_heads.sort_by_key(|op| op.store_operation().metadata.end_time.timestamp.clone());
|
|
||||||
let base_repo = self.load_at(&op_heads[0]);
|
let base_repo = self.load_at(&op_heads[0]);
|
||||||
let mut tx = base_repo.start_transaction("resolve concurrent operations");
|
let mut tx = base_repo.start_transaction("resolve concurrent operations");
|
||||||
for other_op_head in op_heads.into_iter().skip(1) {
|
for other_op_head in op_heads.into_iter().skip(1) {
|
||||||
|
|
Loading…
Reference in a new issue