Pushing to, and pulling from the local repository
[?]
Nov 17, 2020, 11:36 AM
76PCXGML77EZWTRI5E6KHLVRAFTJ2AB5YRN5EKOYNAPKTWY2KCGACDependencies
- [2]
SXEYMYF7Fixing the bad changes in history (unfortunately, by rebooting). - [3]
IMCZFTIJUpdate selection instructions to also mention pushing - [4]
5HF7C67Mpush/pull: fixed "changes" arguments
Change contents
- edit in pijul/src/remote/mod.rs at line 18
LocalChannel(String), - edit in pijul/src/remote/mod.rs at line 32
self_path: Option<&Path>, - replacement in pijul/src/remote/mod.rs at line 38
unknown_remote(name, channel, no_cert_check).awaitunknown_remote(self_path, name, channel, no_cert_check).await - replacement in pijul/src/remote/mod.rs at line 40
unknown_remote(name, channel, no_cert_check).awaitunknown_remote(self_path, name, channel, no_cert_check).await - edit in pijul/src/remote/mod.rs at line 46
self_path: Option<&Path>, - replacement in pijul/src/remote/mod.rs at line 53
Ok(RemoteRepo::Http(Http {return Ok(RemoteRepo::Http(Http { - replacement in pijul/src/remote/mod.rs at line 60
}))} else if name.starts_with("ssh://") {if let Some(ssh) = ssh_remote(name) {}));}if name.starts_with("ssh://") {return if let Some(ssh) = ssh_remote(name) { - edit in pijul/src/remote/mod.rs at line 71
};}if let Ok(root) = std::fs::canonicalize(name) {if let Some(path) = self_path {let path = std::fs::canonicalize(path)?;if path == root {return Ok(RemoteRepo::LocalChannel(channel.to_string()));} - replacement in pijul/src/remote/mod.rs at line 80
} else {let mut dot_dir = Path::new(name).join(DOT_DIR);let mut dot_dir = root.join(DOT_DIR); - replacement in pijul/src/remote/mod.rs at line 88
Ok(RemoteRepo::Local(Local {return Ok(RemoteRepo::Local(Local { - replacement in pijul/src/remote/mod.rs at line 94
}))} else if let Some(ssh) = ssh_remote(name) {debug!("unknown_remote, ssh = {:?}", ssh);Ok(RemoteRepo::Ssh(ssh.connect(name, channel).await?))} else {Err((Error::RemoteNotFound {remote: name.to_string(),}).into())})); - edit in pijul/src/remote/mod.rs at line 97
if let Some(ssh) = ssh_remote(name) {debug!("unknown_remote, ssh = {:?}", ssh);Ok(RemoteRepo::Ssh(ssh.connect(name, channel).await?))} else {Err((Error::RemoteNotFound {remote: name.to_string(),}).into())} - replacement in pijul/src/remote/mod.rs at line 109
fn name(&self) -> &str {fn name(&self) -> Option<&str> { - replacement in pijul/src/remote/mod.rs at line 111
RemoteRepo::Ssh(ref s) => s.name.as_str(),RemoteRepo::Local(ref l) => l.name.as_str(),RemoteRepo::Http(ref h) => h.name.as_str(),RemoteRepo::Ssh(ref s) => Some(s.name.as_str()),RemoteRepo::Local(ref l) => Some(l.name.as_str()),RemoteRepo::Http(ref h) => Some(h.name.as_str()),RemoteRepo::LocalChannel(_) => None, - edit in pijul/src/remote/mod.rs at line 143
RemoteRepo::LocalChannel(_) => None, - replacement in pijul/src/remote/mod.rs at line 156
pub async fn update_changelist<T: MutTxnT>(pub async fn update_changelist<T: MutTxnT + TxnTExt>( - replacement in pijul/src/remote/mod.rs at line 160
) -> Result<RemoteRef<T>, anyhow::Error> {) -> Result<Option<RemoteRef<T>>, anyhow::Error> { - replacement in pijul/src/remote/mod.rs at line 162
let name = self.name();let name = if let Some(name) = self.name() {name} else {return Ok(None);}; - replacement in pijul/src/remote/mod.rs at line 181
Ok(remote)Ok(Some(remote)) - replacement in pijul/src/remote/mod.rs at line 184
async fn dichotomy_changelist<T: MutTxnT>(async fn dichotomy_changelist<T: MutTxnT + TxnTExt>( - replacement in pijul/src/remote/mod.rs at line 196
if let Some((_, s)) = self.get_state(Some(b)).await? {if let Some((_, s)) = self.get_state(txn, Some(b)).await? { - replacement in pijul/src/remote/mod.rs at line 208
let remote_state = self.get_state(Some(mid)).await?;let remote_state = self.get_state(txn, Some(mid)).await?; - replacement in pijul/src/remote/mod.rs at line 229
async fn get_state(async fn get_state<T: libpijul::TxnTExt>( - edit in pijul/src/remote/mod.rs at line 231
txn: &T, - edit in pijul/src/remote/mod.rs at line 268
RemoteRepo::LocalChannel(ref channel) => {if let Some(channel) = txn.load_channel(&channel) {Ok(local::get_state(txn, &channel, mid))} else {Ok(None)}} - edit in pijul/src/remote/mod.rs at line 341
RemoteRepo::LocalChannel(_) => unreachable!(), - edit in pijul/src/remote/mod.rs at line 383
RemoteRepo::LocalChannel(_) => Ok(()), - replacement in pijul/src/remote/mod.rs at line 388
pub async fn upload_changes(pub async fn upload_changes<T: MutTxnTExt, W: libpijul::working_copy::WorkingCopy>( - edit in pijul/src/remote/mod.rs at line 390
repo: &mut W,txn: &mut T, - edit in pijul/src/remote/mod.rs at line 422
RemoteRepo::LocalChannel(ref channel) => {let mut channel = txn.open_or_create_channel(channel)?;let store = libpijul::changestore::filesystem::FileSystem::from_changes(local);local::upload_changes(&store, repo, txn, &mut channel, changes)} - edit in pijul/src/remote/mod.rs at line 464
RemoteRepo::LocalChannel(_) => {} - replacement in pijul/src/remote/mod.rs at line 616
let name = self.name();let name = self.name().unwrap(); - replacement in pijul/src/remote/mod.rs at line 755
let remote_changes = self.update_changelist(txn, path).await?;let remote_changes = self.update_changelist(txn, path).await?.expect("Remote is not self"); - edit in pijul/src/remote/local.rs at line 11
}pub fn get_state<T: TxnTExt>(txn: &T,channel: &libpijul::pristine::ChannelRef<T>,mid: Option<u64>,) -> Option<(u64, Merkle)> {if let Some(mid) = mid {txn.get_changes(&channel, mid).map(|(_, m)| (mid, m))} else {txn.reverse_log(&channel.borrow(), None).next().map(|(n, (_, m))| (n, m))} - replacement in pijul/src/remote/local.rs at line 31
if let Some(mid) = mid {Ok(txn.get_changes(&channel, mid).map(|(_, m)| (mid, m)))} else {Ok(txn.reverse_log(&channel.borrow(), None).next().map(|(n, (_, m))| (n, m)))}Ok(get_state(&txn, &channel, mid)) - edit in pijul/src/remote/local.rs at line 85
let mut ws = libpijul::ApplyWorkspace::new(); - replacement in pijul/src/remote/local.rs at line 90
std::fs::hard_link(&local, &self.changes_dir)?;if std::fs::hard_link(&local, &self.changes_dir).is_err() {std::fs::copy(&local, &self.changes_dir)?;} - edit in pijul/src/remote/local.rs at line 96
txn.apply_change_ws(&store, &mut channel, *c, &mut ws)?; - replacement in pijul/src/remote/local.rs at line 98
txn.output_repository_no_pending(&mut repo, &store, &mut channel, "", true)?;upload_changes(&store, &mut repo, &mut txn, &mut channel, changes)?; - replacement in pijul/src/remote/local.rs at line 110
std::fs::hard_link(&self.changes_dir, path)?;if std::fs::hard_link(&self.changes_dir, path).is_err() {std::fs::copy(&self.changes_dir, path)?;} - edit in pijul/src/remote/local.rs at line 119[2.83970]
pub fn upload_changes<T: MutTxnTExt,C: libpijul::changestore::ChangeStore,W: libpijul::working_copy::WorkingCopy,>(store: &C,repo: &mut W,txn: &mut T,channel: &mut libpijul::pristine::ChannelRef<T>,changes: &[Hash],) -> Result<(), anyhow::Error> {let mut ws = libpijul::ApplyWorkspace::new();for c in changes {txn.apply_change_ws(store, channel, *c, &mut ws)?;}txn.output_repository_no_pending(repo, store, channel, "", true)?;Ok(())} - replacement in pijul/src/commands/pushpull.rs at line 102
let repo = Repository::find_root(self.repo_path)?;let mut repo = Repository::find_root(self.repo_path)?; - replacement in pijul/src/commands/pushpull.rs at line 127
.remote(&remote_name, remote_channel, self.no_cert_check).remote(Some(&repo.path),&remote_name,remote_channel,self.no_cert_check,) - replacement in pijul/src/commands/pushpull.rs at line 155
if txn.remote_has_state(&remote_changes, m) {break;}let h_int = txn.get_internal(h).unwrap();if !txn.remote_has_change(&remote_changes, h) {if let Some(ref p) = path {if txn.get_touched_files(*p, Some(h_int)).is_some() {if let Some(ref remote_changes) = remote_changes {if txn.remote_has_state(remote_changes, m) {break;}let h_int = txn.get_internal(h).unwrap();if !txn.remote_has_change(&remote_changes, h) {if let Some(ref p) = path {if txn.get_touched_files(*p, Some(h_int)).is_some() {to_upload.push(h)}} else { - replacement in pijul/src/commands/pushpull.rs at line 168
} else {to_upload.push(h)}} else if let crate::remote::RemoteRepo::LocalChannel(ref remote_channel) = remote {if let Some(channel) = txn.load_channel(remote_channel) {let channel = channel.borrow();let h_int = txn.get_internal(h).unwrap();if txn.get_changeset(&channel.changes, h_int, None).is_none() {if let Some(ref p) = path {if txn.get_touched_files(*p, Some(h_int)).is_some() {to_upload.push(h)}} else {to_upload.push(h)}} - replacement in pijul/src/commands/pushpull.rs at line 226
.upload_changes(repo.changes_dir.clone(), push_channel, &to_upload).upload_changes(&mut repo.working_copy,&mut txn,repo.changes_dir.clone(),push_channel,&to_upload,) - replacement in pijul/src/commands/pushpull.rs at line 261
.remote(&remote_name, from_channel, self.no_cert_check).remote(Some(&repo.path),&remote_name,from_channel,self.no_cert_check,) - replacement in pijul/src/commands/pushpull.rs at line 271
let paths = if let Some(p) = self.path {vec![p.to_string()]let mut paths = if let Some(p) = self.path {vec![p] - replacement in pijul/src/commands/pushpull.rs at line 279
for (_, (h, m)) in txn.iter_remote(&remote_changes.borrow().remote, 0) {if txn.channel_has_state(&channel, m) {break;} else if txn.get_revchanges(&channel, h).is_none() {to_download.push(h)if let Some(ref remote_changes) = remote_changes {for (_, (h, m)) in txn.iter_remote(&remote_changes.borrow().remote, 0) {if txn.channel_has_state(&channel, m) {break;} else if txn.get_revchanges(&channel, h).is_none() {to_download.push(h)}}} else if let crate::remote::RemoteRepo::LocalChannel(ref remote_channel) = remote {let path = if let Some(path) = paths.pop() {let (p, ambiguous) = txn.follow_oldest_path(&repo.changes, &channel, &path)?;if ambiguous {return Err((crate::Error::AmbiguousPath { path: path.clone() }).into());}Some(p)} else {None};if let Some(remote_channel) = txn.load_channel(remote_channel) {let remote_channel = remote_channel.borrow();for (_, (h, m)) in txn.reverse_log(&remote_channel, None) {if txn.channel_has_state(&channel, m) {break;}let h_int = txn.get_internal(h).unwrap();if txn.get_changeset(&channel.borrow().changes, h_int, None).is_none(){if let Some(ref p) = path {if txn.get_touched_files(*p, Some(h_int)).is_some() {to_download.push(h)}} else {to_download.push(h)}}} - replacement in pijul/src/commands/clone.rs at line 31
crate::remote::unknown_remote(&self.remote, &self.channel, self.no_cert_check).await?;crate::remote::unknown_remote(None, &self.remote, &self.channel, self.no_cert_check).await?; - replacement in pijul/src/commands/archive.rs at line 27
pub async fn run(self) -> Result<(), anyhow::Error> {pub async fn run(mut self) -> Result<(), anyhow::Error> { - edit in pijul/src/commands/archive.rs at line 41
None, - replacement in pijul/src/commands/archive.rs at line 51
let mut p = std::path::Path::new(&self.name).to_path_buf();if !self.name.ends_with(".tar.gz") {p.set_extension("tar.gz");if let crate::remote::RemoteRepo::LocalChannel(_) = remote {if let Some(ref mut path) = self.repo_path {path.clear();path.push(rem);}} else {let mut p = std::path::Path::new(&self.name).to_path_buf();if !self.name.ends_with(".tar.gz") {p.set_extension("tar.gz");}let mut f = std::fs::File::create(&p)?;remote.archive(self.prefix, state.map(|x| (x, &extra[..])), &mut f).await?;return Ok(()); - replacement in pijul/src/commands/archive.rs at line 67
let mut f = std::fs::File::create(&p)?;remote.archive(self.prefix, state.map(|x| (x, &extra[..])), &mut f).await?;} else if let Ok(repo) = Repository::find_root(self.repo_path.clone()) {}if let Ok(repo) = Repository::find_root(self.repo_path.clone()) {