Skip to content

Commit

Permalink
Add a revset filter predicate to find commits without conflicts.
Browse files Browse the repository at this point in the history
Used in follow up commits to identify decendants of a conflicted commit
without conflicts of their own.
  • Loading branch information
essiene committed Jul 31, 2024
1 parent 51e11ff commit 129aca4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/src/default_index/revset_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,11 @@ fn build_predicate_fn(
.unwrap()
})
}
RevsetFilterPredicate::HasNoConflict => box_pure_predicate_fn(move |index, pos| {
let entry = index.entry_by_pos(pos);
let commit = store.get_commit(&entry.commit_id()).unwrap();
!commit.has_conflict().unwrap()
}),
RevsetFilterPredicate::HasConflict => box_pure_predicate_fn(move |index, pos| {
let entry = index.entry_by_pos(pos);
let commit = store.get_commit(&entry.commit_id()).unwrap();
Expand Down
2 changes: 2 additions & 0 deletions lib/src/revset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ pub enum RevsetFilterPredicate {
text: StringPattern,
files: FilesetExpression,
},
/// Commits without conflicts
HasNoConflict,
/// Commits with conflicts
HasConflict,
/// Custom predicates provided by extensions
Expand Down

0 comments on commit 129aca4

Please sign in to comment.