Fixing the "old file optimisation" in record, after the move to parallelisable records
[?]
Apr 24, 2021, 6:50 AM
F6V27C3M7GZHBHXMGAZMYO5XGWDYYNNIF2HLDE2VPNHTEVDSYGVQCDependencies
- [2]
7MNTFTDFExit with an error when a change could not be signed - [3]
I24UEJQLVarious post-fire fixes - [4]
YN63NUZOSanakirja 1.0 - [5]
SXEYMYF7Fixing the bad changes in history (unfortunately, by rebooting). - [6]
DJYHARZ7Skipping old files when recording - [7]
I2D35LLFMore accurate recording of modification time - [8]
RXNT67OTSanakirja version, and removing an unwrap - [9]
VNBLGT6GDo not output unmodified files when resetting (fix) - [10]
KWAGWB73Adding extra dependencies from the config file - [11]
IIV3EL2XCleanup, formatting, and fixing the Git feature - [12]
I52XSRUHMassive cleanup, and simplification - [13]
GP5AAWEKDo not touch the channel if the user does not want to record - [14]
MFTN7GBWPre-tags cleanup + fast Sanakirja - [15]
JL4WKA5PImplement the Sanakirja concurrency model in a cross-process way - [16]
G6S6PWZEDo not touch the channel if this is a partial record - [17]
VE2UWMW4Trying to fix channel touch - [18]
YDTN6BGITouch the channel if no file was changed
Change contents
- replacement in pijul/src/commands/record.rs at line 135[4.104255]→[3.13303:13376](∅→∅),[4.95]→[4.104315:104455](∅→∅),[4.109]→[4.104315:104455](∅→∅),[3.13376]→[4.104315:104455](∅→∅),[4.104315]→[4.104315:104455](∅→∅),[4.104455]→[2.0:704](∅→∅)
if let Some((txn, mut change, updates, hash, oldest)) = result {let hash = hash.unwrap();if sign {let mut key_path = dirs_next::home_dir().unwrap().join(".ssh");match sign_hash(&mut key_path, hash).await? {Some((pk, signature)) if !signature.is_empty() => {let sig = toml::Value::try_from(vec![Signature {public_key: pk,timestamp: change.header.timestamp,signature,}])?;let mut toml = toml::map::Map::new();toml.insert("signatures".to_string(), sig);change.unhashed = Some(toml.into());let hash2 = repo.changes.save_change(&change).unwrap();assert_eq!(hash2, hash);match result {Either::A((txn, mut change, updates, hash, oldest)) => {let hash = hash.unwrap();if sign {let mut key_path = dirs_next::home_dir().unwrap().join(".ssh");match sign_hash(&mut key_path, hash).await? {Some((pk, signature)) if !signature.is_empty() => {let sig = toml::Value::try_from(vec![Signature {public_key: pk,timestamp: change.header.timestamp,signature,}])?;let mut toml = toml::map::Map::new();toml.insert("signatures".to_string(), sig);change.unhashed = Some(toml.into());let hash2 = repo.changes.save_change(&change).unwrap();assert_eq!(hash2, hash);}_ => {bail!("Could not sign the change");} - edit in pijul/src/commands/record.rs at line 157
_ => {bail!("Could not sign the change");} - replacement in pijul/src/commands/record.rs at line 158[4.105101]→[4.105101:105115](∅→∅),[4.105115]→[3.13377:13552](∅→∅),[3.13552]→[4.10252:10329](∅→∅),[4.10252]→[4.10252:10329](∅→∅),[4.10329]→[4.105191:105252](∅→∅),[4.105191]→[4.105191:105252](∅→∅),[4.298]→[4.0:45](∅→∅),[4.45]→[4.53:82](∅→∅),[4.298]→[4.53:82](∅→∅),[4.82]→[4.0:529](∅→∅)
}let mut txn = if let Ok(txn) = Arc::try_unwrap(txn) {txn.into_inner().unwrap()} else {unreachable!()};txn.apply_local_change(&mut channel, &change, &hash, &updates)?;writeln!(stdout, "Hash: {}", hash.to_base32())?;debug!("oldest = {:?}", oldest);if no_prefixes {let mut oldest = oldest.duration_since(std::time::SystemTime::UNIX_EPOCH).unwrap().as_secs() as u64;if oldest == 0 {// If no diff was done at all, it means that no// existing file changed since last time (some// files may have been added, deleted or moved,// but `touch` isn't about those).oldest = std::time::SystemTime::now()let mut txn = if let Ok(txn) = Arc::try_unwrap(txn) {txn.into_inner().unwrap()} else {unreachable!()};txn.apply_local_change(&mut channel, &change, &hash, &updates)?;writeln!(stdout, "Hash: {}", hash.to_base32())?;debug!("oldest = {:?}", oldest);if no_prefixes {let mut oldest = oldest - edit in pijul/src/commands/record.rs at line 171
if oldest == 0 {// If no diff was done at all, it means that no// existing file changed since last time (some// files may have been added, deleted or moved,// but `touch` isn't about those).oldest = std::time::SystemTime::now().duration_since(std::time::SystemTime::UNIX_EPOCH).unwrap().as_secs() as u64;}txn.touch_channel(&mut *channel.write()?, Some(oldest)); - replacement in pijul/src/commands/record.rs at line 183
txn.touch_channel(&mut *channel.write()?, Some(oldest));txn.commit()?;}Either::B(txn) => {if no_prefixes {let mut txn = if let Ok(txn) = Arc::try_unwrap(txn) {txn.into_inner().unwrap()} else {unreachable!()};txn.touch_channel(&mut *channel.write()?, None);txn.commit()?;}writeln!(stderr, "Nothing to record")?; - edit in pijul/src/commands/record.rs at line 197[4.172]→[4.105252:105279](∅→∅),[4.370]→[4.105252:105279](∅→∅),[4.105252]→[4.105252:105279](∅→∅),[4.6369]→[4.105279:105296](∅→∅),[4.105279]→[4.105279:105296](∅→∅),[4.315]→[4.105296:105348](∅→∅),[4.713]→[4.105296:105348](∅→∅),[4.105296]→[4.105296:105348](∅→∅)
txn.commit()?;} else {writeln!(stderr, "Nothing to record")?; - replacement in pijul/src/commands/record.rs at line 248
Option<(Either<( - replacement in pijul/src/commands/record.rs at line 254
)>,), Arc<RwLock<T>>>, - replacement in pijul/src/commands/record.rs at line 305[4.107578]→[3.14379:14615](∅→∅),[3.14615]→[4.224:251](∅→∅),[4.224]→[4.224:251](∅→∅),[4.251]→[4.107578:107607](∅→∅),[4.107578]→[4.107578:107607](∅→∅)
let mut txn = if let Ok(txn) = Arc::try_unwrap(txn) {txn.into_inner().unwrap()} else {unreachable!()};txn.touch_channel(&mut *channel.write()?, None);txn.commit()?;return Ok(None);return Ok(Either::B(txn)); - replacement in pijul/src/commands/record.rs at line 380
Ok(Some((Ok(Either::A(( - edit in pijul/src/commands/record.rs at line 390
enum Either<A, B> {A(A),B(B)} - replacement in libpijul/src/record.rs at line 154
result.oldest_change = result.oldest_change.min(rec.oldest_change);if result.oldest_change == std::time::UNIX_EPOCH|| (rec.oldest_change > std::time::UNIX_EPOCH&& rec.oldest_change < result.oldest_change){result.oldest_change = rec.oldest_change}