mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-28 15:26:25 +00:00
prev: make revset code more similar to next
This commit is contained in:
parent
49b76cbd8c
commit
3db183b4c5
1 changed files with 7 additions and 5 deletions
|
@ -79,23 +79,25 @@ pub(crate) fn cmd_prev(
|
||||||
.view()
|
.view()
|
||||||
.heads()
|
.heads()
|
||||||
.contains(current_wc_id);
|
.contains(current_wc_id);
|
||||||
|
let wc_revset = RevsetExpression::commit(current_wc_id.clone());
|
||||||
// If we're editing, start at the working-copy commit. Otherwise, start from
|
// If we're editing, start at the working-copy commit. Otherwise, start from
|
||||||
// its direct parent(s).
|
// its direct parent(s).
|
||||||
let target_revset = if edit {
|
let start_revset = if edit {
|
||||||
RevsetExpression::commit(current_wc_id.clone())
|
wc_revset.clone()
|
||||||
} else {
|
} else {
|
||||||
RevsetExpression::commit(current_wc_id.clone()).parents()
|
wc_revset.parents()
|
||||||
};
|
};
|
||||||
|
|
||||||
let target_revset = if args.conflict {
|
let target_revset = if args.conflict {
|
||||||
// If people desire to move to the root conflict, replace the `heads()` below
|
// If people desire to move to the root conflict, replace the `heads()` below
|
||||||
// with `roots(). But let's wait for feedback.
|
// with `roots(). But let's wait for feedback.
|
||||||
target_revset
|
start_revset
|
||||||
.parents()
|
.parents()
|
||||||
.ancestors()
|
.ancestors()
|
||||||
.filtered(RevsetFilterPredicate::HasConflict)
|
.filtered(RevsetFilterPredicate::HasConflict)
|
||||||
.heads()
|
.heads()
|
||||||
} else {
|
} else {
|
||||||
target_revset.ancestors_at(args.offset)
|
start_revset.ancestors_at(args.offset)
|
||||||
};
|
};
|
||||||
let targets: Vec<_> = target_revset
|
let targets: Vec<_> = target_revset
|
||||||
.evaluate_programmatic(workspace_command.repo().as_ref())?
|
.evaluate_programmatic(workspace_command.repo().as_ref())?
|
||||||
|
|
Loading…
Reference in a new issue