mirror of
https://github.com/martinvonz/jj.git
synced 2025-02-06 11:34:54 +00:00
conflicts: add take()
, returning the removes and adds Vec
s
This commit is contained in:
parent
b1f2e80349
commit
35e4d5f205
2 changed files with 11 additions and 4 deletions
|
@ -62,6 +62,11 @@ impl<T> Conflict<T> {
|
|||
Conflict::new(removes, adds)
|
||||
}
|
||||
|
||||
/// Returns the removes and adds as a pair.
|
||||
pub fn take(self) -> (Vec<T>, Vec<T>) {
|
||||
(self.removes, self.adds)
|
||||
}
|
||||
|
||||
pub fn removes(&self) -> &[T] {
|
||||
&self.removes
|
||||
}
|
||||
|
|
|
@ -749,8 +749,9 @@ fn simplify_conflict(
|
|||
match term {
|
||||
Some(TreeValue::Conflict(id)) => {
|
||||
let conflict = store.read_conflict(path, id)?;
|
||||
new_removes.extend_from_slice(conflict.removes());
|
||||
new_adds.extend_from_slice(conflict.adds());
|
||||
let (removes, adds) = conflict.take();
|
||||
new_removes.extend(removes);
|
||||
new_adds.extend(adds);
|
||||
}
|
||||
_ => {
|
||||
new_adds.push(term.clone());
|
||||
|
@ -761,8 +762,9 @@ fn simplify_conflict(
|
|||
match term {
|
||||
Some(TreeValue::Conflict(id)) => {
|
||||
let conflict = store.read_conflict(path, id)?;
|
||||
new_removes.extend_from_slice(conflict.adds());
|
||||
new_adds.extend_from_slice(conflict.removes());
|
||||
let (removes, adds) = conflict.take();
|
||||
new_removes.extend(adds);
|
||||
new_adds.extend(removes);
|
||||
}
|
||||
_ => {
|
||||
new_removes.push(term.clone());
|
||||
|
|
Loading…
Reference in a new issue