Fixing remote push/pull

pmeunier
Sep 13, 2021, 6:18 PM
7HOBLRD43W2R5OVOYZVDO5LYPBZS7OSLDS7FH4NVNMBL3AZGMLSQC

Dependencies

  • [2] 6WFOU7UX Do a DFS on dependencies to complete the list
  • [3] 27RZYCM3 Pushing/pulling from/to Nest discussions again
  • [4] 7SQ7COLT Add length check to pijul remote delete
  • [5] A3RM526Y Integrating identity malleability
  • [6] YN63NUZO Sanakirja 1.0
  • [7] L2VH4BYK Downloading changelists from channels without an id (Nest discussions)
  • [8] I52XSRUH Massive cleanup, and simplification
  • [9] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [10] Q45QHPO4 Feedback on network stuff
  • [11] BE7GUCI2 Completing dependencies only with changes the remote does not have
  • [12] BBKV6VMN Fixing push/pull messages, and do not reverse the changes to download/upload
  • [13] UDHP4ZVB Fixing SSH asynchronicity issues
  • [14] MU5GSJAW Partial push and pull (WARNING: breaks the existing protocol)
  • [15] CCLLB7OI Upgrading to Sanakirja 0.15 + version bump
  • [16] EUZFFJSO Updating Pijul with the latest changes in Libpijul
  • [17] M5FK3ABT Complete dependencies when pushing and pulling
  • [18] IVLLXQ5Z Improved push/pull reporting
  • [19] 44BN7FWS Do not output files introduced by patches that were not applied during a push
  • [*] 5HF7C67M push/pull: fixed "changes" arguments

Change contents

  • replacement in "pijul/src/remote/ssh.rs" at line 464
    [5.1195][5.63:115]()
    debug!("state: Id {:?}", data);
    [5.1195]
    [5.1250]
    debug!("state: Id {:?}", std::str::from_utf8(&data));
  • replacement in "pijul/src/remote/ssh.rs" at line 560
    [5.6244][5.6244:6290]()
    debug!("{:?}", data);
    [5.6244]
    [5.6290]
    trace!("{:?}", data);
  • replacement in "pijul/src/remote/mod.rs" at line 313
    [5.7957][5.7957:8064](),[5.8064][5.8064:8117](),[5.8117][5.8117:8141]()
    let to_download: Result<Vec<libpijul::Hash>, anyhow::Error> = specific_changes
    .iter()
    .map(|h| Ok(txn.hash_from_prefix(h)?.0))
    .collect();
    [5.7957]
    [5.8141]
    let mut to_download = Vec::new();
    for h in specific_changes {
    let h = txn.hash_from_prefix(h)?.0;
    if txn.get_revchanges(current_channel, &h)?.is_none() {
    to_download.push(h)
    }
    }
  • replacement in "pijul/src/remote/mod.rs" at line 322
    [5.8202][5.8202:8241]()
    to_download: to_download?,
    [5.8202]
    [5.8241]
    to_download,
  • replacement in "pijul/src/remote/mod.rs" at line 489
    [5.11135][5.11135:11172]()
    debug!("update_changelist");
    [5.11135]
    [5.11172]
    debug!("update_changelist_pushpull");
  • edit in "pijul/src/remote/mod.rs" at line 502
    [3.325]
    [3.325]
    debug!("id = {:?}", id);
  • edit in "pijul/src/remote/mod.rs" at line 505
    [3.357]
    [3.357]
    debug!("no id, starting from scratch");
  • replacement in "pijul/src/remote/mod.rs" at line 511
    [3.673][3.673:711]()
    to_download.push(*h);
    [3.673]
    [3.711]
    if txn.get_revchanges(current_channel, h)?.is_none() {
    to_download.push(*h);
    }
  • edit in "pijul/src/commands/pushpull.rs" at line 259
    [21.913]
    [21.913]
    u.sort_by(|a, b| {
    let na = txn.get_revchanges(&channel, a).unwrap().unwrap();
    let nb = txn.get_revchanges(&channel, b).unwrap().unwrap();
    na.cmp(&nb)
    });
  • replacement in "pijul/src/commands/pushpull.rs" at line 277
    [5.158][5.20565:20666]()
    let comp = complete_deps(&*txn.read(), &remote_ref, &repo.changes, &to_upload, &d)?;
    [5.158]
    [5.232]
    let comp = complete_deps(&*txn.read(), &remote_ref, &repo.changes, &d)?;
  • replacement in "pijul/src/commands/pushpull.rs" at line 421
    [5.566][5.10088:10185]()
    let comp = complete_deps(&*txn.read(), &None, &repo.changes, &to_download, &d)?;
    [5.566]
    [5.642]
    let comp = complete_deps(&*txn.read(), &None, &repo.changes, &d)?;
  • edit in "pijul/src/commands/pushpull.rs" at line 558
    [5.854][5.2826:2859]()
    original: &[libpijul::Hash],
  • replacement in "pijul/src/commands/pushpull.rs" at line 560
    [5.2937][5.995:1054](),[5.995][5.995:1054](),[5.1054][2.0:116](),[2.116][2.116:184](),[2.184][2.184:190](),[2.190][2.190:245](),[2.245][2.245:283](),[2.283][5.1141:1213](),[5.1141][5.1141:1213](),[5.1213][2.284:327]()
    let original_: HashSet<_> = original.iter().collect();
    let mut now_ = HashSet::with_capacity(original.len());
    let mut result = Vec::with_capacity(original.len());
    for &h in now {
    now_.insert(h);
    result.push(h);
    }
    let mut stack = now.to_vec();
    stack.reverse();
    while let Some(n) = stack.pop() {
    // check that all of `now`'s deps are in now or not in original
    for d in c.get_dependencies(&n)? {
    [5.2937]
    [5.298]
    let mut now_ = HashSet::new();
    let mut result = Vec::new();
    for &h in now.iter() {
    for d in c.get_dependencies(&h)? {
  • replacement in "pijul/src/commands/pushpull.rs" at line 569
    [5.463][5.1255:1326](),[5.1255][5.1255:1326]()
    if original_.get(&d).is_some() && now_.get(&d).is_none() {
    [5.463]
    [5.1326]
    if now_.insert(d) {
  • replacement in "pijul/src/commands/pushpull.rs" at line 571
    [5.1358][5.1358:1390](),[5.1390][2.328:359]()
    now_.insert(d);
    stack.push(d);
    [5.1358]
    [5.1390]
    continue;
  • replacement in "pijul/src/commands/pushpull.rs" at line 574
    [5.1414][2.360:415]()
    if now_.insert(n) {
    result.push(n)
    [5.1414]
    [5.2286]
    if now_.insert(h) {
    result.push(h)
  • replacement in "libpijul/src/pristine/mod.rs" at line 264
    [5.36086][4.0:35]()
    if b.len() != bb.0.len() {
    [5.36086]
    [4.35]
    if b.len() != data_encoding::BASE32_NOPAD.encode_len(16) {