diff --git a/libpijul/src/apply/edge.rs b/libpijul/src/apply/edge.rs index 12b586f..2377ad7 100644 --- a/libpijul/src/apply/edge.rs +++ b/libpijul/src/apply/edge.rs @@ -106,6 +106,9 @@ where } } if n.flag.contains(EdgeFlags::DELETED) { + // We're deleting a vertex n.to. If n has children or parents + // that are unknown to the patch we're applying, zombify these + // children and parents. collect_zombie_context(txn, graph, &mut ws.missing_context, inode, n, change, known) .map_err(LocalApplyError::from_missing)?; } @@ -128,7 +131,7 @@ where // edge points towards a zombie. for v in iter_deleted_parents(txn, graph, source)? { let v = v?; - let intro = v.introduced_by(); + let intro = v.dest().change; if !known(&txn.get_external(&intro)?.unwrap().into()) { zombies.push(intro) } @@ -142,7 +145,7 @@ where } for v in iter_deleted_parents(txn, graph, target)? { let v = v?; - let intro = v.introduced_by(); + let intro = v.dest().change; debug!("known {:?} ?", intro); if !known(&txn.get_external(&intro)?.unwrap().into()) { zombies.push(intro) @@ -335,7 +338,7 @@ where } if v.flag().contains(EdgeFlags::PARENT) { // Unwrap ok, since `v` is in the channel. - let intro = txn.get_external(&v.introduced_by())?.unwrap().into(); + let intro = txn.get_external(&v.dest().change)?.unwrap().into(); if !known(&intro) { debug!("unknown: {:?}", v); unknown_parents.push((dest_vertex, *v)) diff --git a/libpijul/src/changestore/mod.rs b/libpijul/src/changestore/mod.rs index ea272ee..f3c42e2 100644 --- a/libpijul/src/changestore/mod.rs +++ b/libpijul/src/changestore/mod.rs @@ -55,6 +55,7 @@ pub trait ChangeStore { Ok(self.get_change(hash)?.hashed.changes) } fn knows(&self, hash0: &Hash, hash1: &Hash) -> Result { + debug!("knows: {:?} {:?}", hash0, hash1); Ok(self.get_change(hash0)?.knows(hash1)) } fn has_edge( diff --git a/libpijul/src/find_alive.rs b/libpijul/src/find_alive.rs index e763914..b2387d0 100644 --- a/libpijul/src/find_alive.rs +++ b/libpijul/src/find_alive.rs @@ -40,6 +40,8 @@ pub(crate) fn find_alive_down<'a, T: GraphTxnT>( if let Some(c) = c { st.extend(c.iter().cloned()); } else { + // A `None` in the cache means that the vertex + // itself (the cache key) is alive. st.insert(*vertex); } } diff --git a/libpijul/src/unrecord/mod.rs b/libpijul/src/unrecord/mod.rs index a232431..109e0f8 100644 --- a/libpijul/src/unrecord/mod.rs +++ b/libpijul/src/unrecord/mod.rs @@ -443,10 +443,13 @@ fn unapply_edges( &edge.reverse(Some(ext)), |a, b| reintro.contains(&(a, b)), |h| { + if h == &hash { + return true + } if edge.previous.contains(EdgeFlags::DELETED) { - // When reintroducing a deleted flag, check whether - // the re-introduction patch knows about the alive - // edges around the target. + // When reintroducing an edge that was deleted, + // check whether the re-introduction patch knows + // about the alive edges around the target. changes .knows(edge.introduced_by.as_ref().unwrap_or(&hash), h) .unwrap() diff --git a/pijul/src/commands/credit.rs b/pijul/src/commands/credit.rs index f86c5cb..cf1a6fb 100644 --- a/pijul/src/commands/credit.rs +++ b/pijul/src/commands/credit.rs @@ -50,13 +50,10 @@ impl Credit { let path = root.strip_prefix(&repo_path.as_path())?.to_str().unwrap(); txn.follow_oldest_path(&repo.changes, &channel, &path)? }; ->>>>>>> 1 [YXAVFTPP] ->>>>>>> 1 [YXAVFTPP] std::mem::drop(txn); super::pager(repo.config.pager.as_ref()); -<<<<<<< 1 match libpijul::output::output_file( &repo.changes, &txn_, @@ -179,8 +176,3 @@ impl VertexBuffer for Creditor { Ok(()) } } -======= 1 [U6TQX5Z2] ->>>>>>> 2 [U6TQX5Z2] - super::pager(repo.config.pager.as_ref()); -<<<<<<< 2 -<<<<<<< 1 diff --git a/pijul/src/remote/mod.rs b/pijul/src/remote/mod.rs index c8a101a..667b1d6 100644 --- a/pijul/src/remote/mod.rs +++ b/pijul/src/remote/mod.rs @@ -721,6 +721,7 @@ impl RemoteRepo { }) } else { let mut to_download: Vec = Vec::new(); + let mut to_download_ = HashSet::new(); for x in txn.iter_rev_remote(&remote_ref.lock().remote, None)? { let (_, p) = x?; let h: Hash = p.a.into(); @@ -732,7 +733,10 @@ impl RemoteRepo { break; } if txn.get_revchanges(¤t_channel, &h).unwrap().is_none() { - to_download.push(CS::Change(h)); + let h = CS::Change(h); + if to_download_.insert(h.clone()) { + to_download.push(h); + } } } @@ -742,7 +746,9 @@ impl RemoteRepo { // In all cases, add this new change/state/tag to `to_download`. let ch = CS::Change(*h); if txn.get_revchanges(¤t_channel, h).unwrap().is_none() { - to_download.push(ch.clone()); + if to_download_.insert(ch.clone()) { + to_download.push(ch.clone()); + } if *is_tag { to_download.push(CS::State(*m)); }