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:
parent
b58be8d7a4
commit
acb0e9751d
1 changed files with 10 additions and 6 deletions
|
@ -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> {
|
||||
|
|
Loading…
Reference in a new issue