Fixing a bug in `pijul dependents` where non-dependents could be listed (and making the command deterministic)

pmeunier
May 21, 2023, 8:40 PM
STOFOQI47HS22EDKDFUFF4Z5NNZ6MXJFXETEZSITTOD7OYTETB2AC

Dependencies

  • [2] IQ7VWYOK Listing dependents of the root change
  • [3] VWJ2JL63 Adding 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
    [3.323]
    [3.323]
    use log::debug;
  • edit in pijul/src/commands/dependents.rs at line 23
    [3.872]
    [3.872]
    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
    [3.924][3.924:990]()
    if let Some(h) = Hash::from_base32(hash.as_bytes()) {
    [3.924]
    [3.990]
    let h = if let Some(h) = Hash::from_base32(hash.as_bytes()) {
  • edit in pijul/src/commands/dependents.rs at line 36
    [3.1076]
    [3.1076]
    };
    if txn.has_change(&channel, &h.into())?.is_none() {
    return Ok(())
  • edit in pijul/src/commands/dependents.rs at line 40
    [3.1090]
    [3.1090]
    h
  • replacement in pijul/src/commands/dependents.rs at line 42
    [3.1107][3.1107:1484]()
    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() {
    [3.1107]
    [3.1484]
    if let Some(h) = txn.reverse_log(&*channelr, None)?.next() {
  • replacement in pijul/src/commands/dependents.rs at line 53
    [2.118][3.1594:1673](),[3.1594][3.1594:1673]()
    let mut ids = vec![(txn.get_internal(&hash.into())?.unwrap(), false)];
    [2.118]
    [3.1673]
    let mut ids = vec![(txn.get_internal(&hash.into())?.unwrap(), 0u64, false)];
  • replacement in pijul/src/commands/dependents.rs at line 56
    [3.1756][3.1756:1802]()
    while let Some((id, v)) = ids.pop() {
    [3.1756]
    [3.1802]
    while let Some((id, n, v)) = ids.pop() {
  • replacement in pijul/src/commands/dependents.rs at line 61
    [3.1987][3.1987:2025]()
    ids.push((id, true));
    [3.1987]
    [3.2025]
    ids.push((id, n, true));
    let l = ids.len();
  • replacement in pijul/src/commands/dependents.rs at line 64
    [3.2082][3.2082:2161]()
    let (_, t) = t?;
    ids.push((t, false));
    [3.2082]
    [3.2161]
    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));
    }