Fixing a bug in `pijul dependents` where non-dependents could be listed (and making the command deterministic)
Dependencies
- [2]
IQ7VWYOKListing dependents of the root change - [3]
VWJ2JL63Adding a `pijul dependents` command to list the transitive closure of the reverse dependency relation
Change contents
- edit in pijul/src/commands/dependents.rs at line 5
use log::debug; - edit in pijul/src/commands/dependents.rs at line 23
let channel_name = txn.current_channel().unwrap_or(crate::DEFAULT_CHANNEL);let channel = if let Some(channel) = txn.load_channel(&channel_name)? {channel} else {return Ok(());};let channelr = channel.read(); - replacement in pijul/src/commands/dependents.rs at line 32
if let Some(h) = Hash::from_base32(hash.as_bytes()) {let h = if let Some(h) = Hash::from_base32(hash.as_bytes()) { - edit in pijul/src/commands/dependents.rs at line 36
};if txn.has_change(&channel, &h.into())?.is_none() {return Ok(()) - edit in pijul/src/commands/dependents.rs at line 40
h - replacement in pijul/src/commands/dependents.rs at line 42
let channel_name = txn.current_channel().unwrap_or(crate::DEFAULT_CHANNEL);let channel = if let Some(channel) = txn.load_channel(&channel_name)? {channel} else {return Ok(());};let channel = channel.read();if let Some(h) = txn.reverse_log(&*channel, None)?.next() {if let Some(h) = txn.reverse_log(&*channelr, None)?.next() { - replacement in pijul/src/commands/dependents.rs at line 53
let mut ids = vec![(txn.get_internal(&hash.into())?.unwrap(), false)];let mut ids = vec![(txn.get_internal(&hash.into())?.unwrap(), 0u64, false)]; - replacement in pijul/src/commands/dependents.rs at line 56
while let Some((id, v)) = ids.pop() {while let Some((id, n, v)) = ids.pop() { - replacement in pijul/src/commands/dependents.rs at line 61
ids.push((id, true));ids.push((id, n, true));let l = ids.len(); - replacement in pijul/src/commands/dependents.rs at line 64
let (_, t) = t?;ids.push((t, false));let (id_, t) = t?;if id_ > id {break}if let Some(n) = txn.get_changeset(txn.changes(&channelr), t)? {ids.push((t, (*n).into(), false));}