Skip to content

Commit

Permalink
Update pijul
Browse files Browse the repository at this point in the history
  • Loading branch information
fossdd committed May 14, 2022
1 parent dd1202d commit c281be2
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 16 deletions.
9 changes: 6 additions & 3 deletions libpijul/src/apply/edge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
}
Expand All @@ -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)
}
Expand All @@ -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)
Expand Down Expand Up @@ -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))
Expand Down
1 change: 1 addition & 0 deletions libpijul/src/changestore/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ pub trait ChangeStore {
Ok(self.get_change(hash)?.hashed.changes)
}
fn knows(&self, hash0: &Hash, hash1: &Hash) -> Result<bool, Self::Error> {
debug!("knows: {:?} {:?}", hash0, hash1);
Ok(self.get_change(hash0)?.knows(hash1))
}
fn has_edge(
Expand Down
2 changes: 2 additions & 0 deletions libpijul/src/find_alive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
9 changes: 6 additions & 3 deletions libpijul/src/unrecord/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,10 +443,13 @@ fn unapply_edges<T: GraphMutTxnT + TreeTxnT, P: ChangeStore>(
&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()
Expand Down
8 changes: 0 additions & 8 deletions pijul/src/commands/credit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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_,
Expand Down Expand Up @@ -179,8 +176,3 @@ impl<W: std::io::Write, T: TxnTExt> VertexBuffer for Creditor<W, T> {
Ok(())
}
}
======= 1 [U6TQX5Z2]
>>>>>>> 2 [U6TQX5Z2]
super::pager(repo.config.pager.as_ref());
<<<<<<< 2
<<<<<<< 1
10 changes: 8 additions & 2 deletions pijul/src/remote/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,7 @@ impl RemoteRepo {
})
} else {
let mut to_download: Vec<CS> = 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();
Expand All @@ -732,7 +733,10 @@ impl RemoteRepo {
break;
}
if txn.get_revchanges(&current_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);
}
}
}

Expand All @@ -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(&current_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));
}
Expand Down

0 comments on commit c281be2

Please sign in to comment.