Skipping old files when recording

[?]
Jan 10, 2021, 5:10 PM
DJYHARZ7CSRMX6ZFM6P52SM2EC57VTSHWAIMFSD7Q3EL7UYZGLXQC

Dependencies

  • [2] 7FFFKQZU add 'Default' implementations
  • [3] GHO6DWPI Refactoring iterators
  • [4] CCLLB7OI Upgrading to Sanakirja 0.15 + version bump
  • [5] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [6] CCFJ7VO3 Renaming "Record" to "Hunk" in the changes
  • [7] O4DNWMPD Cleaunp and proofreading of libpijul::record
  • [8] ZHABNS3S Canonicalize all paths
  • [9] KQTD46KV Unrecord: restore files *after* having unapplied the *entire* change
  • [10] VO5OQW4W Removing anyhow in libpijul
  • [11] 6YMDOZIB Refactoring apply
  • [*] I52XSRUH Massive cleanup, and simplification

Change contents

  • edit in pijul/src/commands/record.rs at line 11
    [4.101876]
    [13.2137]
    use libpijul::pristine::ChannelMutTxnT;
  • replacement in pijul/src/commands/record.rs at line 96
    [4.104255][4.104255:104315]()
    if let Some((mut change, updates, hash)) = result {
    [4.104255]
    [4.104315]
    if let Some((mut change, updates, hash, oldest)) = result {
  • edit in pijul/src/commands/record.rs at line 115
    [4.105252]
    [4.105252]
    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));
  • edit in pijul/src/commands/record.rs at line 123
    [4.105296]
    [4.105296]
    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));
    txn.commit()?;
  • edit in pijul/src/commands/record.rs at line 183
    [13.2303]
    [4.106865]
    std::time::SystemTime,
  • replacement in pijul/src/commands/record.rs at line 264
    [4.109803][4.109803:109858]()
    Ok(Some((change, rec.updatables, Some(hash))))
    [4.109803]
    [4.109858]
    Ok(Some((
    change,
    rec.updatables,
    Some(hash),
    rec.oldest_change,
    )))
  • replacement in libpijul/src/unrecord/mod.rs at line 209
    [3.2573][3.2573:2613]()
    T::touch_channel(channel, Some(0));
    [3.2573]
    [4.235705]
    txn.touch_channel(channel, Some(0));
  • edit in libpijul/src/record.rs at line 65
    [4.489820][2.365:384]()
    #[derive(Default)]
  • edit in libpijul/src/record.rs at line 77
    [4.490405]
    [4.490405]
    /// Timestamp of the oldest changed file. If nothing changed,
    /// returns now().
    pub oldest_change: std::time::SystemTime,
  • replacement in libpijul/src/record.rs at line 85
    [2.454][2.454:492]()
    rec: Recorded::default(),
    [2.454]
    [4.490736]
    rec: Recorded {
    contents: Vec::new(),
    actions: Vec::new(),
    updatables: HashMap::new(),
    largest_file: 0,
    has_binary_files: false,
    oldest_change: std::time::SystemTime::now(),
    },
  • replacement in libpijul/src/record.rs at line 97
    [4.490902][4.490902:490934]()
    force_rediff: true,
    [4.490902]
    [4.490934]
    force_rediff: false,
  • replacement in libpijul/src/record.rs at line 426
    [4.502359][3.28743:28844]()
    || modified_since_last_commit::<T, _>(&channel, working_copy, &item.full_path)?)
    [4.502359]
    [4.502452]
    || self.modified_since_last_commit::<T, _>(&channel, working_copy, &item.full_path)?)
  • edit in libpijul/src/record.rs at line 445
    [4.503028]
    [4.2801]
    if self.rec.actions.len() > len {
    if let Ok(last_modified) = working_copy.modified_time(&item.full_path) {
    self.rec.oldest_change = self.rec.oldest_change.min(last_modified);
    }
    }
  • edit in libpijul/src/record.rs at line 599
    [4.506852][4.506852:506854]()
    }
  • replacement in libpijul/src/record.rs at line 600
    [4.506855][4.35714:35777](),[4.35777][3.29319:29345](),[3.29345][4.506992:507032](),[4.506992][4.506992:507032](),[4.507032][4.12447:12495](),[4.12495][4.507067:507318](),[4.507067][4.507067:507318](),[4.507318][3.29346:29384](),[3.29384][4.507352:507479](),[4.507352][4.507352:507479](),[4.507479][3.29385:29427](),[3.29427][4.507517:507547](),[4.507517][4.507517:507547]()
    fn modified_since_last_commit<T: ChannelTxnT, W: WorkingCopy>(
    channel: &T::Channel,
    working_copy: &W,
    prefix: &str,
    ) -> Result<bool, std::time::SystemTimeError> {
    if let Ok(last_modified) = working_copy.modified_time(prefix) {
    debug!(
    "last_modified = {:?}, channel.last = {:?}",
    last_modified
    .duration_since(std::time::UNIX_EPOCH)?
    .as_secs(),
    T::last_modified(channel)
    );
    Ok(last_modified
    .duration_since(std::time::UNIX_EPOCH)?
    .as_secs()
    + 2
    >= T::last_modified(channel))
    } else {
    Ok(true)
    [4.506855]
    [4.507547]
    fn modified_since_last_commit<T: ChannelTxnT, W: WorkingCopy>(
    &mut self,
    channel: &T::Channel,
    working_copy: &W,
    prefix: &str,
    ) -> Result<bool, std::time::SystemTimeError> {
    if let Ok(last_modified) = working_copy.modified_time(prefix) {
    debug!(
    "last_modified = {:?}, channel.last = {:?}",
    last_modified
    .duration_since(std::time::UNIX_EPOCH)?
    .as_secs(),
    T::last_modified(channel)
    );
    Ok(last_modified
    .duration_since(std::time::UNIX_EPOCH)?
    .as_secs()
    + 2
    >= T::last_modified(channel))
    } else {
    Ok(true)
    }
  • replacement in libpijul/src/pristine/sanakirja.rs at line 1399
    [3.47718][3.47718:47786]()
    fn touch_channel(channel: &mut Self::Channel, t: Option<u64>) {
    [3.47718]
    [3.47786]
    fn touch_channel(&mut self, channel: &mut Self::Channel, t: Option<u64>) {
  • replacement in libpijul/src/pristine/mod.rs at line 1342
    [3.55817][3.55817:55884]()
    fn touch_channel(channel: &mut Self::Channel, t: Option<u64>);
    [3.55817]
    [3.55884]
    fn touch_channel(&mut self, channel: &mut Self::Channel, t: Option<u64>);
  • edit in libpijul/src/apply.rs at line 291
    [4.951945][3.65418:65455]()
    T::touch_channel(channel, None);