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C I56UGW7UUKLSR4753EYRGNROZB5PD522REEOGHVAQOZZTSVRUEEQC UF5NJKASGMZSZMBUKSUI67B2GIMQFX5SNNQEHHGUBNDBQ2QZZWSAC I2AG42PAVOII4V4TWDJV5ZVNDIHKBRDT254BFQLFUIY723TW6CCQC SGHF5QCV4AYIYLXURHVUODXFAN5UWP6GBNGYZUUMPWWLKYH45RTAC DXAYDIMQ7BYEI3ASOHKADQWSMVJOA2ZVNEL2TDENJCJKX2U4GMWAC KWTBNTO3QUUE2YADF6SYW6G6ZOKYEWRJQKIWDGZXR33S3YNDVIZQC PTWZYQFRWWUOE2WMQT26CKZKFSHAIJVJS3QWHJFYUFDRRTVPHSUAC 7MJOO4E2VGNT7FKBOJUX6JDG4OET6V7DH3JIERUQXXJPM2AJQCNQC WAOGSCOJ5A372BZKHEYD2BCDBCENNVLFYW3INKUOOAZMDADDIFIQC EJPSD5XO43DWUBBZGNQMY4TMCAXL5EWCGX3OEHUERQ5GRASGWQLQC AZ5D2LQUSYVWVEP7ISFDSZTMZ65UEHZATILMDQ4TYLCKJH4Q3TIAC PKLUHYE4BGIMJKU6VKGBGSHEB2ZT53OYMTFBYCZYCO4J3RVTRXSAC KF2LDB5YIXMXBZK6KJWJOLJL66TN2KDXPH3NKEGGCQ5EVOZB77BQC IFQPVMBD552DZ3B5HCM6W6MI2SB6576ZYJNU5KVA3O4YPZAUEFHAC LFEMJYYDO45ASMQSOJ3TNID7B5UZXDHB3NWFZJXWOAWNBS6GMDEAC 5O4FWCFP4ZPAS7WKSYPHN76ML3O2S4JUOYWOV2ETD4TF2H6KZ6AQC ) {match spawn_blocking(move || load(&path)).await.unwrap() {Ok((mut internal_state, Ok(state))) => {// dbg!(diff(&state.repo));
) -> std::thread::JoinHandle<()> {// Pijul be set non-interactivepijul_interaction::set_context(pijul_interaction::InteractiveContext::NotInteractive,);
let _ = msg_out_tx.send(MsgOut::Init(state));
let rt = tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap();std::thread::spawn(move || {match load(&path) {Ok((mut internal_state, Ok(state))) => {// dbg!(diff(&state.repo));let _ = msg_out_tx.send(MsgOut::Init(state));// We need to run locally for `fn push` which is async but uses// `pijul::Repository` which is not Send. Running locally// ensures that it runs on the same thread as this task and// hence doesn't require Sendlet local = task::LocalSet::new();
while let Some(msg) = msg_in_rx.recv().await {info!("Repo received msg {msg}");internal_state = update(internal_state, msg, &msg_out_tx).await;
let msg_out_tx_clone = msg_out_tx.clone();local.spawn_local(async move {while let Some(msg) = msg_in_rx.recv().await {info!("Repo received msg {msg}");internal_state =update(internal_state, msg, &msg_out_tx_clone).await;}});rt.block_on(local);let _ = msg_out_tx.send(MsgOut::RepoTaskExited);
Err(err) => {let _ = msg_out_tx.send(MsgOut::InitFailed(err.to_string()));}}
})
#[allow(clippy::await_holding_lock,reason = "imposed by sanakirja API for txn")]async fn push(repo_path: &Path) -> Result<(), anyhow::Error> {let repo = pijul::Repository::find_root(Some(repo_path))?;let channel_name = current_channel(&repo)?;let txn = repo.pristine.arc_txn_begin()?;let remote_name = if let Some(ref def) = repo.config.default_remote {def} else {bail!("Missing remote");};let remote_channel = &channel_name;let push_channel = None;let no_cert_check = false;let mut remote = pijul_remote::repository(&repo,Some(&repo.path),None,remote_name,remote_channel,no_cert_check,true,).await?;let mut channel = txn.write().open_or_create_channel(&channel_name)?;let PushDelta {to_upload,remote_unrecs: _,unknown_changes: _,..} = to_upload(&mut txn.write(), &mut channel, &repo, &mut remote).await?;debug!("to_upload = {:?}", to_upload);if to_upload.is_empty() {txn.commit()?;bail!("Nothing to push");}// TODO: Show remote unrecords and changes// notify_remote_unrecords(&repo, remote_unrecs.as_slice());// notify_unknown_changes(unknown_changes.as_slice());if to_upload.is_empty() {txn.commit()?;bail!("Nothing to push");}remote.upload_changes(&mut *txn.write(),repo.changes_dir.clone(),push_channel,&to_upload,).await?;txn.commit()?;remote.finish().await?;Ok(())}/// Gets the `to_upload` vector while trying to auto-update/// the local cache if possible. Also calculates whether the remote/// has any changes we don't know about.async fn to_upload(txn: &mut MutTxn<()>,channel: &mut ChannelRef<MutTxn<()>>,repo: &pijul::Repository,remote: &mut RemoteRepo,) -> Result<PushDelta, anyhow::Error> {let path = &[];let force_cache = false;let changes = &[];let remote_delta = remote.update_changelist_pushpull(txn,path,channel,Some(force_cache),repo,changes,false,).await?;if let &mut RemoteRepo::LocalChannel(ref remote_channel) = remote {remote_delta.to_local_channel_push(remote_channel,txn,path,channel,repo,)} else {remote_delta.to_remote_push(txn, path, channel, repo)}}
][[package]]name = "h2"version = "0.3.27"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "0beca50380b1fc32983fc1cb4587bfa4bb9e78fc259aad4a0032d2080309222d"dependencies = ["bytes","fnv","futures-core","futures-sink","futures-util","http","indexmap","slab","tokio","tokio-util","tracing",
name = "http-body"version = "0.4.6"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2"dependencies = ["bytes","http","pin-project-lite",][[package]]name = "httparse"version = "1.10.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"[[package]]name = "httpdate"version = "1.0.3"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"[[package]]name = "hyper"version = "0.14.32"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7"dependencies = ["bytes","futures-channel","futures-core","futures-util","h2","http","http-body","httparse","httpdate","itoa","pin-project-lite","socket2","tokio","tower-service","tracing","want",][[package]]name = "hyper-tls"version = "0.5.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905"dependencies = ["bytes","hyper","native-tls","tokio","tokio-native-tls",][[package]]
name = "native-tls"version = "0.2.14"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e"dependencies = ["libc","log","openssl","openssl-probe","openssl-sys","schannel","security-framework 2.11.1","security-framework-sys","tempfile",][[package]]
][[package]]name = "pijul-remote"version = "1.0.0-beta.10"dependencies = ["anyhow","byteorder","bytes","dirs-next","futures","futures-util","keyring","libpijul","log","pijul-config","pijul-identity","pijul-interaction","pijul-repository","regex","reqwest","sanakirja","serde","serde_derive","serde_json","thrussh","thrussh-config","thrussh-keys","tokio","url",
[[package]]name = "reqwest"version = "0.11.27"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62"dependencies = ["base64 0.21.7","bytes","encoding_rs","futures-core","futures-util","h2","http","http-body","hyper","hyper-tls","ipnet","js-sys","log","mime","native-tls","once_cell","percent-encoding","pin-project-lite","rustls-pemfile","serde","serde_json","serde_urlencoded","sync_wrapper","system-configuration","tokio","tokio-native-tls","tokio-util","tower-service","url","wasm-bindgen","wasm-bindgen-futures","wasm-streams","web-sys","winreg",]
name = "system-configuration"version = "0.5.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7"dependencies = ["bitflags 1.3.2","core-foundation 0.9.4","system-configuration-sys",][[package]]name = "system-configuration-sys"version = "0.5.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9"dependencies = ["core-foundation-sys","libc",][[package]]
name = "thrussh"version = "0.35.6"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "2127fc8654db70967c556bc9bf5dfef85997b1b901f3d82e9880c39d1051b278"dependencies = ["bitflags 1.3.2","byteorder","cryptovec","digest 0.9.0","flate2","futures","generic-array","log","openssl","rand 0.8.5","sha2 0.9.9","thiserror 1.0.69","thrussh-keys","thrussh-libsodium","tokio",][[package]]name = "thrussh-config"version = "0.6.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "fa974aab89a724928e2fb4e526f6e9a5fa4fb9d544e824fc38bd177c48ca6622"dependencies = ["dirs-next","futures","log","thiserror 1.0.69","tokio","whoami",][[package]]
][[package]]name = "wasm-streams"version = "0.4.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65"dependencies = ["futures-util","js-sys","wasm-bindgen","wasm-bindgen-futures","web-sys",