Change completions (where the whole progress bar story started)

[?]
Mar 1, 2021, 7:10 PM
2D7P2VKJASU7QDQZHGCLBIT6G2V5WUFYLWTCEVVEI2EZHGM6XYRAC

Dependencies

  • [2] Y6EVFMTA Don't output files if they aren't in the current channel
  • [3] GNMZNKB4 Cursors cleanup
  • [4] TKEVOH7H Fixing a bug when downloading changes, and making change download more efficient (more async)
  • [5] I52XSRUH Massive cleanup, and simplification
  • [6] VBMXB443 Retrying if the HTTP connection drops while reading the body
  • [7] TPEH2XNB 1.0.0-alpha.28, with Tokio 1.0
  • [8] BNPSVXIC Friendlier progress bars
  • [9] MXQ3U2DP Shorter progress bars
  • [10] YN63NUZO Sanakirja 1.0
  • [11] Q45QHPO4 Feedback on network stuff
  • [12] HXEIH4UQ Pulling more than 100 changes at once
  • [13] WKX5S4Z4 remove unneccesary explicit lifetimes
  • [14] UDHP4ZVB Fixing SSH asynchronicity issues
  • [15] X6YFD4WV Do not download changes if we already have them
  • [16] MU5GSJAW Partial push and pull (WARNING: breaks the existing protocol)
  • [17] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [18] 76PCXGML Pushing to, and pulling from the local repository
  • [19] FBXYP7QM Forgot to add remote::http
  • [20] WLUID7NA Do not block when downloading more than 100 changes over SSH
  • [21] WTZXEWY7 Flushing the futures pipeline when downloading over HTTP(S)
  • [22] 5QTMRUXN Fixing a race condition between progress bars
  • [*] L4JXJHWX pijul/*: reorganize imports and remove extern crate
  • [*] MDADYULS Fix a panic when switching between channels that have different files
  • [*] LGEJSLTY Fixing output (including its uses in reset and pull)

Change contents

  • replacement in pijul/src/remote/ssh.rs at line 774
    [4.45470][4.71:143]()
    progress: Arc<std::sync::Mutex<crate::progress::InnerCursors>>,
    [4.45470]
    [4.143]
    pro_n: usize,
  • replacement in pijul/src/remote/ssh.rs at line 780
    [4.45564][4.224:301]()
    self.download_changes_(progress, c, Some(sender), changes_dir, full)
    [4.45564]
    [4.131]
    self.download_changes_(pro_n, c, Some(sender), changes_dir, full)
  • replacement in pijul/src/remote/ssh.rs at line 786
    [4.208][4.302:374]()
    progress: Arc<std::sync::Mutex<crate::progress::InnerCursors>>,
    [4.208]
    [4.374]
    pro_n: usize,
  • replacement in pijul/src/remote/ssh.rs at line 811
    [4.738][3.0:52]()
    progress.lock().unwrap()[0].incr();
    [4.738]
    [4.798]
    super::PROGRESS.borrow_mut().unwrap()[pro_n].incr();
  • edit in pijul/src/remote/ssh.rs at line 818
    [4.975]
    [4.975]
    let mut received = false;
  • edit in pijul/src/remote/ssh.rs at line 820
    [4.1020]
    [4.1020]
    received = true;
  • edit in pijul/src/remote/ssh.rs at line 835
    [4.49753]
    [4.1498]
    if !received {
    *self.state.lock().await = State::None;
    };
  • edit in pijul/src/remote/mod.rs at line 22
    [4.10383]
    [4.10383]
    use crate::progress::PROGRESS;
  • replacement in pijul/src/remote/mod.rs at line 332
    [4.66710][4.1517:1589]()
    progress: Arc<std::sync::Mutex<crate::progress::InnerCursors>>,
    [4.66710]
    [4.1589]
    pro_n: usize,
  • replacement in pijul/src/remote/mod.rs at line 340
    [4.67232][4.1675:1807]()
    RemoteRepo::Local(ref mut l) => {
    l.download_changes(progress, hashes, send, path).await?
    }
    [4.67232]
    [4.1807]
    RemoteRepo::Local(ref mut l) => l.download_changes(pro_n, hashes, send, path).await?,
  • replacement in pijul/src/remote/mod.rs at line 342
    [4.1851][4.1851:1950]()
    s.download_changes(progress, hashes, send, path, full)
    .await?
    [4.1851]
    [4.1950]
    s.download_changes(pro_n, hashes, send, path, full).await?
  • replacement in pijul/src/remote/mod.rs at line 345
    [4.2009][4.2009:2108]()
    h.download_changes(progress, hashes, send, path, full)
    .await?
    [4.2009]
    [4.2108]
    h.download_changes(pro_n, hashes, send, path, full).await?
  • replacement in pijul/src/remote/mod.rs at line 353
    [4.68736][4.51:99]()
    pub async fn pull<T: MutTxnTExt + TxnTExt>(
    [4.68736]
    [4.99]
    pub async fn pull<T: MutTxnTExt + TxnTExt + GraphIter>(
  • replacement in pijul/src/remote/mod.rs at line 362
    [4.1407][4.2123:2247](),[4.2247][3.53:105]()
    let progress = crate::progress::Cursors::new();
    {
    let mut pro = progress.borrow_mut().unwrap();
    pro.push(crate::progress::Cursor::Bar {
    [4.1407]
    [4.2307]
    let mut pro = PROGRESS.borrow_mut().unwrap();
    let pro_a = pro.push(crate::progress::Cursor::Bar {
    i: 0,
    n: to_apply.len(),
    pre: "Downloading changes".into(),
    });
    let pro_b = if do_apply {
    Some(pro.push(crate::progress::Cursor::Bar {
  • replacement in pijul/src/remote/mod.rs at line 372
    [4.2364][4.2364:2457](),[4.2457][3.106:162](),[3.162][4.2521:2674](),[4.2521][4.2521:2674]()
    pre: "Downloading changes".into(),
    });
    if do_apply {
    pro.push(crate::progress::Cursor::Bar {
    i: 0,
    n: to_apply.len(),
    pre: "Applying".into(),
    });
    }
    }
    [4.2364]
    [4.2674]
    pre: "Applying".into(),
    }))
    } else {
    None
    };
    std::mem::drop(pro);
  • edit in pijul/src/remote/mod.rs at line 386
    [4.1472][4.2758:2806]()
    let progress_ = progress.inner.clone();
  • replacement in pijul/src/remote/mod.rs at line 388
    [4.1532][4.2807:3024]()
    .download_changes(
    progress_,
    &mut hash_recv,
    &mut send,
    &mut change_path_,
    false,
    )
    [4.1532]
    [4.1619]
    .download_changes(pro_a, &mut hash_recv, &mut send, &mut change_path_, false)
  • replacement in pijul/src/remote/mod.rs at line 446
    [4.2529][4.3474:3500]()
    if do_apply {
    [4.2529]
    [4.972]
    if let Some(pro_b) = pro_b {
  • replacement in pijul/src/remote/mod.rs at line 448
    [4.1015][3.163:221]()
    progress.inner.lock().unwrap()[1].incr();
    [4.1015]
    [4.3567]
    PROGRESS.inner.lock().unwrap()[pro_b].incr();
  • replacement in pijul/src/remote/mod.rs at line 460
    [4.321][4.3666:3691]()
    progress.join();
    [4.321]
    [4.2530]
    debug!("join");
    PROGRESS.join();
  • replacement in pijul/src/remote/mod.rs at line 465
    [4.70881][4.70881:70934]()
    pub async fn clone_tag<T: MutTxnTExt + TxnTExt>(
    [4.70881]
    [4.70934]
    pub async fn clone_tag<T: MutTxnTExt + TxnTExt + GraphIter>(
  • replacement in pijul/src/remote/mod.rs at line 477
    [4.71386][4.3774:3830]()
    let progress = crate::progress::Cursors::new();
    [4.71386]
    [4.71386]
    let pro_n = {
    let mut pro = PROGRESS.borrow_mut().unwrap();
    pro.push(crate::progress::Cursor::Bar {
    i: 0,
    n: tag.len(),
    pre: "Downloading changes".into(),
    })
    };
  • replacement in pijul/src/remote/mod.rs at line 489
    [4.3866][4.3866:3910]()
    progress.inner.clone(),
    [4.3866]
    [4.3910]
    pro_n,
  • replacement in pijul/src/remote/mod.rs at line 519
    [4.72806][4.72806:72852](),[4.72852][4.7733:7807]()
    while let Some(hash) = hashes.pop() {
    txn.apply_change_ws(&repo.changes, channel, &hash, &mut ws)?;
    [4.72806]
    [4.72925]
    for hash in hashes.iter() {
    txn.apply_change_ws(&repo.changes, channel, hash, &mut ws)?;
  • edit in pijul/src/remote/mod.rs at line 524
    [4.73007]
    [4.73007]
    self.complete_changes(repo, txn, channel, &hashes, false)
    .await?;
  • replacement in pijul/src/remote/mod.rs at line 529
    [4.73029][4.73029:73084]()
    pub async fn clone_state<T: MutTxnTExt + TxnTExt>(
    [4.73029]
    [4.73084]
    pub async fn clone_state<T: MutTxnTExt + TxnTExt + GraphIter>(
  • edit in pijul/src/remote/mod.rs at line 554
    [4.2736]
    [4.2736]
    .await?;
    self.complete_changes(repo, txn, channel, &to_pull, false)
  • replacement in pijul/src/remote/mod.rs at line 574
    [4.75363][4.4223:4279]()
    let progress = crate::progress::Cursors::new();
    [4.75363]
    [4.75363]
    let mut progress = PROGRESS.borrow_mut().unwrap();
    let pro_n = {
    progress.push(crate::progress::Cursor::Bar {
    i: 0,
    n: 0,
    pre: "Completing changes".into(),
    })
    };
    std::mem::drop(progress);
  • replacement in pijul/src/remote/mod.rs at line 585
    [4.2126][4.4280:4512]()
    .download_changes(
    progress.inner.clone(),
    &mut recv_hash,
    &mut send_sig,
    &mut changes_dir,
    true,
    )
    [4.2126]
    [4.2215]
    .download_changes(pro_n, &mut recv_hash, &mut send_sig, &mut changes_dir, true)
  • edit in pijul/src/remote/mod.rs at line 602
    [4.4550]
    [4.76371]
    PROGRESS.borrow_mut().unwrap()[pro_n].incr_len();
  • edit in pijul/src/remote/mod.rs at line 627
    [4.4592]
    [4.2719]
    PROGRESS.borrow_mut().unwrap()[pro_n].incr_len();
  • edit in pijul/src/remote/mod.rs at line 636
    [4.77704]
    [4.77704]
    PROGRESS.join();
  • replacement in pijul/src/remote/mod.rs at line 640
    [4.77726][4.77726:77783]()
    pub async fn clone_channel<T: MutTxnTExt + TxnTExt>(
    [4.77726]
    [4.77783]
    pub async fn clone_channel<T: MutTxnTExt + TxnTExt + GraphIter>(
  • edit in pijul/src/remote/mod.rs at line 658
    [4.2894]
    [4.2894]
    self.complete_changes(repo, txn, local_channel, &pullable, false)
    .await?;
  • replacement in pijul/src/remote/local.rs at line 129
    [4.83512][4.4593:4665]()
    progress: Arc<std::sync::Mutex<crate::progress::InnerCursors>>,
    [4.83512]
    [4.4665]
    pro_n: usize,
  • replacement in pijul/src/remote/local.rs at line 137
    [4.3058][3.222:270]()
    progress.lock().unwrap()[0].incr();
    [4.3058]
    [4.12057]
    super::PROGRESS.borrow_mut().unwrap()[pro_n].incr();
  • replacement in pijul/src/remote/http.rs at line 74
    [4.1135][4.4808:4891]()
    progress: std::sync::Arc<std::sync::Mutex<crate::progress::InnerCursors>>,
    [4.1135]
    [4.4891]
    pro_n: usize,
  • replacement in pijul/src/remote/http.rs at line 97
    [4.5078][3.271:323]()
    progress.lock().unwrap()[0].incr();
    [4.5078]
    [4.902]
    super::PROGRESS.borrow_mut().unwrap()[pro_n].incr();
  • replacement in pijul/src/remote/http.rs at line 110
    [4.5215][3.324:376]()
    progress.lock().unwrap()[0].incr();
    [4.5215]
    [4.239]
    super::PROGRESS.borrow_mut().unwrap()[pro_n].incr();
  • edit in pijul/src/progress.rs at line 1
    [4.5323]
    [4.5324]
    use log::*;
  • edit in pijul/src/progress.rs at line 6
    [4.5396]
    [4.5396]
    lazy_static::lazy_static! {
    pub static ref PROGRESS: crate::progress::Cursors = crate::progress::Cursors::new();
    }
  • replacement in pijul/src/progress.rs at line 12
    [4.5458][4.5458:5494]()
    t: std::thread::JoinHandle<()>,
    [4.5458]
    [4.5494]
    t: Mutex<Option<std::thread::JoinHandle<()>>>,
  • replacement in pijul/src/progress.rs at line 47
    [4.5894][4.5894:5980]()
    let inner_ = inner.clone();
    let t = std::thread::spawn(move || loop {
    [4.5894]
    [4.5980]
    let cursors = Cursors {
    inner,
    t: Mutex::new(None),
    };
    cursors.restart();
    cursors
    }
    fn restart(&self) {
    debug!("restart");
    let mut t = self.t.lock().unwrap();
    if t.is_some() {
    return;
    }
    let inner_ = self.inner.clone();
    *t = Some(std::thread::spawn(move || loop {
  • replacement in pijul/src/progress.rs at line 77
    [4.6435][4.6435:6476]()
    });
    Cursors { inner, t }
    [4.6435]
    [4.6476]
    }));
  • edit in pijul/src/progress.rs at line 81
    [4.6508]
    [4.6508]
    debug!("stop");
  • replacement in pijul/src/progress.rs at line 87
    [4.6598][4.6598:6622]()
    pub fn join(self) {
    [4.6598]
    [4.6622]
    pub fn join(&self) {
    debug!("join");
  • replacement in pijul/src/progress.rs at line 90
    [4.6643][4.6643:6675]()
    self.t.join().unwrap();
    [4.6643]
    [4.6675]
    let mut t = self.t.lock().unwrap();
    if let Some(t) = t.take() {
    t.join().unwrap();
    }
  • edit in pijul/src/progress.rs at line 102
    [4.6863]
    [4.6863]
    debug!("borrow_mut");
    self.restart();
  • edit in pijul/src/progress.rs at line 105
    [4.6903]
    [4.6903]
    m.stop = false;
  • edit in pijul/src/progress.rs at line 153
    [4.7823]
    [4.7823]
    _ => {}
    }
    }
    pub fn incr_len(&mut self) {
    match self {
    Cursor::Bar { n, .. } => *n += 1,
  • replacement in pijul/src/progress.rs at line 205
    [3.1037][3.1037:1096]()
    let k = (wb as usize * *i) / (*n - 1);
    [3.1037]
    [3.1096]
    let k = (wb as usize * *i) / *n;
  • edit in pijul/src/commands/reset.rs at line 11
    [24.1348]
    [24.1348]
    use crate::progress::PROGRESS;
  • edit in pijul/src/commands/reset.rs at line 146
    [25.343]
    [25.343]
    PROGRESS
    .borrow_mut()
    .unwrap()
    .push(crate::progress::Cursor::Spin {
    i: 0,
    pre: "Outputting repository".into(),
    });
  • edit in pijul/src/commands/reset.rs at line 174
    [25.734]
    [4.101179]
    PROGRESS.join();
  • edit in pijul/src/commands/reset.rs at line 176
    [4.101200]
    [4.101200]
    PROGRESS
    .borrow_mut()
    .unwrap()
    .push(crate::progress::Cursor::Spin {
    i: 0,
    pre: "Outputting repository".into(),
    });
  • edit in pijul/src/commands/reset.rs at line 195
    [4.101673]
    [4.101673]
    PROGRESS.join();
  • edit in pijul/src/commands/pushpull.rs at line 14
    [24.1761]
    [24.1761]
    use crate::progress::PROGRESS;
  • edit in pijul/src/commands/pushpull.rs at line 455
    [2.1366]
    [2.1366]
    PROGRESS
    .borrow_mut()
    .unwrap()
    .push(crate::progress::Cursor::Spin {
    i: 0,
    pre: "Outputting repository".into(),
    });
  • edit in pijul/src/commands/pushpull.rs at line 487
    [26.679]
    [4.11126]
    PROGRESS.join();
  • edit in pijul/src/commands/clone.rs at line 82
    [4.185601]
    [4.185601]
  • edit in pijul/src/commands/apply.rs at line 10
    [24.3380]
    [24.3380]
    use crate::progress::PROGRESS;
  • edit in pijul/src/commands/apply.rs at line 93
    [2.3383]
    [2.3383]
    PROGRESS
    .borrow_mut()
    .unwrap()
    .push(crate::progress::Cursor::Spin {
    i: 0,
    pre: "Outputting repository".into(),
    });
  • edit in pijul/src/commands/apply.rs at line 120
    [25.1642]
    [25.1642]
    PROGRESS.join();