Skip to content

Commit

Permalink
Fetch descendants more correctly.
Browse files Browse the repository at this point in the history
See context in [this discussion](#3935 (comment))

Fixes #3947
  • Loading branch information
essiene committed Sep 12, 2024
1 parent 5f84c73 commit f12ae43
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions cli/src/movement_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,23 @@ impl Direction {
start_revset: &Rc<RevsetExpression>,
args: &MovementArgsInternal,
) -> Result<Rc<RevsetExpression>, CommandError> {
let target_revset = match (self, args.conflict) {
(Direction::Next, true) => start_revset
let target_revset = match (self, args.should_edit, args.conflict) {
(Direction::Next, true, false) => start_revset.descendants_at(args.offset),
(Direction::Next, true, true) => start_revset
.descendants()
.filtered(RevsetFilterPredicate::HasConflict)
.roots(),
(Direction::Next, false, false) => start_revset
.children()
.minus(working_revset)
.descendants_at(args.offset),
(Direction::Next, false, true) => start_revset
.children()
.minus(working_revset)
.descendants()
.filtered(RevsetFilterPredicate::HasConflict)
.roots()
.minus(working_revset),
(Direction::Next, false) => start_revset
.descendants_at(args.offset)
.minus(working_revset),
(Direction::Prev, true) =>
.roots(),
(Direction::Prev, _, true) =>
// If people desire to move to the root conflict, replace the `heads()` below
// with `roots(). But let's wait for feedback.
{
Expand All @@ -141,7 +147,7 @@ impl Direction {
.filtered(RevsetFilterPredicate::HasConflict)
.heads()
}
(Direction::Prev, false) => start_revset.ancestors_at(args.offset),
(Direction::Prev, _, false) => start_revset.ancestors_at(args.offset),
};

Ok(target_revset)
Expand Down

0 comments on commit f12ae43

Please sign in to comment.