Resurrecting known deleted files instead of re-adding them (this is needed after `tag reset`)

pmeunier
Dec 30, 2021, 1:52 PM
PXR7LQ26P3UJ3XHGJDCFJMXVAXQS3OGE4AESRVMEI74AWYKAHSAQC

Dependencies

  • [2] ZDK3GNDB Tag transactions (including a massive refactoring of errors)
  • [3] CCLLB7OI Upgrading to Sanakirja 0.15 + version bump
  • [4] FXEDPLRI Resurrecting tests, and type cleanup (no need for Arc<RwLock<…>> anymore)
  • [5] RMDMAYRX Adding a root inode (aka supporting submodules)
  • [6] I24UEJQL Various post-fire fixes
  • [7] ZSF3YFZT encoded file deletion
  • [8] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).

Change contents

  • replacement in libpijul/src/record.rs at line 259
    [3.492511][3.44226:44271]()
    if e?.flag().is_alive_parent() {
    [3.492511]
    [3.44271]
    if e?.flag().is_parent() {
  • replacement in libpijul/src/record.rs at line 909
    [3.98198][3.6725:6768]()
    let (former_parents, is_deleted) =
    [3.98198]
    [3.6768]
    let (former_parents, is_deleted, encoding) =
  • edit in libpijul/src/record.rs at line 915
    [3.501352][3.58842:58887]()
    assert!(!former_parents.is_empty());
  • edit in libpijul/src/record.rs at line 930
    [3.7214]
    [3.7214]
    encoding,
  • edit in libpijul/src/record.rs at line 961
    [3.7876]
    [2.17274]
    encoding: Option<Encoding>,
  • replacement in libpijul/src/record.rs at line 966
    [3.8029][3.8029:8065]()
    if former_parents.len() > 1
    [3.8029]
    [3.8065]
    if former_parents.is_empty() {
    // This is the case where the inode exists both in the
    // graph and in the inode tables, but isn't alive in the
    // graph.
    //
    // This can happen (1) when outputting a tag that has this
    // file, after recording the deletion of the file, or (2)
    // when recording after applying, but before outputting,
    // but this is a misuse of the library.
    debug!("new_papa = {:?}", new_papa);
    self.record_moved_file::<_, _, W>(
    changes,
    txn,
    channel,
    &item,
    vertex,
    new_papa.unwrap(),
    encoding,
    )?
    } else if former_parents.len() > 1
  • replacement in libpijul/src/record.rs at line 1190
    [3.10235][2.17569:17638]()
    ) -> Result<(Vec<Parent>, bool), RecordError<C::Error, W::Error, T>>
    [3.10235]
    [3.10316]
    ) -> Result<(Vec<Parent>, bool, Option<Encoding>), RecordError<C::Error, W::Error, T>>
  • edit in libpijul/src/record.rs at line 1198
    [3.10502]
    [3.10502]
    let mut encoding_ = None;
  • replacement in libpijul/src/record.rs at line 1206
    [3.10778][3.10778:10939]()
    if name_.flag().contains(EdgeFlags::DELETED) {
    debug!("is_deleted {:?}", name_);
    is_deleted = true;
    break;
    }
    [3.10778]
    [3.10939]
  • edit in libpijul/src/record.rs at line 1226
    [3.11529]
    [3.11529]
    if name_.flag().contains(EdgeFlags::DELETED) {
    debug!("is_deleted {:?}", name_);
    is_deleted = true;
    if encoding_.is_none() {
    encoding_ = encoding
    }
    break;
    }
  • edit in libpijul/src/record.rs at line 1238
    [3.11723]
    [3.11723]
    if encoding_.is_none() {
    encoding_ = encoding.clone()
    }
  • replacement in libpijul/src/record.rs at line 1250
    [3.11984][3.11984:12021]()
    Ok((former_parents, is_deleted))
    [3.11984]
    [3.12021]
    Ok((former_parents, is_deleted, encoding_))