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N42KMJQC QMAUTRB6R5R7ABWT2JIDEA7LMILZOS3PGPZIF3YUFKRVLW6HGKTQC OQ6HSAWHIRTAIIWMDGCTIOK47JDY7QVVAHLRDA2R5TTJKNSBFCWQC WI2BVQ6JOJBM4OC5KSZBMTDPBWESIR7GD72B5TLO7H2SY7QBDHJAC NWJD6VM6POMYKQTTPP3X6LVCWU3FHLDRIHMCSC2PPUT7JWNY42LAC AHWWRC73FXLSUDAJBU5UU76MZETHD3DSGJ7OLZPFEHXBDJ733QNAC UJPRF6DASB6TLFQSUZETOMCUVXIE5TXMCKWXMZR5SNE3IYCX4PMQC TEI5NQ3SCTU6JQIPU62B2AUXWRFSEU6DZYJG5T526G666VV5XXPAC DCSUCH6RRRQU4TQYO3K3HRC7SXAIBYP5R3ZOWAWS2LOXWNHEJM6AC UUB7SHLRIPT6JKE64MHEJBFCS5FHH5SN5R2OOK7TR2NVCPB6VN7AC }).await.unwrap();}MsgIn::GetLogFileDiff { id } => {let LogFileId { change_hash, path } = id.clone();let diffs: ChangedFile;(state, diffs) = spawn_blocking(move || {let change =state.repo.changes.get_change(&change_hash).unwrap();let mut changed_files =changed_files(&change, &state.repo.changes);let diffs = changed_files.remove(&path).unwrap();(state, diffs)
fn mk_log_entry(repo: &pijul::Repository, h: pijul::Hash) -> LogEntry {let header = repo.changes.get_header(&h.into()).unwrap();let files = repo.changes.get_changes(&h).unwrap();
fn mk_log_entry(repo: &pijul::Repository, hash: pijul::Hash) -> LogEntry {let header = repo.changes.get_header(&hash).unwrap();let files = repo.changes.get_changes(&hash).unwrap();
let log_file_selection = |log_entry: &repo::LogEntry,file_ix: usize,log_ix: usize,hash: pijul::Hash|-> cursor::Selection {let path = log_entry.file_paths.iter().nth(file_ix).unwrap().clone();
let log_file_selection =|log_entry: &repo::LogEntry,file_ix: usize,hash: pijul::Hash|-> (cursor::LogChangeFileSelection, Task<Message>) {let path = log_entry.file_paths.get(file_ix).unwrap().clone();// Request to get the difflet id = repo::LogFileId {change_hash: hash,path: path.clone(),};let task =Task::done(Message::ToRepo(repo::MsgIn::GetLogFileDiff { id }));
let new_selection = if repo.changed_files.len().saturating_sub(1)== *ix{if !repo.log.is_empty() {let ix = 0;log_selection(repo, ix)} else if !repo.untracked_files.is_empty() {let ix = 0;untracked_file_selection(repo,ix,&mut state.diffs_cache,&state.src_file_load_tx,)
let selection =if repo.changed_files.len().saturating_sub(1) == ix{if !repo.log.is_empty() {let ix = 0;log_selection(repo, ix)} else if !repo.untracked_files.is_empty() {let ix = 0;untracked_file_selection(repo,ix,&mut state.diffs_cache,&state.src_file_load_tx,)} else {let ix = 0;changed_file_selection(repo,ix,&mut state.diffs_cache,&state.src_file_load_tx,)}
if repo.log.len().saturating_sub(1) == *log_ix {if !repo.untracked_files.is_empty() {let ix = 0;untracked_file_selection(repo,ix,&mut state.diffs_cache,&state.src_file_load_tx,)} else if !repo.changed_files.is_empty() {let ix = 0;changed_file_selection(repo,ix,&mut state.diffs_cache,&state.src_file_load_tx,)
let selection =if repo.log.len().saturating_sub(1)== log_ix{if !repo.untracked_files.is_empty() {let ix = 0;untracked_file_selection(repo,ix,&mut state.diffs_cache,&state.src_file_load_tx,)} else if !repo.changed_files.is_empty(){let ix = 0;changed_file_selection(repo,ix,&mut state.diffs_cache,&state.src_file_load_tx,)} else {let ix = 0;log_selection(repo, ix)}
}} else {let ix = log_ix + 1;log_selection(repo, ix)}
};(selection, Task::none())
// The outter `Option` is for whether the selection should change, the inner is what it should change to if solet new_selection: Option<Option<cursor::Selection>> =match state.cursor.selection.as_ref() {Some(cursor::Selection::LogChange {ix,hash,file,}) => Some(Some(if file.is_none() {let log_entry = repo.log.iter().nth(*ix).unwrap();let file = if let Some(path) =
let (selection, task): (Option<cursor::Selection>,Task<Message>,) = match state.cursor.selection.take() {Some(cursor::Selection::LogChange {ix,hash,message,file,}) => {if file.is_none() {let log_entry = repo.log.get(ix).unwrap();let (file, task) = if let Some(path) =
cursor::Selection::LogChange {ix: *ix,hash: *hash,file: None,}})),Some(cursor::Selection::UntrackedFile { .. })| Some(cursor::Selection::ChangedFile { .. })| None => None,};if let Some(selection) = new_selection {state.cursor.selection = selection;}
(Some(cursor::Selection::LogChange {ix,hash,message,file: None,}),Task::none(),)}}selection @ (Some(cursor::Selection::UntrackedFile {..})| Some(cursor::Selection::ChangedFile {..})| None) => (selection, Task::none()),};state.cursor.selection = selection;task} else {Task::none()
Some(cursor::Selection::UntrackedFile {ix,path,diffs: diff::State::default(),})
(Some(cursor::Selection::UntrackedFile {ix,path,diffs: diff::State::default(),}),Task::none(),)
Some(cursor::Selection::ChangedFile {ix,path,diffs: diff::State::default(),})
(Some(cursor::Selection::ChangedFile {ix,path,diffs: diff::State::default(),}),Task::none(),)
})}cursor::Select::LogChangeFile { ix, path } => {let file = cursor::LogChangeFileSelection { ix, path };if let Some(cursor::Selection::LogChange {ix,hash,file: _,}) = state.cursor.selection{
}),Task::none(),),cursor::Select::LogChangeFile { ix: file_ix, path } => {match state.cursor.selection.take() {
file: Some(file),})} else {None
message,file: _,}) => {// Request to get the difflet id = repo::LogFileId {change_hash: hash,path: path.clone(),};let task = Task::done(Message::ToRepo(repo::MsgIn::GetLogFileDiff { id },));let file = cursor::LogChangeFileSelection {ix: file_ix,path,diff: None,};(Some(cursor::Selection::LogChange {ix: change_ix,hash,message,file: Some(file),}),task,)}selection => (selection, Task::none()),
cursor::Selection::LogChange { ix: _, hash, file } => repo.log.iter().enumerate().find(|(_ix, entry)| &entry.hash == hash).map(|(ix, entry)| {let file = file.as_ref().and_then(|file| {
cursor::Selection::LogChange {ix: _,hash,message,file,} => {let (selection, task) = match repo.log.iter().enumerate().find(|(_ix, entry)| entry.hash == hash){Some((ix, entry)) => {let file_and_task = file.and_then(|file| {
cursor::Selection::LogChange {ix,hash: entry.hash,file,
let (file, task) = match file_and_task {Some((file, task)) => (Some(file), task),None => (None, Task::none()),};(Some(cursor::Selection::LogChange {ix,hash: entry.hash,message,file,}),task,)
}repo::MsgOut::LogFileDiff { id, diffs } => {if let Some(cursor::Selection::LogChange {ix: _,hash: selected_hash,message: _,file:Some(cursor::LogChangeFileSelection {ix: _,path: selected_path,diff,}),}) = state.cursor.selection.as_mut(){let repo::LogFileId { change_hash, path } = id;if *selected_hash == change_hash && *selected_path == path {// NOTE: using unknown encoding as we don't yet have the// filelet file = diff::init_file(diff::FileContent::UnknownEncoding,Some(&diffs),);*diff = Some((diff::State::default(), file));}}
Some(cursor::Selection::LogChange { ix, hash, file }) => {let entry =state.repo.as_ref().unwrap().log.iter().nth(*ix).unwrap();
Some(cursor::Selection::LogChange {ix,hash,message,file,}) => {let entry = state.repo.as_ref().unwrap().log.get(*ix).unwrap();
let is_selected = matches!(file, Some(cursor::LogChangeFileSelection{ix: _, path: selected_path}) if selected_path == path);
let is_selected = matches!(file, Some(cursor::LogChangeFileSelection{ path: selected_path, .. }) if selected_path == path);
el(row([el(column([
let left_view = match state.cursor.selection.as_ref() {Some(cursor::Selection::LogChange {ix: _,hash,message: _,file: Some(cursor::LogChangeFileSelection { ix: _, path, diff }),}) => el(column([view_diff_header(format!("{path} changes in {}:",display_short_hash(hash))),match diff {Some((state, file)) => {diff::view(state, file).map(|action| todo!())}None => el(text("Loading diff..")),},]).width(Length::FillPortion(1)).spacing(SPACING)),Some(cursor::Selection::UntrackedFile { .. })| Some(cursor::Selection::ChangedFile { .. })| Some(cursor::Selection::LogChange { .. })| None => el(column([
el(column([el(text("Untracked files:")), untracked_files])),el(column([el(text("Changed files:")), changed_files])),el(column([el(text("Recent changes:")), log])),
el(column([el(text("Untracked files:")), untracked_files()])),el(column([el(text("Changed files:")), changed_files()])),el(column([el(text("Recent changes:")), log()])),
el(column([record_msg_editor, selection_details]).width(Length::FillPortion(1))),]).spacing(SPACING))
};let right_view = el(column([record_msg_editor, selection_details]).width(Length::FillPortion(1)));el(row([left_view, right_view]).spacing(SPACING))
let txt = format!("{:width$} ", num, width = digits);mono_text(txt).font(Font::MONOSPACE).style(move |theme| {let palette = theme.extended_palette();text::Style {color: Some(palette.background.base.text.scale_alpha(0.61)),}})
let txt = format!("{num:digits$} ");mono_text(txt).font(Font::MONOSPACE).style(move |theme| {let palette = theme.extended_palette();text::Style {color: Some(palette.background.base.text.scale_alpha(0.61)),}}).align_y(alignment::Vertical::Top)
UntrackedFile { ix: usize, path: String },ChangedFile { ix: usize, path: String },LogChange { ix: usize, hash: pijul::Hash },LogChangeFile { ix: usize, path: String },
UntrackedFile {ix: usize,path: String,},ChangedFile {ix: usize,path: String,},LogChange {ix: usize,hash: pijul::Hash,message: String,},LogChangeFile {ix: usize,path: String,},