fix: simplify revision diff selection into a flat list

Revisions still used ancestry lanes and placed author/date/bookmark metadata before the summary. Show short change IDs and summaries first, move metadata to a dimmed detail row, and remove the obsolete picker graph projection.
This commit is contained in:
Valdemar Lorenzen
2026-11-05 14:54:03 +01:00
parent 1afc896cab
commit 2368091d93
6 changed files with 40 additions and 293 deletions
-69
View File
@@ -1688,75 +1688,6 @@ fn graph_state() -> DiffState {
state
}
#[test]
fn picker_graph_preserves_forks_merges_and_marks_filtered_ancestry() {
let mut state = graph_state();
let graph = state.picker_graph();
assert_eq!(graph.len(), 5);
assert_eq!(graph["merge"][1].trim_end(), "├─┐");
assert_eq!(graph["right"][1].trim_end(), "├─┘");
assert!(!graph.values().flatten().any(|prefix| prefix.contains('~')));
state.category = 1;
state.refilter();
assert_eq!(state.entries().len(), 3);
assert_eq!(
state
.graph_revision(state.entries().nth(1).unwrap())
.unwrap()
.0,
"merge"
);
assert!(matches!(
state.entries().nth(1).unwrap().target,
RevisionTarget::Bookmark { .. }
));
state.category = 0;
state.query = "left root".into();
state.refilter();
assert!(state.picker_graph().is_empty());
assert_eq!(state.entries().len(), 1);
state.before = Some(state.catalog.as_ref().unwrap().entries[1].clone());
state.query = "right".into();
state.refilter();
assert_eq!(state.picker_graph().len(), 2);
assert!(state.picker_graph()["merge"][1].contains('~'));
}
#[test]
fn graph_crossings_do_not_join_unrelated_ancestry() {
let mut state = DiffState::new();
let mut catalog = Catalog {
kind: RepoKind::Jujutsu,
entries: Vec::new(),
graph: Default::default(),
notice: None,
};
for (id, parents) in [
("a", vec!["x"]),
("b", vec!["y"]),
("merge", vec!["x", "z"]),
("x", vec![]),
("y", vec![]),
("z", vec![]),
] {
catalog.entries.push(revision(
RevisionTarget::Commit(id.into()),
id,
"",
Category::Revisions,
));
catalog.graph.insert(
id.into(),
RevisionGraph {
parents: parents.into_iter().map(String::from).collect(),
..Default::default()
},
);
}
state.apply_result(1, Ok(Outcome::Catalog(catalog)));
assert_eq!(state.picker_graph()["merge"][1].trim_end(), "├─╪─┤");
}
#[test]
fn before_identity_survives_query_and_category_without_duplicate_graph_nodes() {
let mut state = graph_state();
+13 -7
View File
@@ -3561,7 +3561,7 @@ fn checkout_picker_labels_follow_the_configured_stage() {
}
#[test]
fn jj_picker_renders_graph_before_badge_and_compacts_without_losing_controls() {
fn jj_revision_picker_keeps_summaries_and_before_visible_without_graph_lanes() {
use crate::diff::{Category, RepoKind, Revision, RevisionGraph, RevisionTarget};
let mut catalog = diff_catalog();
catalog.kind = RepoKind::Jujutsu;
@@ -3582,10 +3582,10 @@ fn jj_picker_renders_graph_before_badge_and_compacts_without_losing_controls() {
change_id: change.into(),
description: format!("{change} description"),
parents: parent.into_iter().map(str::to_owned).collect(),
author: "alice".into(),
author: "An author whose name must not displace the summary".into(),
timestamp: "2026-10-23".into(),
bookmarks: if current {
"main".into()
"vl/fin-1441-1-ora-edi-recovery@origin".into()
} else {
String::new()
},
@@ -3606,10 +3606,16 @@ fn jj_picker_renders_graph_before_badge_and_compacts_without_losing_controls() {
render_diff(&mut terminal, &diff, &mut panels);
let text = screen_text(&terminal);
assert!(text.contains("Choose After"));
assert!(text.contains("@"));
assert!(text.contains("change-a [Before] alice 2026-10-23 [main] aaaa1111"));
assert!(text.contains("change-a description"));
assert!(!text.contains("Before:"));
let summary = text
.lines()
.find(|line| line.contains("change-a description"))
.unwrap();
assert!(summary.contains("[Before]"), "{text}");
assert!(!summary.contains("An author"), "{text}");
assert!(
!text.contains('~') && !text.contains('○') && !text.contains('◆'),
"{text}"
);
let buffer = terminal.backend().buffer();
let selected_rows: Vec<_> = (0..buffer.area.height)
.filter(|&y| (0..buffer.area.width).any(|x| buffer[(x, y)].bg == Color::Blue))