add option to select remote for push
Dependencies
- [2]
JZXYSIYDchannel selection! - [3]
WAOGSCOJvery nice refactor, wip adding channels logs - [4]
EJPSD5XOshared allowed actions conditions between update and view - [5]
YK3MOJJLchonky refactor, wip other channels logs & diffs - [6]
7WCB5YQJrefactor msgs and modules - [7]
CULHFNIVadd error report view - [8]
LFEMJYYDstart of to_record selection - [9]
YGZ3VCW4add push - [10]
ODCT4QJNadd pull - [11]
UTDTZCTXpull+push status, add info reports - [12]
TEDT26JQadd push and pull sub-menus - [13]
YRGDFHABproject dir picker - [14]
LPSUBGUBadd projects picker - [15]
IMJQ4PMLfix and refactor action bindings - [16]
5BAPU7K6dir picker key navigation - [17]
TMDH7GPVdir picker scrollables handling + confirmation - [18]
T4UECD3Spicking projects key nav and scrollable - [19]
J3AD2D2Jimprove push and pull keys - [20]
BGOQFXP7update pijul - [21]
IOXNOVX2allow to initiate a new repo - [22]
XQDYES5Madd support for git import - [23]
E7HE2UFThandle multiple or no pijul identity - [24]
DNTMUCMOallow to compare local with remote records - [25]
UR4J677Rnav for log changes and refactors - [26]
BJ3CYLUTallow to reset changed file - [27]
ACDXXAX2refactor main's updates into smaller fns - [28]
OLT666N4fix screenshot test to include status, fix failed test report - [29]
6E6MSENZallow to add untracked files recursively - [30]
MORKDJUEuse allowed actions binding for key subs - [31]
PKLUHYE4allow to copy change hash - [32]
IFQPVMBDerror handling for repo actions - [33]
2SLTGWP6add change files diffs to-record selection - [34]
YBJRDOTCmake all repo actions async - [35]
5O4FWCFPadd tests to_record selection and improve it - [36]
23SFYK4Qbig view refactor into a new crate - [37]
OQ6HSAWHshow record log - [*]
SWWE2R6Mdisplay basic repo stuff - [*]
OPXFZKEBview tests setup - [*]
6YZAVBWUInitial commit
Change contents
- edit in libflorescence/src/repo.rs at line 146
remote: String, - edit in libflorescence/src/repo.rs at line 193
remote: String, - replacement in libflorescence/src/repo.rs at line 593
MsgIn::Push { channel } => {let result = push(&internal_state.path, &channel).await;let _ = msg_out_tx.send(MsgOut::Pushed { channel, result });MsgIn::Push { remote, channel } => {let result = push(&internal_state.path, &remote, &channel).await;let _ = msg_out_tx.send(MsgOut::Pushed {remote,channel,result,}); - replacement in libflorescence/src/repo.rs at line 1426
async fn push(repo_path: &Path, channel_name: &str) -> Result<(), PushError> {async fn push(repo_path: &Path,remote_name: &str,channel_name: &str,) -> Result<(), PushError> { - edit in libflorescence/src/repo.rs at line 1434[20.610]→[20.610:679](∅→∅),[20.679]→[9.2419:2444](∅→∅),[9.2419]→[9.2419:2444](∅→∅),[9.2444]→[11.1030:1078](∅→∅),[11.1078]→[9.2477:2484](∅→∅),[9.2477]→[9.2477:2484](∅→∅)
let remote_name = if let Some(ref def) = config.default_remote {def} else {return Err(anyhow!("Missing remote"))?;}; - replacement in libflorescence/src/repo.rs at line 1558
remote_unrecs,remote_unrecs: _, - edit in inflorescence_view/src/view.rs at line 46
SubMenuPushSelectRemote(String), - replacement in inflorescence_view/src/view.rs at line 63
sub_menu: _,sub_menu, - replacement in inflorescence_view/src/view.rs at line 67[13.18889]→[13.18889:18905](∅→∅),[13.18905]→[14.13267:13403](∅→∅),[14.13403]→[13.18905:18957](∅→∅),[13.18905]→[13.18905:18957](∅→∅),[13.18957]→[14.13404:13479](∅→∅)
match sub {model::SubState::PickingProject(state) => {picking_project(state, *window_size, allowed_actions, report)}model::SubState::PickingRepoDir(state) => {picking_repo_dir(state, *window_size, allowed_actions, report)if let Some(sub) = sub_menu {match sub {model::SubMenu::Push {opt: Some(opt),remote,} => match opt {model::PushOption::SelectingRemote => {return push_selecting_remote(state,*window_size,allowed_actions,report,remote,sub_menu,);}},model::SubMenu::Push { opt: None, .. }| model::SubMenu::Pull| model::SubMenu::ResetChange| model::SubMenu::InitRepo { .. }| model::SubMenu::ImportFromGit { .. }| model::SubMenu::Add { .. }| model::SubMenu::CompareRemote { .. } => {} - edit in inflorescence_view/src/view.rs at line 92
}match sub {model::SubState::PickingProject(state) => picking_project(state,*window_size,allowed_actions,report,sub_menu,),model::SubState::PickingRepoDir(state) => picking_repo_dir(state,*window_size,allowed_actions,report,sub_menu,), - edit in inflorescence_view/src/view.rs at line 115
sub_menu, - edit in inflorescence_view/src/view.rs at line 125
sub_menu: &'a Option<model::SubMenu>, - replacement in inflorescence_view/src/view.rs at line 191
add_actions_and_report(None, main, window_size, allowed_actions, report)add_actions_and_report(None,main,window_size,allowed_actions,report,sub_menu,) - edit in inflorescence_view/src/view.rs at line 206
sub_menu: &'a Option<model::SubMenu>, - replacement in inflorescence_view/src/view.rs at line 245
add_actions_and_report(None, main, window_size, allowed_actions, report)add_actions_and_report(None,main,window_size,allowed_actions,report,sub_menu,) - edit in inflorescence_view/src/view.rs at line 261
sub_menu: &'a Option<model::SubMenu>, - edit in inflorescence_view/src/view.rs at line 281
sub_menu, - edit in inflorescence_view/src/view.rs at line 305
sub_menu, - edit in inflorescence_view/src/view.rs at line 315
sub_menu, - edit in inflorescence_view/src/view.rs at line 328
sub_menu, - edit in inflorescence_view/src/view.rs at line 338
}fn push_selecting_remote<'a>(state: &'a model::State,window_size: iced::Size,allowed_actions: &'a [action::Binding],report: &'a report::Container,remote: &'a Option<String>,sub_menu: &'a Option<model::SubMenu>,) -> Element<'a, Msg, Theme> {let main = if let model::SubState::ManagingRepo(state) = &state.sub&& let Some(model::ReadyState { repo, .. }) = model::is_ready(state){let repo::State {remotes: repo::Remotes { default, other },..} = repo;let mut cols = Vec::with_capacity(default.iter().len() + other.len());for name in default.iter().chain(other) {cols.push(el(button(text(name)).on_press_with(|| Msg::SubMenuPushSelectRemote(name.clone())).class(if Some(name) == remote.as_ref() {theme::Button::Selected} else {theme::Button::Normal})));}el(column(cols))} else {el(row([]))};let main = el(container(main).width(Length::Fill).height(Length::Fill));add_actions_and_report(None,main,window_size,allowed_actions,report,sub_menu,) - edit in inflorescence_view/src/view.rs at line 410
sub_menu: &'a Option<model::SubMenu>, - replacement in inflorescence_view/src/view.rs at line 412
let actions_inner = above_actions.unwrap_or_else(|| column([]).spacing(4));let mut actions_inner =above_actions.unwrap_or_else(|| column([]).spacing(4));if let Some(sub) = sub_menu {match sub {model::SubMenu::Push {opt: _,remote: Some(remote),} => {actions_inner =actions_inner.push(el(text(format!("Remote: {remote}"))));}model::SubMenu::Push { remote: None, .. }| model::SubMenu::Pull| model::SubMenu::ResetChange| model::SubMenu::InitRepo { .. }| model::SubMenu::ImportFromGit { .. }| model::SubMenu::Add { .. }| model::SubMenu::CompareRemote { .. } => {}}} - edit in inflorescence_view/src/view.rs at line 453
sub_menu: &'a Option<model::SubMenu>, - edit in inflorescence_view/src/view.rs at line 1841
sub_menu, - replacement in inflorescence_view/src/view.rs at line 1972
Job::Push { channel } => {Job::Push { remote, channel } => { - replacement in inflorescence_view/src/view.rs at line 1974
el(text("Pushing"))el(text("Pushing to remote {remote}")) - replacement in inflorescence_view/src/view.rs at line 1976
el(text(format!("Pushing {channel}")))el(text(format!("Pushing to remote {remote}, channel {channel}"))) - replacement in inflorescence_view/src/view/test.rs at line 327
let sub_menu = Some(SubMenu::Push);let sub_menu = Some(SubMenu::Push {remote: None,opt: None,}); - replacement in inflorescence_model/src/model.rs at line 84
Push,Push {remote: Option<String>,opt: Option<PushOption>,}, - edit in inflorescence_model/src/model.rs at line 103
}#[derive(Clone, Debug, PartialEq, Eq, Hash)]pub enum PushOption {SelectingRemote, - replacement in inflorescence_model/src/model.rs at line 238
Push { channel: String },Push { remote: String, channel: String }, - edit in inflorescence_model/src/action.rs at line 58
SubMenuPushOption(model::PushOption), - replacement in inflorescence_model/src/action.rs at line 121
(EnterSubMenu(left), EnterSubMenu(right)) => left == right,(EnterSubMenu(left), EnterSubMenu(right)) => {core::mem::discriminant(left) == core::mem::discriminant(right)}(SubMenuPushOption(left), SubMenuPushOption(right)) => left == right, - edit in inflorescence_model/src/action.rs at line 147
(SubMenuPushOption(_), _) => false, - replacement in inflorescence_model/src/action.rs at line 195
model::SubMenu::Push => {// TODO add optionsvec![Binding {keys_str: "Enter | S-p",keys: ModKeys::Two(ModKey {key: Key::Named(Named::Enter),model::SubMenu::Push { remote: _, opt } => {if opt.is_none() {vec![Binding {keys_str: "Enter | S-p",keys: ModKeys::Two(ModKey {key: Key::Named(Named::Enter),mods: Mods::NONE,},ModKey {key: Key::Character("p".into()),mods: Mods::SHIFT,},),label: "confirm push",msg: Some(FilteredMsg::Confirm),},Binding {keys_str: "r",keys: ModKeys::One(ModKey {key: Key::Character("r".into()), - replacement in inflorescence_model/src/action.rs at line 218
},ModKey {key: Key::Character("p".into()),mods: Mods::SHIFT,},),label: "confirm push",msg: Some(FilteredMsg::Confirm),},cancel(),]}),label: "select remote",msg: Some(FilteredMsg::SubMenuPushOption(model::PushOption::SelectingRemote,)),},cancel(),]} else {vec![confirm("confirm remote selection"),down(),up(),cancel(),]} - replacement in inflorescence_model/src/action.rs at line 774
msg: can_push.then_some(FilteredMsg::EnterSubMenu(model::SubMenu::Push)),msg: can_push.then_some(FilteredMsg::EnterSubMenu(model::SubMenu::Push {remote: None,opt: None,},)), - replacement in inflorescence_model/src/action.rs at line 1231
model::Job::Pull { channel: c } | model::Job::Push { channel: c } => {c != channel}model::Job::Pull { channel: c }| model::Job::Push {remote: _,channel: c,} => c != channel, - replacement in inflorescence/src/main.rs at line 470
| action::FilteredMsg::ReloadIdentity => Task::none(),| action::FilteredMsg::ReloadIdentity| action::FilteredMsg::SubMenuPushOption(_) => Task::none(), - replacement in inflorescence/src/main.rs at line 491
| view::Msg::SelectIdentity(_) => Task::none(),| view::Msg::SelectIdentity(_)| view::Msg::SubMenuPushSelectRemote(_) => Task::none(), - replacement in inflorescence/src/main.rs at line 958
model::SubMenu::Pushmodel::SubMenu::Push { .. } - replacement in inflorescence/src/main.rs at line 999
| action::FilteredMsg::ReloadIdentity => Task::none(),| action::FilteredMsg::ReloadIdentity| action::FilteredMsg::SubMenuPushOption(_) => Task::none(), - replacement in inflorescence/src/main.rs at line 1016
| view::Msg::SelectIdentity(_) => Task::none(),| view::Msg::SelectIdentity(_)| view::Msg::SubMenuPushSelectRemote(_) => Task::none(), - edit in inflorescence/src/main.rs at line 1147
}Task::none()}view::Msg::SubMenuPushSelectRemote(selection) => {if let Some(model::SubMenu::Push { remote, .. }) = sub_menu {*remote = Some(selection); - replacement in inflorescence/src/main.rs at line 1171
Some(model::SubMenu::Push) => push(state, model, sub_menu),Some(model::SubMenu::Push { remote, opt }) => {if opt.is_some() {*sub_menu = Some(model::SubMenu::Push {remote: remote.clone(),opt: None,});Task::none()} else {push(state, model, sub_menu, report, remote.clone())}} - replacement in inflorescence/src/main.rs at line 1319
if sub_menu.is_some() {if let Some(sub) = sub_menu {match sub {model::SubMenu::Push { remote: _, opt } => {if opt.is_some() {*sub_menu = Some(model::SubMenu::Push {remote: None,opt: None,});}}model::SubMenu::Pull| model::SubMenu::ResetChange| model::SubMenu::InitRepo { .. }| model::SubMenu::ImportFromGit { .. }| model::SubMenu::Add { .. }| model::SubMenu::CompareRemote { .. } => {}} - edit in inflorescence/src/main.rs at line 1369
if let Some(sub) = sub_menu {match sub {model::SubMenu::Push {remote,opt: Some(opt),} => {if let Some(ReadyState { repo, .. }) =model::is_ready_mut(model){return sub_menu_push_opt_selection(msg, remote, opt, repo,);}}model::SubMenu::Push { .. }| model::SubMenu::Pull| model::SubMenu::ResetChange| model::SubMenu::InitRepo { .. }| model::SubMenu::ImportFromGit { .. }| model::SubMenu::Add { .. }| model::SubMenu::CompareRemote { .. } => {}}} - edit in inflorescence/src/main.rs at line 1586
Task::none()}action::FilteredMsg::SubMenuPushOption(new_opt) => {if let Some(model::SubMenu::Push { opt, .. }) = sub_menu {*opt = Some(new_opt);} - edit in inflorescence/src/main.rs at line 1747
}fn sub_menu_push_opt_selection(msg: selection::Msg,remote: &mut Option<String>,opt: &mut model::PushOption,repo: &mut repo::State,) -> Task<Msg> {let repo::Remotes { default, other } = &repo.remotes;let names: Vec<_> = default.iter().chain(other).collect();match opt {model::PushOption::SelectingRemote => match msg {selection::Msg::PressDir(dir) => match dir {selection::Dir::Down => {if let Some(current) = remote {let ix =names.iter().enumerate().find_map(|(ix, name)| {(*name == current).then_some(ix)});if let Some(ix) = ix&& ix < names.len().saturating_sub(1){*remote = names.into_iter().nth(ix + 1).cloned();return Task::none();}}*remote = names.into_iter().next().cloned();}selection::Dir::Up => {if let Some(current) = remote {let ix =names.iter().enumerate().find_map(|(ix, name)| {(*name == current).then_some(ix)});if let Some(ix) = ix&& ix > 0{*remote = names.into_iter().nth(ix - 1).cloned();return Task::none();}}*remote = names.into_iter().next_back().cloned();}selection::Dir::Right | selection::Dir::Left => {}},selection::Msg::AltPressDir(_) => {}},}Task::none() - edit in inflorescence/src/main.rs at line 1816
report: &mut report::Container,remote: Option<String>, - replacement in inflorescence/src/main.rs at line 1820
jobs.insert(model::Job::Push {channel: repo.channel.clone(),});state.repo_tx_in.send(repo::MsgIn::Push {if let Some(remote) =remote.clone().or_else(|| repo.remotes.default.clone()){jobs.insert(model::Job::Push {remote: remote.clone(), - replacement in inflorescence/src/main.rs at line 1826
}).unwrap();});state.repo_tx_in.send(repo::MsgIn::Push {remote,channel: repo.channel.clone(),}).unwrap();} else {report::show_err(report,"Cannot push as there is no default remote configured.".to_string(),);} - replacement in inflorescence/src/main.rs at line 2026
repo::MsgOut::Pushed { channel, result } => {repo::MsgOut::Pushed {remote,channel,result,} => { - replacement in inflorescence/src/main.rs at line 2077
jobs.swap_remove(&Job::Push { channel });jobs.swap_remove(&Job::Push { remote, channel });