Do not output unmodified files when resetting (fix)

[?]
Jan 10, 2021, 6:01 PM
VNBLGT6GAN2AHKRFKTKED7WNDDRGNULY5H343ZYV3ETSDZZKGBTAC

Dependencies

  • [2] DJYHARZ7 Skipping old files when recording
  • [3] XA23FMQM Reset only files that have been modified
  • [4] WZVCLZKY address clippy lints
  • [5] VQPAUKBQ channel switch as an alias to reset
  • [6] Y7YAFMFF Fix path prefix striping on Windows.
  • [7] CCLLB7OI Upgrading to Sanakirja 0.15 + version bump
  • [8] QMTANHVN Reset: only output changed files
  • [9] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [10] L4JXJHWX pijul/*: reorganize imports and remove extern crate
  • [11] I52XSRUH Massive cleanup, and simplification
  • [12] QYY37T6Y Fixing a panic with reset --dry-run and no input
  • [*] VO5OQW4W Removing anyhow in libpijul

Change contents

  • replacement in pijul/src/commands/reset.rs at line 7
    [4.1330][4.43:89]()
    use libpijul::pristine::{ChangeId, Position};
    [4.1330]
    [4.89]
    use libpijul::pristine::{ChangeId, ChannelMutTxnT, Position};
  • replacement in pijul/src/commands/reset.rs at line 72
    [4.604][4.165:204](),[4.204][3.65:145](),[3.145][4.204:486](),[4.204][4.204:486](),[4.486][3.146:191](),[3.191][4.486:545](),[4.486][4.486:545]()
    if overwrite_changes {
    let last_modified = last_modified(&txn, &channel.borrow());
    txn.output_repository_no_pending(
    &mut repo.working_copy,
    &repo.changes,
    &mut channel,
    &mut HashMap::new(),
    "",
    true,
    Some(last_modified),
    )?;
    txn.commit()?;
    [4.604]
    [4.869]
    if !overwrite_changes {
    return Ok(());
  • edit in pijul/src/commands/reset.rs at line 75
    [4.887][4.546:577]()
    return Ok(());
  • edit in pijul/src/commands/reset.rs at line 96
    [4.100946]
    [4.578]
    if self.channel.is_none() || self.channel.as_deref() == Some(current_channel) {
    let last_modified = last_modified(&txn, &channel.borrow());
    txn.output_repository_no_pending(
    &mut repo.working_copy,
    &repo.changes,
    &mut channel,
    &mut HashMap::new(),
    "",
    true,
    Some(last_modified),
    )?;
    txn.touch_channel(&mut channel.borrow_mut(), None);
    txn.commit()?;
    return Ok(());
    }
  • replacement in pijul/src/commands/record.rs at line 123
    [4.105296][2.371:686]()
    let oldest = std::time::SystemTime::now();
    let oldest = if let Ok(t) = oldest.duration_since(std::time::SystemTime::UNIX_EPOCH) {
    t.as_secs() as u64
    } else {
    0
    };
    txn.touch_channel(&mut channel.borrow_mut(), Some(oldest));
    [4.105296]
    [2.686]
    txn.touch_channel(&mut channel.borrow_mut(), None);
  • replacement in libpijul/src/output/output.rs at line 187
    [4.678511][3.1699:2082]()
    let output = if let Some(m) = if_modified_after {
    if let Ok(last) = repo.modified_time(&path) {
    last >= m
    } else {
    true
    }
    } else {
    true
    };
    if output {
    [4.678511]
    [3.2082]
    if needs_output(repo, if_modified_after, &path) {
  • edit in libpijul/src/output/output.rs at line 199
    [3.2574]
    [3.2574]
    } else {
    debug!("Not outputting {:?}", path)
  • edit in libpijul/src/output/output.rs at line 231
    [14.21084]
    [4.82825]
    fn needs_output<R: WorkingCopy>(repo: &R, if_modified_after: Option<std::time::SystemTime>, path: &str) -> bool {
    if let Some(m) = if_modified_after {
    if let Ok(last) = repo.modified_time(path) {
    debug!("modified_after: {:?} {:?}", m, last);
    if let Ok(d) = last.duration_since(m) {
    return d.as_secs() > 0
    } else {
    return false
    }
    }
    }
    true
    }