Skip to content

Commit c281be2

Browse files
author
fossdd
committed
Update pijul
1 parent dd1202d commit c281be2

File tree

6 files changed

+23
-16
lines changed

6 files changed

+23
-16
lines changed

libpijul/src/apply/edge.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ where
106106
}
107107
}
108108
if n.flag.contains(EdgeFlags::DELETED) {
109+
// We're deleting a vertex n.to. If n has children or parents
110+
// that are unknown to the patch we're applying, zombify these
111+
// children and parents.
109112
collect_zombie_context(txn, graph, &mut ws.missing_context, inode, n, change, known)
110113
.map_err(LocalApplyError::from_missing)?;
111114
}
@@ -128,7 +131,7 @@ where
128131
// edge points towards a zombie.
129132
for v in iter_deleted_parents(txn, graph, source)? {
130133
let v = v?;
131-
let intro = v.introduced_by();
134+
let intro = v.dest().change;
132135
if !known(&txn.get_external(&intro)?.unwrap().into()) {
133136
zombies.push(intro)
134137
}
@@ -142,7 +145,7 @@ where
142145
}
143146
for v in iter_deleted_parents(txn, graph, target)? {
144147
let v = v?;
145-
let intro = v.introduced_by();
148+
let intro = v.dest().change;
146149
debug!("known {:?} ?", intro);
147150
if !known(&txn.get_external(&intro)?.unwrap().into()) {
148151
zombies.push(intro)
@@ -335,7 +338,7 @@ where
335338
}
336339
if v.flag().contains(EdgeFlags::PARENT) {
337340
// Unwrap ok, since `v` is in the channel.
338-
let intro = txn.get_external(&v.introduced_by())?.unwrap().into();
341+
let intro = txn.get_external(&v.dest().change)?.unwrap().into();
339342
if !known(&intro) {
340343
debug!("unknown: {:?}", v);
341344
unknown_parents.push((dest_vertex, *v))

libpijul/src/changestore/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ pub trait ChangeStore {
5555
Ok(self.get_change(hash)?.hashed.changes)
5656
}
5757
fn knows(&self, hash0: &Hash, hash1: &Hash) -> Result<bool, Self::Error> {
58+
debug!("knows: {:?} {:?}", hash0, hash1);
5859
Ok(self.get_change(hash0)?.knows(hash1))
5960
}
6061
fn has_edge(

libpijul/src/find_alive.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ pub(crate) fn find_alive_down<'a, T: GraphTxnT>(
4040
if let Some(c) = c {
4141
st.extend(c.iter().cloned());
4242
} else {
43+
// A `None` in the cache means that the vertex
44+
// itself (the cache key) is alive.
4345
st.insert(*vertex);
4446
}
4547
}

libpijul/src/unrecord/mod.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,10 +443,13 @@ fn unapply_edges<T: GraphMutTxnT + TreeTxnT, P: ChangeStore>(
443443
&edge.reverse(Some(ext)),
444444
|a, b| reintro.contains(&(a, b)),
445445
|h| {
446+
if h == &hash {
447+
return true
448+
}
446449
if edge.previous.contains(EdgeFlags::DELETED) {
447-
// When reintroducing a deleted flag, check whether
448-
// the re-introduction patch knows about the alive
449-
// edges around the target.
450+
// When reintroducing an edge that was deleted,
451+
// check whether the re-introduction patch knows
452+
// about the alive edges around the target.
450453
changes
451454
.knows(edge.introduced_by.as_ref().unwrap_or(&hash), h)
452455
.unwrap()

pijul/src/commands/credit.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,10 @@ impl Credit {
5050
let path = root.strip_prefix(&repo_path.as_path())?.to_str().unwrap();
5151
txn.follow_oldest_path(&repo.changes, &channel, &path)?
5252
};
53-
>>>>>>> 1 [YXAVFTPP]
54-
>>>>>>> 1 [YXAVFTPP]
5553
std::mem::drop(txn);
5654

5755
super::pager(repo.config.pager.as_ref());
5856

59-
<<<<<<< 1
6057
match libpijul::output::output_file(
6158
&repo.changes,
6259
&txn_,
@@ -179,8 +176,3 @@ impl<W: std::io::Write, T: TxnTExt> VertexBuffer for Creditor<W, T> {
179176
Ok(())
180177
}
181178
}
182-
======= 1 [U6TQX5Z2]
183-
>>>>>>> 2 [U6TQX5Z2]
184-
super::pager(repo.config.pager.as_ref());
185-
<<<<<<< 2
186-
<<<<<<< 1

pijul/src/remote/mod.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,7 @@ impl RemoteRepo {
721721
})
722722
} else {
723723
let mut to_download: Vec<CS> = Vec::new();
724+
let mut to_download_ = HashSet::new();
724725
for x in txn.iter_rev_remote(&remote_ref.lock().remote, None)? {
725726
let (_, p) = x?;
726727
let h: Hash = p.a.into();
@@ -732,7 +733,10 @@ impl RemoteRepo {
732733
break;
733734
}
734735
if txn.get_revchanges(&current_channel, &h).unwrap().is_none() {
735-
to_download.push(CS::Change(h));
736+
let h = CS::Change(h);
737+
if to_download_.insert(h.clone()) {
738+
to_download.push(h);
739+
}
736740
}
737741
}
738742

@@ -742,7 +746,9 @@ impl RemoteRepo {
742746
// In all cases, add this new change/state/tag to `to_download`.
743747
let ch = CS::Change(*h);
744748
if txn.get_revchanges(&current_channel, h).unwrap().is_none() {
745-
to_download.push(ch.clone());
749+
if to_download_.insert(ch.clone()) {
750+
to_download.push(ch.clone());
751+
}
746752
if *is_tag {
747753
to_download.push(CS::State(*m));
748754
}

0 commit comments

Comments
 (0)