allow to reset changed file
Dependencies
- [2]
WT3GA27Padd cursor with selection - [3]
D7A7MSIHallow to defer or abandon record, add buttons - [4]
ACDXXAX2refactor main's updates into smaller fns - [5]
WXQBBQ2Aupdate nightly - [6]
PTWZYQFRuse nav-scrollable for repo status - [7]
3XRG4BB6rewritten nav-scrollable! - [8]
WAOGSCOJvery nice refactor, wip adding channels logs - [9]
EJPSD5XOshared allowed actions conditions between update and view - [10]
YK3MOJJLchonky refactor, wip other channels logs & diffs - [11]
7WCB5YQJrefactor msgs and modules - [12]
PKLUHYE4allow to copy change hash - [13]
LFEMJYYDstart of to_record selection - [14]
FU6P5QLGindicate when a file is a dir with appended '/' - [15]
YGZ3VCW4add push - [16]
ODCT4QJNadd pull - [17]
UTDTZCTXpull+push status, add info reports - [18]
TEDT26JQadd push and pull sub-menus - [19]
UR4J677Rnav for log changes and refactors - [20]
JZXYSIYDchannel selection! - [21]
5O4FWCFPadd tests to_record selection and improve it - [22]
A5YBC77Vrecord! - [23]
AZ5D2LQUallow to set record description - [24]
U3EAZKHRallow to copy error report - [25]
YBJRDOTCmake all repo actions async - [26]
KWTBNTO3diffs selection and scrolling - [27]
CULHFNIVadd error report view - [28]
23SFYK4Qbig view refactor into a new crate - [29]
5CYU7UT7test: rm added file - [*]
SWWE2R6Mdisplay basic repo stuff - [*]
VCNKFNUFapp init test - [*]
6YZAVBWUInitial commit
Change contents
- edit in libflorescence/src/repo.rs at line 82
},ResetFile {path: String, - edit in libflorescence/src/repo.rs at line 488
}MsgIn::ResetFile { path } => {let state: anyhow::Result<State>;(internal_state, state) = spawn_blocking(move || {let state = |internal_state: &mut InternalState| {reset_file(internal_state, path)?;get_state(internal_state)};let state = state(&mut internal_state);(internal_state, state)}).await.unwrap();let _ = msg_out_tx.send(MsgOut::Refreshed {state,invalidate_logs: false,}); - edit in libflorescence/src/repo.rs at line 1553
fn reset_file(state: &mut InternalState, path: String) -> anyhow::Result<()> {let repo = &state.repo;let current_channel = current_channel(repo)?;let txn = repo.pristine.arc_txn_begin()?;let repo_path = CanonicalPathBuf::canonicalize(&repo.path)?;let channel = txn.read().load_channel(¤t_channel)?.context("Loading current channel")?;let mut conflicts = Vec::new();let root = std::fs::canonicalize(&path)?;let path = root.strip_prefix(&repo_path)?;use path_slash::PathExt;let path = path.to_slash_lossy();conflicts.extend(libpijul::output::output_repository_no_pending(&repo.working_copy,&repo.changes,&txn,&channel,&path,true,None,std::thread::available_parallelism()?.get(),0,)?);// TODO: handle conflicts - but why are there conflicts from file reset? Is// it for the case when reset removes conflict resolutions?// super::print_conflicts(&conflicts)?;txn.commit()?;Ok(())} - edit in inflorescence_model/src/model.rs at line 44
ResetChange, - replacement in inflorescence_model/src/action.rs at line 24
RmAddedFile,RmChange, - replacement in inflorescence_model/src/action.rs at line 70
(RmAddedFile, RmAddedFile) => true,(RmChange, RmChange) => true, - replacement in inflorescence_model/src/action.rs at line 110
(RmAddedFile, _) => false,(RmChange, _) => false, - edit in inflorescence_model/src/action.rs at line 141
}model::SubMenu::ResetChange => {vec![confirm("confirm reset selection"), cancel()] - edit in inflorescence_model/src/action.rs at line 232
};let reset_changed_file = || Binding {key: "x",label: "reset file",msg: Some(FilteredMsg::RmChange),};let reset_changed_hunk = || Binding {key: "x",label: "reset hunk",msg: Some(FilteredMsg::RmChange), - replacement in inflorescence_model/src/action.rs at line 246
msg: Some(FilteredMsg::RmAddedFile),msg: Some(FilteredMsg::RmChange), - edit in inflorescence_model/src/action.rs at line 393
ma.push(reset_changed_file()); - edit in inflorescence_model/src/action.rs at line 432
can_reset_hunk, - edit in inflorescence_model/src/action.rs at line 441
// TODO support reset of selected hunk{let _ = (can_reset_hunk, reset_changed_hunk);// push_if(can_reset_hunk, reset_changed_hunk, ma);} - edit in inflorescence_model/src/action.rs at line 630
can_reset_hunk: bool, - edit in inflorescence_model/src/action.rs at line 756
can_reset_hunk: false, - edit in inflorescence_model/src/action.rs at line 816
can_reset_hunk: true, - edit in inflorescence_model/src/action.rs at line 849
can_reset_hunk: false, - replacement in inflorescence/src/test.rs at line 617
Msg::View(view::Msg::Action(action::FilteredMsg::RmAddedFile)),Msg::View(view::Msg::Action(action::FilteredMsg::RmChange)), - edit in inflorescence/src/main.rs at line 348
model::SubMenu::ResetChange => reset_change(state), - replacement in inflorescence/src/main.rs at line 456
action::FilteredMsg::RmAddedFile => rm_added_file(state),action::FilteredMsg::RmChange => rm_change(state), - edit in inflorescence/src/main.rs at line 726
fn reset_change(state: &mut State) -> Task<Msg> {if let Some(ReadyState { selection, .. }) =model::is_ready_mut(&mut state.model)&& let Some(selection::Status::ChangedFile {ix: _,path,diff_selected,}) = selection.status.as_ref(){if !diff_selected {state.repo_tx_in.send(repo::MsgIn::ResetFile {path: path.raw.clone(),}).unwrap();} else {todo!("reset selected hunk")}} else {report::show_err(&mut state.model.report,"Cannot reset the current selection. This should never happen, please report it! State: {state:?}".to_string(),);}state.model.sub_menu = None;Task::none()} - replacement in inflorescence/src/main.rs at line 932
fn rm_added_file(state: &mut State) -> Task<Msg> {fn rm_change(state: &mut State) -> Task<Msg> { - edit in inflorescence/src/main.rs at line 948
// See if the change is a previously untracked file - replacement in inflorescence/src/main.rs at line 1009
return Task::none();} else {state.model.sub_menu = Some(model::SubMenu::ResetChange); - replacement in inflorescence/src/main.rs at line 1676
"x" => action(action::FilteredMsg::RmAddedFile),"x" => action(action::FilteredMsg::RmChange),