Testing binary diff

pmeunier
Jul 11, 2021, 1:20 PM
V4T4SC7OL6WEZNV4XSFBSXY5HPB7VXPSXWSK4Z63QXKQD4JSFNCQC

Dependencies

  • [2] TNN56XYK libpijul alpha.43
  • [3] FDPGJDXV Compiling Thrussh with feature OpenSSL by default
  • [4] FXEDPLRI Resurrecting tests, and type cleanup (no need for Arc<RwLock<…>> anymore)
  • [5] G6YZ7U65 Version bump
  • [6] WI5BS6BS New published versions
  • [7] HW5Q7GGY Version bump
  • [8] BNPSVXIC Friendlier progress bars
  • [9] 3AZB5NUO Fixing the Git feature
  • [10] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [11] ZQXP3HNA Version bump
  • [12] XAY4DYRR Version bump
  • [13] FYUDBQ3C Formatting changes + version bump
  • [14] UN64Q3P2 Version bump
  • [15] HQ56ADNS Formatting, and version bump
  • [16] 6DOXSHWG Cleanup, and version bump
  • [17] VYHHOEYH Versions and formatting
  • [18] HDGRZISM Version updates
  • [19] TPEH2XNB 1.0.0-alpha.28, with Tokio 1.0
  • [20] 4DNDMC7I Fixing a number of bugs related to encodings (extra newlines + misdetection in linux2x)
  • [21] G65S7FAW Version bump and cleanup
  • [22] HR3WK6A7 When lock times out, check that there are no more clients before quitting
  • [23] CUHXXBDZ Fixing a bug in replacements, recently introduced during a fix of a graph corruption bug
  • [24] B5Z4IMEU Generating Cargo.nix for pijul 1.0.0-alpha.6
  • [25] NX5I5H53 New published versions
  • [26] H565UUPC Use correct pattern for workspace interdependencies
  • [27] CT6FBU57 SDPX license + version bump
  • [28] XL6Y64UP Fixing a panic when iterating over the basenames of a file
  • [29] SAGSYAPX Various version bumps
  • [30] OCBM7IFE New release: pijul-1.0.0-alpha.8
  • [31] 6CZYYOG7 Faster guessing of encoding
  • [32] B3QWIGDE Fixing the Git features with the latest Pijul (+ conflicts in Cargo.toml)
  • [33] HKEOO4QJ Version bump
  • [34] MNTJ3VOK Version bump
  • [35] UFCZKKLX Upgrading to the latest Sanakirja/Rand
  • [36] JACZWIJ6 Version bump
  • [37] WIORLB47 Version bump
  • [38] JL4WKA5P Implement the Sanakirja concurrency model in a cross-process way
  • [39] GBSL4AZI Version bump
  • [40] EEBKW7VT Keys and identities
  • [41] QJXNUQFJ Solving conflicts
  • [42] VRDOV7DD Versions
  • [43] I24UEJQL Various post-fire fixes
  • [44] A3RM526Y Integrating identity malleability
  • [45] OIOMXESD Better error handling in HTTP
  • [46] SN7AGY6S Making `pijul lock` robust to kill signals
  • [47] 3S4DR77Z Version updates
  • [48] JRENVH5D Reqwest 0.11
  • [49] CCLLB7OI Upgrading to Sanakirja 0.15 + version bump
  • [50] NA5I4WYN Fixing the inverse of conflict resolutions
  • [51] IIV3EL2X Cleanup, formatting, and fixing the Git feature
  • [52] OUWD436A Version bump
  • [53] SPA2OL5I keep-changes feature (default) to avoid deleting problematic changes
  • [54] YX3VCEOM Version bump
  • [55] WZVCLZKY address clippy lints
  • [56] 5YDI33C4 Fixing pager on OSX
  • [57] ZTVNGFNT Version bump
  • [58] HSVGP2G4 Version bump + formatting
  • [59] BT2ZHPY4 Version bumps
  • [60] 5BRU2RRW Cleanup (debugging a crash related to trees/inodes)
  • [61] FSNBD6GK Debugging information and Cargo.lock updates (attempting to measure and solve #468)
  • [62] WTRH4B2X Formatting
  • [*] TGA6QXGI Initial support for binary diffs (conflicts are not yet supported in the output)

Change contents

  • replacement in pijul/Cargo.toml at line 4
    [5.196462][3.0:27]()
    version = "1.0.0-alpha.50"
    [5.196462]
    [5.196488]
    version = "1.0.0-alpha.51"
  • replacement in pijul/Cargo.toml at line 54
    [5.197438][3.125:215]()
    libpijul = { path = "../libpijul", version = "1.0.0-alpha.43", features = [ "tarball" ] }
    [5.197438]
    [5.197523]
    libpijul = { path = "../libpijul", version = "1.0.0-alpha.44", features = [ "tarball" ] }
  • edit in libpijul/src/tests/mod.rs at line 13
    [5.289615]
    [5.289615]
    mod diff;
  • file addition: diff.rs (----------)
    [5.248792]
    use super::*;
    use crate::alive::retrieve;
    use rand::distributions::Alphanumeric;
    use rand::{Rng, SeedableRng};
    use rand_chacha::ChaCha20Rng;
    use std::io::Write;
    #[test]
    fn bin_diff_test() -> Result<(), anyhow::Error> {
    env_logger::try_init().unwrap_or(());
    let repo = working_copy::memory::Memory::new();
    let changes = changestore::memory::Memory::new();
    let mut contents = String::new();
    repo.add_file("file", contents.clone().into());
    let env = pristine::sanakirja::Pristine::new_anon()?;
    let id = {
    let txn = env.arc_txn_begin().unwrap();
    txn.write().add_file("file", 0).unwrap();
    let channel = txn.write().open_or_create_channel("main").unwrap();
    let h = record_all(&repo, &changes, &txn, &channel, "").unwrap();
    let id = *txn.read().get_internal(&h.into()).unwrap().unwrap();
    txn.commit().unwrap();
    id
    };
    let mut rng = ChaCha20Rng::seed_from_u64(1234);
    for i in 0..1000 {
    contents.extend(
    (&mut rng)
    .sample_iter(&Alphanumeric)
    .take(80)
    .map(char::from),
    );
    contents.push('\n');
    repo.write_file("file")
    .unwrap()
    .write_all(contents.as_bytes())
    .unwrap();
    if i % 10 == 0 {
    let txn = env.arc_txn_begin().unwrap();
    let channel = txn.write().open_or_create_channel("main").unwrap();
    record_all(&repo, &changes, &txn, &channel, "").unwrap();
    txn.commit().unwrap();
    }
    }
    {
    let txn = env.arc_txn_begin().unwrap();
    let channel = txn.write().open_or_create_channel("main").unwrap();
    record_all(&repo, &changes, &txn, &channel, "").unwrap();
    txn.commit().unwrap();
    }
    let len = contents.len();
    unsafe {
    let c = contents.as_bytes_mut();
    if c[len / 2] == b'y' {
    c[len / 2] = b'x'
    } else {
    c[len / 2] = b'y'
    }
    }
    {
    let txn = env.arc_txn_begin().unwrap();
    let channel = txn.write().open_or_create_channel("main").unwrap();
    debug_to_file(&*txn.read(), &channel, "debug").unwrap();
    let mut rec = crate::record::Builder::new();
    let rec = rec.recorded();
    let vertex = Position {
    change: id,
    pos: ChangePosition(1u64.into()),
    };
    let mut ret = retrieve(&*txn.read(), txn.read().graph(&*channel.read()), vertex)?;
    rec.lock().diff(
    &changes,
    &*txn.read(),
    &*channel.read(),
    crate::record::Algorithm::Myers,
    String::new(),
    vertex.to_option(),
    &mut ret,
    contents.as_bytes(),
    &None,
    )?;
    debug!("{:#?}", rec.lock().actions);
    record_all(&repo, &changes, &txn, &channel, "").unwrap();
    debug_to_file(&*txn.read(), &channel, "debug").unwrap();
    // txn.commit().unwrap()
    }
    Ok(())
    }
  • replacement in libpijul/src/diff/replace.rs at line 60
    [5.781585][5.15:141]()
    debug!("old {:?}", &lines_a[old..(old + old_len)]);
    debug!("new {:?}", &lines_b[from_new..(from_new + len)]);
    [5.781585]
    [5.141]
    debug!("old {:?}..{:?}", old, old + old_len);
    trace!("old {:?}", &lines_a[old..(old + old_len)]);
    debug!("new {:?}..{:?}", from_new, from_new + len);
    trace!("new {:?}", &lines_b[from_new..(from_new + len)]);
  • replacement in libpijul/src/diff/mod.rs at line 51
    [5.794015][5.505:577]()
    (self.ptr == b.ptr || self.l == b.l) && self.cyclic == b.cyclic
    [5.794015]
    [5.794064]
    ((self.ptr == b.ptr && self.l.len() == b.l.len()) || self.l == b.l)
    && self.cyclic == b.cyclic
  • edit in libpijul/src/diff/mod.rs at line 143
    [64.2024]
    [64.2024]
    debug!("contents_a: {:?}", d.contents_a.len());
  • edit in libpijul/src/diff/bin.rs at line 16
    [64.2994]
    [64.2994]
    ptr: ch.as_ptr(),
  • replacement in libpijul/Cargo.toml at line 4
    [5.1020894][2.97:124]()
    version = "1.0.0-alpha.43"
    [5.1020894]
    [5.27]
    version = "1.0.0-alpha.44"
  • replacement in libpijul/Cargo.toml at line 142
    [5.326][5.16823:16836](),[5.16823][5.16823:16836]()
    rand = "0.5"
    [5.325]
    [5.16836]
    rand = "0.7"
  • replacement in libpijul/Cargo.toml at line 152
    [5.2206][4.106264:106278]()
    detone = "1.0"
    [5.2206]
    detone = "1.0"
    rand = "0.7"
    rand_chacha = "0.2"
  • edit in Cargo.lock at line 311
    [5.3753][5.3753:3977]()
    name = "cloudabi"
    version = "0.0.3"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
    dependencies = [
    "bitflags",
    ]
    [[package]]
  • edit in Cargo.lock at line 454
    [5.7564]
    [5.7564]
    name = "detone"
    version = "1.0.0"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "f7104c193859c8141dcbb2008bd3d93e581d0fa7bb47b0d9f5e15c89d1b55514"
    [[package]]
  • edit in Cargo.lock at line 665
    [5.12737][5.12737:12934]()
    name = "fuchsia-cprng"
    version = "0.1.1"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
    [[package]]
  • replacement in Cargo.lock at line 1081
    [5.22930][2.281:308]()
    version = "1.0.0-alpha.43"
    [5.22930]
    [5.22957]
    version = "1.0.0-alpha.44"
  • edit in Cargo.lock at line 1098
    [5.23175]
    [5.23175]
    "detone",
  • edit in Cargo.lock at line 1111
    [2.338]
    [5.23321]
    "parking_lot",
  • replacement in Cargo.lock at line 1115
    [5.23364][5.23364:23379]()
    "rand 0.5.6",
    [5.23364]
    [5.23379]
    "rand 0.7.3",
    "rand_chacha 0.2.2",
  • replacement in Cargo.lock at line 1500
    [5.33516][3.216:243]()
    version = "1.0.0-alpha.50"
    [5.33516]
    [5.33543]
    version = "1.0.0-alpha.51"
  • edit in Cargo.lock at line 1635
    [5.36427][5.36427:36705]()
    version = "0.5.6"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9"
    dependencies = [
    "cloudabi",
    "fuchsia-cprng",
    "libc",
    "rand_core 0.3.1",
    "winapi",
    ]
    [[package]]
    name = "rand"
  • edit in Cargo.lock at line 1680
    [5.37781][5.37781:38206]()
    version = "0.3.1"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
    dependencies = [
    "rand_core 0.4.2",
    ]
    [[package]]
    name = "rand_core"
    version = "0.4.2"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
    [[package]]
    name = "rand_core"