Faster error in unrecord when the change is not on the channel

[?]
Apr 29, 2021, 2:30 PM
K7JPP64SNKZNMB6XJAYYHDC2464I3BQDLVA3IX4YCQZ4P5TXZXRAC

Dependencies

  • [2] I24UEJQL Various post-fire fixes
  • [3] MHQBEHJD unrecord --reset without a pending change
  • [4] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [5] Y6EVFMTA Don't output files if they aren't in the current channel
  • [6] EGSVRZJV Avoid converting between base32 and hash in pijul::commands::unrecord
  • [7] YAJAXIV5 Unrecording changes atomically
  • [8] SLJ3OHD4 unrecord: show list of changes if none were given as arguments
  • [9] 5DVRL6MF Hard-unrecord
  • [10] CCLLB7OI Upgrading to Sanakirja 0.15 + version bump

Change contents

  • edit in pijul/src/commands/unrecord.rs at line 47
    [2.2241][2.2241:2546](),[2.2546][3.485:486](),[3.485][3.485:486]()
    let pending_hash = if self.reset {
    super::pending(txn.clone(), &channel, &mut repo)?
    } else {
    None
    };
    let mut txn = if let Ok(txn) = Arc::try_unwrap(txn) {
    txn.into_inner().unwrap()
    } else {
    unreachable!()
    };
  • edit in pijul/src/commands/unrecord.rs at line 65
    [3.2791]
    [2.3331]
    let txn = txn.read().unwrap();
  • edit in pijul/src/commands/unrecord.rs at line 76
    [2.3800]
    [2.3800]
    let txn = txn.read().unwrap();
  • replacement in pijul/src/commands/unrecord.rs at line 84
    [2.4072][2.4072:4299]()
    for (hash, change_id) in hashes {
    let n = txn
    .get_changeset(txn.changes(&channel_), &change_id)
    .unwrap();
    changes.push((hash, change_id, n.map(|&x| x.into())));
    [2.4072]
    [2.4299]
    {
    let txn = txn.read().unwrap();
    for (hash, change_id) in hashes {
    let n = txn
    .get_changeset(txn.changes(&channel_), &change_id)
    .unwrap();
    if n.is_none() {
    bail!("Change not in channel: {:?}", hash)
    }
    changes.push((hash, change_id, n.map(|&x| x.into())));
    }
  • edit in pijul/src/commands/unrecord.rs at line 96
    [2.4309]
    [2.4309]
    debug!("changes: {:?}", changes);
  • edit in pijul/src/commands/unrecord.rs at line 98
    [2.4343]
    [2.4343]
    let pending_hash = if self.reset {
    super::pending(txn.clone(), &channel, &mut repo)?
    } else {
    None
    };
  • replacement in pijul/src/commands/unrecord.rs at line 106
    [2.4480][2.4480:4532]()
    for p in txn.iter_revdep(&change_id)? {
    [2.4480]
    [2.4532]
    let txn_ = txn.read().unwrap();
    for p in txn_.iter_revdep(&change_id)? {
  • replacement in pijul/src/commands/unrecord.rs at line 114
    [2.4719][2.4719:4870]()
    if txn.get_changeset(txn.changes(&channel_), d)?.is_some() {
    let dep: Hash = txn.get_external(d)?.unwrap().into();
    [2.4719]
    [2.4870]
    if txn_.get_changeset(txn_.changes(&channel_), d)?.is_some() {
    let dep: Hash = txn_.get_external(d)?.unwrap().into();
  • replacement in pijul/src/commands/unrecord.rs at line 131
    [2.5418][2.5418:5477]()
    txn.unrecord(&repo.changes, &channel, &hash)?;
    [2.5418]
    [2.5477]
    std::mem::drop(txn_);
    txn.write().unwrap().unrecord(&repo.changes, &channel, &hash)?;
  • edit in pijul/src/commands/unrecord.rs at line 135
    [2.5488][2.5488:5534]()
    let txn = Arc::new(RwLock::new(txn));