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 Aug 27, 2024
1 parent 44ed245 commit f695719
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions cli/src/movement_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,24 @@ 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_at(args.offset)
.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 +148,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 f695719

Please sign in to comment.