Skip to content

Bug: Panic when revsets.log-graph-prioritize is not visible in the evaluated --revision revset #9975

Description

@josephlou5

(Not sure what the best title is)

Steps to Reproduce the Problem

Originally from Discord:

$ jj new && jj --config 'revsets.log-graph-prioritize=@' log -r 'at_operation(@-, all())' -n 1
Working copy  (@) now at: vwmsuoyr | (∅) (no description set)
Parent commit (@-)      : utsxvows | (∅) (no description set)

thread 'main' (10829574) panicked at lib/src/graph.rs:304:26:
parent or prioritized node should exist
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::option::expect_failed
   3: <futures_util::stream::stream::take::Take<futures_util::stream::unfold::Unfold<jj_lib::graph::TopoGroupedGraph<jj_lib::backend::CommitId, jj_lib::backend::CommitId, core::pin::Pin<alloc::boxed::Box<dyn futures_core::stream::Stream<Item = core::result::Result<(jj_lib::backend::CommitId, alloc::vec::Vec<jj_lib::graph::GraphEdge<jj_lib::backend::CommitId>>), jj_lib::revset::RevsetEvaluationError>>>>, jj_cli::commands::log::cmd_log::{closure#0}::{closure#0}::{closure#1}>, <jj_lib::graph::TopoGroupedGraph<jj_lib::backend::CommitId, jj_lib::backend::CommitId, core::pin::Pin<alloc::boxed::Box<dyn futures_core::stream::Stream<Item = core::result::Result<(jj_lib::backend::CommitId, alloc::vec::Vec<jj_lib::graph::GraphEdge<jj_lib::backend::CommitId>>), jj_lib::revset::RevsetEvaluationError>>>>, jj_cli::commands::log::cmd_log::{closure#0}::{closure#0}::{closure#1}>>::stream::{closure#0}, <jj_lib::graph::TopoGroupedGraph<jj_lib::backend::CommitId, jj_lib::backend::CommitId, core::pin::Pin<alloc::boxed::Box<dyn futures_core::stream::Stream<Item = core::result::Result<(jj_lib::backend::CommitId, alloc::vec::Vec<jj_lib::graph::GraphEdge<jj_lib::backend::CommitId>>), jj_lib::revset::RevsetEvaluationError>>>>, jj_cli::commands::log::cmd_log::{closure#0}::{closure#0}::{closure#1}>>::stream::{closure#0}::{closure#0}<i32>>> as futures_core::stream::Stream>::poll_next
   4: jj_cli::commands::log::cmd_log::{closure#0}::{closure#0}
   5: jj_cli::commands::run_command::{closure#0}::{closure#0}
   6: jj_cli::commands::run_command::{closure#0}
   7: <jj_cli::cli_util::CliRunner>::run_internal::{closure#0}::{closure#0}
   8: <jj_cli::cli_util::CliRunner>::run
   9: jj::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

This fails because the prioritize revset is evaluated at operation @, but that isn't visible in the evaluated at_operation(@-, all()).

This also fails (from Martin's message):

jj new main
HIDDEN_REV="$(jj log -r @ -G -T commit_id)"
jj new main
jj --config "revsets.log-graph-prioritize=${HIDDEN_REV}" log -r 'all()' -n 1

Similarly, the hidden revision isn't visible in all() anymore.

Solution?

From @martinvonz:

we could presumably fix it by adding revsets.log-graph-prioritize to resolve_visible_heads_or_referenced()

Specifications

  • Platform: macOS
  • Version: v0.44.0

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions