allow to initiate a new repo
Dependencies
- [2]
6YZAVBWUInitial commit - [3]
KT5UYXGKfix selection after adding file, add changed file diffs - [4]
ELG3UDT6allow to rm added files - [5]
A5YBC77Vrecord! - [6]
HOJZI52Yrename flowers_ui to inflorescence - [7]
ONRCENKTrm unnecessary state from repo's internal state - [8]
VCNKFNUFapp init test - [9]
ACDXXAX2refactor main's updates into smaller fns - [10]
WXQBBQ2Aupdate nightly - [11]
JZXYSIYDchannel selection! - [12]
5ZRDYL6Kfork channel, fix recording esc key - [13]
3XRG4BB6rewritten nav-scrollable! - [14]
WAOGSCOJvery nice refactor, wip adding channels logs - [15]
EJPSD5XOshared allowed actions conditions between update and view - [16]
YK3MOJJLchonky refactor, wip other channels logs & diffs - [17]
7WCB5YQJrefactor msgs and modules - [18]
AZ5D2LQUallow to set record description - [19]
IFQPVMBDerror handling for repo actions - [20]
TEDT26JQadd push and pull sub-menus - [21]
BJ3CYLUTallow to reset changed file - [22]
FTRAPDYAadd simple cli with repo path arg - [23]
YRGDFHABproject dir picker - [24]
LPSUBGUBadd projects picker - [25]
MORKDJUEuse allowed actions binding for key subs - [26]
OLDN7R34retry upsert project - [27]
5BAPU7K6dir picker key navigation - [28]
TMDH7GPVdir picker scrollables handling + confirmation - [29]
SEJXDXPWimprove file watcher to respect .ignore file - [30]
47ZTC4WSfix forking during channel selection - [31]
YGZ3VCW4add push - [32]
23SFYK4Qbig view refactor into a new crate - [33]
C3OS2JJ6clear cache on saving record & refresh - [34]
ODCT4QJNadd pull - [35]
S4WH75Y3allow to select channels if there are any other. Conditional switch - [36]
W7IUT3ZVstart recording impl - [37]
AMPZ2BXKshow changed files diffs (only Edit atm) - [38]
PTWZYQFRuse nav-scrollable for repo status - [39]
WT3GA27Padd cursor with selection - [40]
KM5PSZ4Awatch repo once loaded - [41]
UR4J677Rnav for log changes and refactors - [42]
WH57EHNMupdate tests - [43]
PKLUHYE4allow to copy change hash - [44]
D7A7MSIHallow to defer or abandon record, add buttons - [45]
BJXUYQ2Yshow untracked file contents in read-only text editor - [46]
FU6P5QLGindicate when a file is a dir with appended '/' - [*]
SWWE2R6Mdisplay basic repo stuff
Change contents
- edit in libflorescence/src/repo.rs at line 97
/// Initialized `manage` task - edit in libflorescence/src/repo.rs at line 534
}pub async fn init(path: PathBuf) -> Result<PathBuf, anyhow::Error> {let config =PijulConfig::load(None, vec![]).context("Loading Pijul config")?;let repo = pijul::Repository::init(&config, Some(&path), None, None).with_context(|| {format!("Initializing a new Pijul repo at {}", path.display())})?;let mut txn = repo.pristine.mut_txn_begin()?;let channel_name = libpijul::DEFAULT_CHANNEL.to_string();txn.open_or_create_channel(&channel_name).context("Creating a default channel")?;txn.set_current_channel(&channel_name).context("Setting the current channel to the default channel")?;txn.commit().context("Commit")?;Ok(path) - replacement in libflorescence/src/repo.rs at line 630
txn.commit()?;txn.commit().context("Commit")?; - replacement in libflorescence/src/repo.rs at line 642
txn.commit()?;txn.commit().context("Commit")?; - replacement in libflorescence/src/repo.rs at line 856
txn.commit()?;txn.commit().context("Commit")?; - replacement in libflorescence/src/repo.rs at line 957
txn.commit()?;txn.commit().context("Commit")?; - replacement in libflorescence/src/repo.rs at line 970
txn.commit()?;txn.commit().context("Commit")?; - replacement in libflorescence/src/repo.rs at line 1633
txn.commit()?;txn.commit().context("Commit")?; - replacement in inflorescence_model/src/model.rs at line 75
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]#[derive(Clone, Debug, PartialEq, Eq, Hash)] - edit in inflorescence_model/src/model.rs at line 80
InitRepo { path: PathBuf }, - replacement in inflorescence_model/src/action.rs at line 185
let mut bindings = if let Some(sub_menu) = state.sub_menu {let mut bindings = if let Some(sub_menu) = &state.sub_menu { - edit in inflorescence_model/src/action.rs at line 232
model::SubMenu::InitRepo { path: _ } => {vec![confirm("confirm init repo"), cancel()]} - edit in inflorescence_iced_widget/src/dir_picker.rs at line 114
/// Picked an existing Pijul or Git Repo - edit in inflorescence_iced_widget/src/dir_picker.rs at line 116
/// Create a new project in non-existing directoryCreateNew(PathBuf), - edit in inflorescence_iced_widget/src/dir_picker.rs at line 571
action = Some(Action::CreateNew(state.current_dir.as_path().to_path_buf().join(&state.input),)); - edit in inflorescence/src/main.rs at line 107
InitedRepo(anyhow::Result<PathBuf>), - edit in inflorescence/src/main.rs at line 264
&mut state.model.sub_menu,&mut state.model.report, - edit in inflorescence/src/main.rs at line 267
&mut state.model.report, - edit in inflorescence/src/main.rs at line 284
.map(Msg::ManagingRepo) - edit in inflorescence/src/main.rs at line 381
Msg::InitedRepo(result) => {let task = match result {Ok(path) => {let (sub, managing_repo, managing_repo_task) =init_managing_repo(path.clone(),&mut state.model.report,);state.model.sub = model::SubState::ManagingRepo(sub);state.managing_repo = Some(managing_repo);managing_repo_task}Err(err) => {let msg =format!("Failed to initialize a new repo: {err:?}");report::show_err(&mut state.model.report, msg);Task::none()}};state.model.sub_menu = None;task} - replacement in inflorescence/src/main.rs at line 771
msg: view::Msg,sub_menu: &mut Option<model::SubMenu>, - edit in inflorescence/src/main.rs at line 773
msg: view::Msg, - replacement in inflorescence/src/main.rs at line 778
let mut handle_action = |action| {if let Some(dir_picker::Action::Picked(dir)) = action {// If it contains Pijul repo, init ManagingRepo state// TODO: If it contains Git, offer to migrate it// TODO: Otherwise, offer to init Pijul from scratchlet project = store::Project {last_closed_time: cmp::Reverse(None),path: dir.clone(),};let store_project_task = if repo::is_pijul(&project.path) {Task::perform(async move { store::upsert_project(project).await },Msg::UpsertProjectResult,)let mut handle_action =|sub_menu: &mut Option<model::SubMenu>,action: Option<dir_picker::Action>| {if let Some(action) = action {match action {dir_picker::Action::Picked(dir) => {// If it contains Pijul repo, init ManagingRepo state// TODO: If it contains Git, offer to migrate it// TODO: Otherwise, offer to init Pijul from scratchlet project = store::Project {last_closed_time: cmp::Reverse(None),path: dir.clone(),};let store_project_task =if repo::is_pijul(&project.path) {Task::perform(async move {store::upsert_project(project).await},Msg::UpsertProjectResult,)} else {Task::none()};let (sub, managing_repo, managing_repo_task) =init_managing_repo(dir, report);new_state = Some((sub, managing_repo));Task::batch([managing_repo_task, store_project_task])}dir_picker::Action::CreateNew(path) => {*sub_menu = Some(model::SubMenu::InitRepo { path });Task::none()}} - replacement in inflorescence/src/main.rs at line 814[28.12136]→[28.12136:12210](∅→∅),[28.12210]→[29.3393:3442](∅→∅),[29.3442]→[28.12251:12428](∅→∅),[28.12251]→[28.12251:12428](∅→∅)
};let (sub, managing_repo, managing_repo_task) =init_managing_repo(dir, report);new_state = Some((sub, managing_repo));Task::batch([managing_repo_task, store_project_task])} else {Task::none()}};}}; - replacement in inflorescence/src/main.rs at line 827
action::FilteredMsg::Confirm => {let (task, action) =dir_picker::confirm_input_or_selection(picker);let dir_picker_task =task.map(view::Msg::PickingRepoDir).map(Msg::View);let action_task = handle_action(action);Task::batch([dir_picker_task, action_task])}action::FilteredMsg::Confirm => match &sub_menu {Some(model::SubMenu::InitRepo { path }) => {let path = path.clone();Task::perform(async move { repo::init(path).await },Msg::InitedRepo,)}Some(model::SubMenu::Push| model::SubMenu::Pull| model::SubMenu::ResetChange,)| None => {let (task, action) =dir_picker::confirm_input_or_selection(picker);let dir_picker_task =task.map(view::Msg::PickingRepoDir).map(Msg::View);let action_task = handle_action(sub_menu, action);Task::batch([dir_picker_task, action_task])}}, - replacement in inflorescence/src/main.rs at line 874
let action_task = handle_action(action);let action_task = handle_action(sub_menu, action); - replacement in inflorescence/src/main.rs at line 907
) -> Task<ManagingRepoMsg> {) -> Task<Msg> { - replacement in inflorescence/src/main.rs at line 920
view::Msg::EditRecordMsg(action) => edit_record_msg(model, action),view::Msg::EditRecordDesc(action) => edit_record_desc(model, action),view::Msg::EditRecordMsg(action) => {edit_record_msg(model, action).map(Msg::ManagingRepo)}view::Msg::EditRecordDesc(action) => {edit_record_desc(model, action).map(Msg::ManagingRepo)} - edit in inflorescence/src/main.rs at line 953
.map(Msg::ManagingRepo) - replacement in inflorescence/src/main.rs at line 979
) -> Task<ManagingRepoMsg> {) -> Task<Msg> { - replacement in inflorescence/src/main.rs at line 981[16.60291]→[17.12752:12794](∅→∅),[17.12794]→[23.3617646:3618011](∅→∅),[21.3004]→[20.533909:533971](∅→∅),[23.3618011]→[20.533909:533971](∅→∅),[20.533909]→[20.533909:533971](∅→∅),[20.533971]→[14.83003:83140](∅→∅),[14.83003]→[14.83003:83140](∅→∅),[14.83140]→[23.3618012:3618056](∅→∅),[18.10354]→[14.83190:83204](∅→∅),[16.60345]→[14.83190:83204](∅→∅),[23.3618056]→[14.83190:83204](∅→∅),[14.83190]→[14.83190:83204](∅→∅),[14.83204]→[12.5950:5999](∅→∅),[12.5950]→[12.5950:5999](∅→∅),[12.5999]→[30.1127:1840](∅→∅),[30.1840]→[14.83283:83479](∅→∅),[14.83283]→[14.83283:83479](∅→∅)
action::FilteredMsg::Confirm => {if let Some(menu) = &sub_menu {match menu {model::SubMenu::Push => push(state, model, sub_menu),model::SubMenu::Pull => pull(state, model, sub_menu),model::SubMenu::ResetChange => {reset_change(state, model, sub_menu, report)}}} else if let Some(ReadyState {repo,navigation: _,selection,forking_channel_name,..}) = model::is_ready_mut(model){#[allow(clippy::collapsible_if)]if let Some(name) = forking_channel_name.take_if(|name| {let name = name.trim();let empty = name.is_empty();let unique = || {repo.channel != name&& !repo.other_channels.iter().any(|n| n == name)};!empty && unique()}) {state.repo_tx_in.send(repo::MsgIn::ForkChannel(name)).unwrap();} else if matches!(selection.primary,selection::Primary::Channel) {if let Some(selection::Channel {ix: _,name,log: _,}) = selection.channel.take()action::FilteredMsg::Confirm => match &sub_menu {Some(model::SubMenu::Push) => push(state, model, sub_menu),Some(model::SubMenu::Pull) => pull(state, model, sub_menu),Some(model::SubMenu::ResetChange) => {reset_change(state, model, sub_menu, report)}Some(model::SubMenu::InitRepo { .. }) | None => {if let Some(ReadyState {repo,navigation: _,selection,forking_channel_name,..}) = model::is_ready_mut(model){#[allow(clippy::collapsible_if)]if matches!(selection.primary, selection::Primary::Channel){if let Some(selection::Channel {ix: _,name,log: _,}) = selection.channel.take(){state.repo_tx_in.send(repo::MsgIn::SwitchToChannel(name)).unwrap();selection.primary = selection::Primary::default();}} else if let Some(name) =forking_channel_name.take_if(|name| {let name = name.trim();let empty = name.is_empty();let unique = || {repo.channel != name&& !repo.other_channels.iter().any(|n| n == name)};!empty && unique()}) - replacement in inflorescence/src/main.rs at line 1028
.send(repo::MsgIn::SwitchToChannel(name)).send(repo::MsgIn::ForkChannel(name)) - edit in inflorescence/src/main.rs at line 1030
selection.primary = selection::Primary::default(); - edit in inflorescence/src/main.rs at line 1031
Task::none()} else {Task::none() - edit in inflorescence/src/main.rs at line 1035
Task::none()} else {Task::none() - replacement in inflorescence/src/main.rs at line 1036
}}, - edit in inflorescence/src/main.rs at line 1086
.map(Msg::ManagingRepo) - replacement in inflorescence/src/main.rs at line 1335
) -> Task<ManagingRepoMsg> {) -> Task<Msg> { - replacement in inflorescence/src/main.rs at line 1355
) -> Task<ManagingRepoMsg> {) -> Task<Msg> { - replacement in inflorescence/src/main.rs at line 1376
) -> Task<ManagingRepoMsg> {) -> Task<Msg> { - replacement in inflorescence/src/main.rs at line 1405
fn clipboard_copy(model: &mut model::ManagingRepo) -> Task<ManagingRepoMsg> {fn clipboard_copy(model: &mut model::ManagingRepo) -> Task<Msg> { - replacement in inflorescence/src/main.rs at line 1574
) -> Task<ManagingRepoMsg> {) -> Task<Msg> { - replacement in inflorescence/src/main.rs at line 1638
return selection_task;return selection_task.map(Msg::ManagingRepo); - replacement in inflorescence/src/main.rs at line 1650
) -> Task<ManagingRepoMsg> {) -> Task<Msg> { - replacement in inflorescence/src/main.rs at line 1725
return selection_task;return selection_task.map(Msg::ManagingRepo); - replacement in inflorescence/src/main.rs at line 1734
fn start_record(model: &mut model::ManagingRepo) -> Task<ManagingRepoMsg> {fn start_record(model: &mut model::ManagingRepo) -> Task<Msg> { - replacement in inflorescence/src/main.rs at line 1796
) -> Task<ManagingRepoMsg> {) -> Task<Msg> { - replacement in inflorescence/src/main.rs at line 1849
fn defer_record(model: &mut model::ManagingRepo) -> Task<ManagingRepoMsg> {fn defer_record(model: &mut model::ManagingRepo) -> Task<Msg> { - replacement in inflorescence/src/main.rs at line 1868
fn abandon_record(model: &mut model::ManagingRepo) -> Task<ManagingRepoMsg> {fn abandon_record(model: &mut model::ManagingRepo) -> Task<Msg> { - replacement in inflorescence/src/main.rs at line 1880
fn focus_next(model: &mut model::ManagingRepo) -> Task<ManagingRepoMsg> {fn focus_next(model: &mut model::ManagingRepo) -> Task<Msg> { - replacement in inflorescence/src/main.rs at line 1893
fn focus_prev(model: &mut model::ManagingRepo) -> Task<ManagingRepoMsg> {fn focus_prev(model: &mut model::ManagingRepo) -> Task<Msg> { - edit in inflorescence/Cargo.toml at line 27
[dependencies.anyhow]workspace = true - edit in Cargo.lock at line 2710
"anyhow",