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

Add a Tree method to return conflicts matching a matcher

This is useful for `jj resolve`.
This commit is contained in:
Ilya Grigoriev 2022-12-03 19:47:03 -08:00
parent b58be8d7a4
commit acb0e9751d

View file

@ -210,19 +210,23 @@ impl Tree {
}
}
pub fn has_conflict(&self) -> bool {
!self.conflicts().is_empty()
}
pub fn conflicts(&self) -> Vec<(RepoPath, ConflictId)> {
pub fn conflicts_matching(&self, matcher: &dyn Matcher) -> Vec<(RepoPath, ConflictId)> {
let mut conflicts = vec![];
for (name, value) in self.entries() {
for (name, value) in self.entries_matching(matcher) {
if let TreeValue::Conflict(id) = value {
conflicts.push((name.clone(), id.clone()));
}
}
conflicts
}
pub fn conflicts(&self) -> Vec<(RepoPath, ConflictId)> {
self.conflicts_matching(&EverythingMatcher)
}
pub fn has_conflict(&self) -> bool {
!self.conflicts().is_empty()
}
}
pub struct TreeEntriesIterator<'matcher> {