Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: status: evaluate conflicts revset as a user expression #3636

Merged
merged 3 commits into from
May 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions cli/src/commands/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ use tracing::instrument;

use crate::cli_util::{print_conflicted_paths, CommandHelper};
use crate::command_error::CommandError;
use crate::diff_util;
use crate::revset_util;
use crate::ui::Ui;
use crate::{diff_util, revset_util};

/// Show high-level repo status
///
Expand Down Expand Up @@ -96,14 +95,15 @@ pub(crate) fn cmd_status(

let wc_revset = RevsetExpression::commit(wc_commit.id().clone());
// Ancestors with conflicts, excluding the current working copy commit.
let ancestors_conflicts = RevsetExpression::filter(RevsetFilterPredicate::HasConflict)
.intersection(&wc_revset.ancestors())
.minus(&wc_revset)
.minus(&revset_util::parse_immutable_expression(
&workspace_command.revset_parse_context(),
)?)
.evaluate_programmatic(repo.as_ref())?
.iter()
let ancestors_conflicts = workspace_command
.attach_revset_evaluator(
RevsetExpression::filter(RevsetFilterPredicate::HasConflict)
.intersection(&wc_revset.parents().ancestors())
.minus(&revset_util::parse_immutable_expression(
&workspace_command.revset_parse_context(),
)?),
)?
.evaluate_to_commit_ids()?
.collect();
workspace_command.report_repo_conflicts(formatter, repo, ancestors_conflicts)?;
} else {
Expand Down