Friendlier progress bars
[?]
Feb 28, 2021, 3:40 PM
BNPSVXIC72C3WT33YKCH766OBLLNCS7POX6U6JXZSQQPJF2M22MQCDependencies
- [2]
3WO4H2MMFixing async issues in downloads - [3]
HDGRZISMVersion updates - [4]
G734WNM6flake.nix: use crate2nix - [5]
SZWBLWZ4Reading ~/.ssh/config - [6]
BT2ZHPY4Version bumps - [7]
WIORLB47Version bump - [8]
5YDI33C4Fixing pager on OSX - [9]
FBXYP7QMForgot to add remote::http - [10]
JACZWIJ6Version bump - [11]
76PCXGMLPushing to, and pulling from the local repository - [12]
5QTMRUXNFixing a race condition between progress bars - [13]
KTTKF3RWLocking stderr and the progress bar in SSH - [14]
XAY4DYRRVersion bump - [15]
IQ4FCHPZHTTP connections: pooling + retry on error - [16]
UDHP4ZVBFixing SSH asynchronicity issues - [17]
YX3VCEOMVersion bump - [18]
FE5ES6Q4Stop pushing/pulling if the remote returns an error - [19]
WTZXEWY7Flushing the futures pipeline when downloading over HTTP(S) - [20]
6DOXSHWGCleanup, and version bump - [21]
VYHHOEYHVersions and formatting - [22]
AOK35FEXNew Cargo.nix versions - [23]
HSVGP2G4Version bump + formatting - [24]
LGEJSLTYFixing output (including its uses in reset and pull) - [25]
G65S7FAWVersion bump and cleanup - [26]
3WIQYEISFixing conflicts in Cargo.lock - [27]
QE64ATLZFixing asynchronicity problems in SSH - [28]
HR3WK6A7When lock times out, check that there are no more clients before quitting - [29]
KUMJITTFVersion bump in the lockfiles - [30]
CUHXXBDZFixing a bug in replacements, recently introduced during a fix of a graph corruption bug - [31]
TKEVOH7HFixing a bug when downloading changes, and making change download more efficient (more async) - [32]
SAGSYAPXVarious version bumps - [33]
Q7CAYX5NFixing Windows compilation - [34]
G6YZ7U65Version bump - [35]
CCLLB7OIUpgrading to Sanakirja 0.15 + version bump - [36]
TPEH2XNB1.0.0-alpha.28, with Tokio 1.0 - [37]
3S4DR77ZVersion updates - [38]
OCBM7IFENew release: pijul-1.0.0-alpha.8 - [39]
ENKQ3QZGForward the exit status messages from the SSH background loop to the client (solving hangs) - [40]
G3A7KDTOUpdate edit to 0.1.3, fixing windows editing - [41]
WLUID7NADo not block when downloading more than 100 changes over SSH - [42]
Q45QHPO4Feedback on network stuff - [43]
LYTVEPH3Avoid cloning into an existing path - [44]
XWETQ4DEUpgrading versions - [45]
5BRU2RRWCleanup (debugging a crash related to trees/inodes) - [46]
UFCZKKLXUpgrading to the latest Sanakirja/Rand - [47]
N35L72XVVersions in Cargo.lock - [48]
YN63NUZOSanakirja 1.0 - [49]
VBMXB443Retrying if the HTTP connection drops while reading the body - [50]
SXEYMYF7Fixing the bad changes in history (unfortunately, by rebooting). - [51]
H62VFFJECargo.nix, and solving conflicts - [52]
I52XSRUHMassive cleanup, and simplification - [53]
WI5BS6BSNew published versions - [54]
PJ7T2VFLDo not hang on locked repositories - [55]
23LVKATNUse pager crate for log output - [56]
JRENVH5DReqwest 0.11 - [57]
L4JXJHWXpijul/*: reorganize imports and remove extern crate - [58]
7ZFRYVVQCargo.nix and formatting - [59]
PCEJFKFXProgress bar for upload and apply - [60]
H565UUPCUse correct pattern for workspace interdependencies - [61]
K6GWUOD5Styling progress bars - [62]
X6YFD4WVDo not download changes if we already have them - [63]
MU5GSJAWPartial push and pull (WARNING: breaks the existing protocol) - [64]
ZQXP3HNAVersion bump - [65]
2K7JLB4ZNo pager on Windows - [66]
44BN7FWSDo not output files introduced by patches that were not applied during a push - [67]
OUWD436AVersion bump - [68]
ZTVNGFNTVersion bump - [69]
ZRUPLBBTColours in diff and change: separating concerns and dependencies - [70]
Y6EVFMTADon't output files if they aren't in the current channel - [71]
BZSC7VMYaddress clippy lints - [72]
367UBQ6KForwarding SSH stderr, and progress bar for push - [73]
OJZWJUF2MUCH faster `pijul add -r` - [74]
FXT5FS5WUpdating Cargo.nix - [75]
3VJB4ULDUpdating Cargo.nix - [76]
JL4WKA5PImplement the Sanakirja concurrency model in a cross-process way - [77]
NX5I5H53New published versions - [78]
HXEIH4UQPulling more than 100 changes at once - [79]
IIV3EL2XCleanup, formatting, and fixing the Git feature - [80]
MDADYULSFix a panic when switching between channels that have different files - [81]
SN7AGY6SMaking `pijul lock` robust to kill signals - [82]
B5Z4IMEUGenerating Cargo.nix for pijul 1.0.0-alpha.6
Change contents
- edit in pijul/src/remote/ssh.rs at line 10
use indicatif::ProgressBar; - edit in pijul/src/remote/ssh.rs at line 37
static ref PROGRESS: Arc<Mutex<Option<ProgressBar>>> = Arc::new(Mutex::new(None)); - edit in pijul/src/remote/ssh.rs at line 381
*PROGRESS.lock().await = None;*super::SPINNER.lock().await = None; - replacement in pijul/src/remote/ssh.rs at line 455
debug!("sending");debug!("sending {:?}", hashes[*current]); - edit in pijul/src/remote/ssh.rs at line 750[4.44567]→[4.493:556](∅→∅),[4.556]→[4.0:80](∅→∅),[4.80]→[4.0:78](∅→∅),[4.78]→[4.155:166](∅→∅),[4.155]→[4.155:166](∅→∅),[4.166]→[4.79:133](∅→∅),[4.133]→[4.333:382](∅→∅),[4.166]→[4.333:382](∅→∅)
let progress = ProgressBar::new(changes.len() as u64);progress.set_style(indicatif::ProgressStyle::default_bar().template(" Uploading changes {wide_bar} {pos:>5}/{len}"),);let progress = super::PROGRESS.add(progress);*PROGRESS.lock().await = Some(progress); - edit in pijul/src/remote/ssh.rs at line 767
if let Some(ref mut progress) = *PROGRESS.lock().await {progress.inc(1);} - edit in pijul/src/remote/ssh.rs at line 768[4.45379]→[4.45379:45389](∅→∅),[4.45389]→[4.500:653](∅→∅),[4.653]→[4.134:205](∅→∅),[4.205]→[4.734:780](∅→∅),[4.734]→[4.734:780](∅→∅)
}if let Some(ref mut progress) = *PROGRESS.lock().await {progress.set_style(indicatif::ProgressStyle::default_bar().template("✓ Uploading changes {pos:>5}/{len}"),);progress.finish(); - replacement in pijul/src/remote/ssh.rs at line 774
c: &mut tokio::sync::mpsc::Receiver<libpijul::pristine::Hash>,progress: Arc<std::sync::Mutex<crate::progress::InnerCursors>>,c: &mut tokio::sync::mpsc::UnboundedReceiver<libpijul::pristine::Hash>, - replacement in pijul/src/remote/ssh.rs at line 780
self.download_changes_(c, Some(sender), changes_dir, full)self.download_changes_(progress, c, Some(sender), changes_dir, full) - replacement in pijul/src/remote/ssh.rs at line 786
c: &mut tokio::sync::mpsc::Receiver<libpijul::pristine::Hash>,mut sender: Option<&mut tokio::sync::mpsc::Sender<libpijul::pristine::Hash>>,progress: Arc<std::sync::Mutex<crate::progress::InnerCursors>>,c: &mut tokio::sync::mpsc::UnboundedReceiver<libpijul::pristine::Hash>,sender: Option<&mut tokio::sync::mpsc::Sender<libpijul::pristine::Hash>>, - replacement in pijul/src/remote/ssh.rs at line 806[4.9350]→[4.695:720](∅→∅),[4.9753]→[4.922:975](∅→∅),[4.975]→[4.0:80](∅→∅),[4.86]→[4.0:80](∅→∅),[4.80]→[4.206:284](∅→∅),[4.284]→[4.155:166](∅→∅),[4.155]→[4.155:166](∅→∅),[4.166]→[4.791:840](∅→∅),[4.840]→[2.810:1195](∅→∅),[2.1195]→[4.958:1035](∅→∅),[4.533]→[4.958:1035](∅→∅),[4.1035]→[2.1196:1237](∅→∅),[2.1237]→[4.1079:1101](∅→∅),[4.1079]→[4.1079:1101](∅→∅),[4.1101]→[2.1238:2832](∅→∅)
let mut len = 0;let progress = ProgressBar::new(len as u64);progress.set_style(indicatif::ProgressStyle::default_bar().template(" Downloading changes {wide_bar} {pos:>5}/{len}"),);*PROGRESS.lock().await = Some(progress);let mut dropped = false;loop {tokio::select! {x = recv.recv() => {let hash = if let Some(hash) = x {debug!("received hash {:?}", hash);hash} else {debug!("finished");break};if let Some(ref mut progress) = *PROGRESS.lock().await {progress.inc(1);}if let Some(ref mut sender) = sender {if sender.send(hash).await.is_err() {if let Some(ref mut progress) = *PROGRESS.lock().await {progress.abandon();}break;}}}x = c.recv(), if !dropped => {let c = if let Some(c) = x {c} else {debug!("other end dropped");dropped = true;if len == 0 {break} else {continue}};if let State::Changes { ref mut hashes, .. } = *self.state.lock().await {hashes.push(c);}debug!("download_change {:?} {:?}", c, full);if full {self.c.data(format!("change {}\n", c.to_base32()).as_bytes()).await?;} else {self.c.data(format!("partial {}\n", c.to_base32()).as_bytes()).await?;}if let Some(ref mut p) = *PROGRESS.lock().await {p.inc_length(1)}len += 1;let mut sender = sender.map(|x| x.clone());let t = tokio::spawn(async move {while let Some(hash) = recv.recv().await {debug!("received hash {:?}", hash);progress.lock().unwrap().cursors[0].incr();debug!("received");if let Some(ref mut sender) = sender {sender.send(hash).await.unwrap_or(()); - edit in pijul/src/remote/ssh.rs at line 815
}});while let Some(h) = c.recv().await {if let State::Changes { ref mut hashes, .. } = *self.state.lock().await {hashes.push(h); - replacement in pijul/src/remote/ssh.rs at line 821[4.49743]→[4.203:213](∅→∅),[4.213]→[4.1102:1304](∅→∅),[4.1304]→[4.285:362](∅→∅),[4.362]→[4.1389:1443](∅→∅),[4.1389]→[4.1389:1443](∅→∅)
}if let Some(ref mut progress) = *PROGRESS.lock().await {if !progress.is_finished() {progress.set_style(indicatif::ProgressStyle::default_bar().template("✓ Downloading changes {pos:>5}/{len}"),);progress.finish();debug!("download_change {:?} {:?}", h, full);if full {self.c.data(format!("change {}\n", h.to_base32()).as_bytes()).await?;} else {self.c.data(format!("partial {}\n", h.to_base32()).as_bytes()).await?; - edit in pijul/src/remote/ssh.rs at line 832
t.await?; - edit in pijul/src/remote/mod.rs at line 11
use tokio::sync::Mutex; - edit in pijul/src/remote/mod.rs at line 29
}lazy_static! {static ref PROGRESS: Arc<indicatif::MultiProgress> = Arc::new(indicatif::MultiProgress::new());static ref SPINNER: Arc<Mutex<Option<indicatif::ProgressBar>>> = Arc::new(Mutex::new(None)); - edit in pijul/src/remote/mod.rs at line 164
let progress = indicatif::ProgressBar::new_spinner();progress.set_style(indicatif::ProgressStyle::default_spinner().template("{spinner} Updating remote changelist"),);progress.enable_steady_tick(100);*SPINNER.lock().await = Some(progress); - edit in pijul/src/remote/mod.rs at line 193
if let Some(progress) = SPINNER.lock().await.take() {progress.set_style(indicatif::ProgressStyle::default_spinner().template("✓ Updating remote changelist"),);progress.finish();} - replacement in pijul/src/remote/mod.rs at line 330
hashes: &mut tokio::sync::mpsc::Receiver<libpijul::pristine::Hash>,progress: Arc<std::sync::Mutex<crate::progress::InnerCursors>>,hashes: &mut tokio::sync::mpsc::UnboundedReceiver<libpijul::pristine::Hash>, - replacement in pijul/src/remote/mod.rs at line 338
RemoteRepo::Local(ref mut l) => l.download_changes(hashes, send, path).await?,RemoteRepo::Ssh(ref mut s) => s.download_changes(hashes, send, path, full).await?,RemoteRepo::Http(ref mut h) => h.download_changes(hashes, send, path, full).await?,RemoteRepo::Local(ref mut l) => {l.download_changes(progress, hashes, send, path).await?}RemoteRepo::Ssh(ref mut s) => {s.download_changes(progress, hashes, send, path, full).await?}RemoteRepo::Http(ref mut h) => {h.download_changes(progress, hashes, send, path, full).await?} - edit in pijul/src/remote/mod.rs at line 364
let progress = crate::progress::Cursors::new();{let mut pro = progress.borrow_mut().unwrap();pro.cursors.push(crate::progress::Cursor::Bar {i: 0,n: to_apply.len(),pre: "Downloading changes".into(),});if do_apply {pro.cursors.push(crate::progress::Cursor::Bar {i: 0,n: to_apply.len(),pre: "Applying".into(),});}} - replacement in pijul/src/remote/mod.rs at line 384
let (hash_send, mut hash_recv) = tokio::sync::mpsc::channel(100);let (hash_send, mut hash_recv) = tokio::sync::mpsc::unbounded_channel(); - edit in pijul/src/remote/mod.rs at line 388
let progress_ = progress.inner.clone(); - replacement in pijul/src/remote/mod.rs at line 391
.download_changes(&mut hash_recv, &mut send, &mut change_path_, false).download_changes(progress_,&mut hash_recv,&mut send,&mut change_path_,false,) - replacement in pijul/src/remote/mod.rs at line 403
let mut len = 0;let mut to_download = HashSet::with_capacity(to_apply.len()); - replacement in pijul/src/remote/mod.rs at line 407
hash_send.send(*h).await?;len += 1hash_send.send(*h)?;to_download.insert(*h); - edit in pijul/src/remote/mod.rs at line 415[4.69809]→[4.69809:69865](∅→∅),[4.69865]→[4.574:611](∅→∅),[4.611]→[4.1794:1848](∅→∅),[4.1848]→[4.905:986](∅→∅),[4.686]→[4.905:986](∅→∅),[4.986]→[4.513:595](∅→∅),[4.595]→[4.1065:1080](∅→∅),[4.1065]→[4.1065:1080](∅→∅),[4.1080]→[4.596:630](∅→∅),[4.630]→[4.749:794](∅→∅),[4.749]→[4.749:794](∅→∅),[4.794]→[4.631:735](∅→∅)
let mut change_path = repo.changes_dir.clone();let progress = if do_apply {let p = indicatif::ProgressBar::new(len);p.set_style(indicatif::ProgressStyle::default_bar().template(" Applying changes {wide_bar} {pos:>5}/{len}"),);Some(PROGRESS.add(p))} else {None};let t_progress = std::thread::spawn(|| {PROGRESS.join().unwrap_or(());}); - replacement in pijul/src/remote/mod.rs at line 417
libpijul::changestore::filesystem::push_filename(&mut change_path, &h);debug!("change_path = {:?}", change_path);while std::fs::metadata(&change_path).is_err() {debug!("waiting");let r = recv.recv().await;debug!("r = {:?}", r);if r.is_none() {if let Some(ref progress) = progress {progress.abandon();}debug!("to_apply: {:?}", h);while to_download.contains(&h) {debug!("waiting for {:?}", h);if let Some(h) = recv.recv().await {debug!("recv {:?}", h);to_download.remove(&h);} else { - edit in pijul/src/remote/mod.rs at line 427
libpijul::changestore::filesystem::pop_filename(&mut change_path); - replacement in pijul/src/remote/mod.rs at line 455
if let Some(ref progress) = progress {if do_apply { - replacement in pijul/src/remote/mod.rs at line 457
progress.inc(1);progress.inner.lock().unwrap().cursors[1].incr();debug!("apply"); - edit in pijul/src/remote/mod.rs at line 460
debug!("applied"); - edit in pijul/src/remote/mod.rs at line 463[4.70662]→[4.70662:70686](∅→∅),[4.70686]→[4.1049:1133](∅→∅),[4.1133]→[4.1081:1177](∅→∅),[4.1177]→[4.622:699](∅→∅),[4.699]→[4.1262:1281](∅→∅),[4.810]→[4.1262:1281](∅→∅),[4.1262]→[4.1262:1281](∅→∅),[4.1281]→[4.1133:1167](∅→∅),[4.1133]→[4.1133:1167](∅→∅)
}}if let Some(progress) = progress {if !progress.is_finished() {progress.set_style(indicatif::ProgressStyle::default_bar().template("✓ Applying changes {pos:>5}/{len}"),);progress.finish() - edit in pijul/src/remote/mod.rs at line 465
debug!("finished"); - replacement in pijul/src/remote/mod.rs at line 469
t_progress.join().unwrap();progress.join(); - replacement in pijul/src/remote/mod.rs at line 481
let (send_hash, mut recv_hash) = tokio::sync::mpsc::channel(100);let (send_hash, mut recv_hash) = tokio::sync::mpsc::unbounded_channel(); - edit in pijul/src/remote/mod.rs at line 485
let progress = crate::progress::Cursors::new(); - replacement in pijul/src/remote/mod.rs at line 488
.download_changes(&mut recv_hash, &mut send_signal, &mut change_path_, false).download_changes(progress.inner.clone(),&mut recv_hash,&mut send_signal,&mut change_path_,false,) - replacement in pijul/src/remote/mod.rs at line 500
send_hash.send(h).await?;send_hash.send(h)?; - replacement in pijul/src/remote/mod.rs at line 512
send_hash.send(dep).await?;send_hash.send(dep)?; - replacement in pijul/src/remote/mod.rs at line 566
let (send_hash, mut recv_hash) = tokio::sync::mpsc::channel(100);let (send_hash, mut recv_hash) = tokio::sync::mpsc::unbounded_channel(); - edit in pijul/src/remote/mod.rs at line 570
let progress = crate::progress::Cursors::new(); - replacement in pijul/src/remote/mod.rs at line 573
.download_changes(&mut recv_hash, &mut send_sig, &mut changes_dir, true).download_changes(progress.inner.clone(),&mut recv_hash,&mut send_sig,&mut changes_dir,true,) - replacement in pijul/src/remote/mod.rs at line 595
send_hash.send(*c).await?;send_hash.send(*c)?; - replacement in pijul/src/remote/mod.rs at line 619
send_hash.send(*c).await?;send_hash.send(*c)?; - replacement in pijul/src/remote/local.rs at line 129
hashes: &mut tokio::sync::mpsc::Receiver<libpijul::pristine::Hash>,progress: Arc<std::sync::Mutex<crate::progress::InnerCursors>>,hashes: &mut tokio::sync::mpsc::UnboundedReceiver<libpijul::pristine::Hash>, - edit in pijul/src/remote/local.rs at line 137
progress.lock().unwrap().cursors[0].incr(); - edit in pijul/src/remote/http.rs at line 6
use indicatif::ProgressBar; - replacement in pijul/src/remote/http.rs at line 73
hashes: &mut tokio::sync::mpsc::Receiver<libpijul::pristine::Hash>,progress: std::sync::Arc<std::sync::Mutex<crate::progress::InnerCursors>>,hashes: &mut tokio::sync::mpsc::UnboundedReceiver<libpijul::pristine::Hash>, - edit in pijul/src/remote/http.rs at line 79[4.1338]→[4.3170:3221](∅→∅),[4.3221]→[4.1282:1362](∅→∅),[4.1316]→[4.1282:1362](∅→∅),[4.1362]→[4.848:926](∅→∅),[4.926]→[4.1437:1448](∅→∅),[4.1437]→[4.1437:1448](∅→∅),[4.1448]→[4.927:981](∅→∅)
let progress = ProgressBar::new(0 as u64);progress.set_style(indicatif::ProgressStyle::default_bar().template(" Downloading changes {wide_bar} {pos:>5}/{len}"),);let progress = super::PROGRESS.add(progress); - edit in pijul/src/remote/http.rs at line 82
progress.inc_length(1); - edit in pijul/src/remote/http.rs at line 83
progress.inc(1); - edit in pijul/src/remote/http.rs at line 93
debug!("waiting for process {:?}", cur); - edit in pijul/src/remote/http.rs at line 95
debug!("sending {:?}", c);progress.lock().unwrap().cursors[0].incr(); - edit in pijul/src/remote/http.rs at line 99
progress.abandon(); - edit in pijul/src/remote/http.rs at line 101
debug!("sent"); - edit in pijul/src/remote/http.rs at line 108
debug!("sending {:?}", c);progress.lock().unwrap().cursors[0].incr(); - edit in pijul/src/remote/http.rs at line 112
progress.abandon(); - edit in pijul/src/remote/http.rs at line 114
debug!("sent"); - edit in pijul/src/remote/http.rs at line 116[4.434]→[4.1349:1359](∅→∅),[4.2118]→[4.1349:1359](∅→∅),[4.1349]→[4.1349:1359](∅→∅),[4.1359]→[4.1433:1470](∅→∅),[4.1470]→[4.1449:1537](∅→∅),[4.1537]→[4.982:1055](∅→∅),[4.1055]→[4.1618:1633](∅→∅),[4.1618]→[4.1618:1633](∅→∅),[4.1633]→[4.1470:1501](∅→∅),[4.1470]→[4.1470:1501](∅→∅)
}if !progress.is_finished() {progress.set_style(indicatif::ProgressStyle::default_bar().template("✓ Downloading changes {pos:>5}/{len}"),);progress.finish(); - edit in pijul/src/remote/http.rs at line 126[4.1011]→[4.1011:1074](∅→∅),[4.1074]→[4.1634:1714](∅→∅),[4.1714]→[4.1056:1134](∅→∅),[4.411]→[4.1787:1798](∅→∅),[4.1134]→[4.1787:1798](∅→∅),[4.1787]→[4.1787:1798](∅→∅)
let progress = ProgressBar::new(changes.len() as u64);progress.set_style(indicatif::ProgressStyle::default_bar().template(" Uploading changes {wide_bar} {pos:>5}/{len}"),); - edit in pijul/src/remote/http.rs at line 153
progress.inc(1); - edit in pijul/src/remote/http.rs at line 155[4.1511]→[4.1799:1827](∅→∅),[4.1827]→[4.1135:1237](∅→∅),[4.489]→[4.1954:1965](∅→∅),[4.1237]→[4.1954:1965](∅→∅),[4.1954]→[4.1954:1965](∅→∅),[4.1965]→[4.1909:1936](∅→∅),[4.1511]→[4.1909:1936](∅→∅)
progress.set_style(indicatif::ProgressStyle::default_bar().template("✓ Uploading changes {pos:>5}/{len}"),);progress.finish(); - file addition: progress.rs[4.21414]
use std::borrow::Cow;use std::io::Write;use std::sync::{Arc, Mutex};pub struct Cursors {pub inner: Arc<Mutex<InnerCursors>>,t: std::thread::JoinHandle<()>,}pub struct InnerCursors {drawn: usize,pub cursors: Vec<Cursor>,n_post: usize,n_pre: usize,w: usize,stop: bool,}impl Cursors {pub fn new() -> Self {let inner = Arc::new(Mutex::new(InnerCursors {drawn: 0,cursors: Vec::new(),n_post: 0,n_pre: 0,stop: false,w: 0,}));let inner_ = inner.clone();let t = std::thread::spawn(move || loop {{let mut inner = if let Ok(inner) = inner_.lock() {inner} else {break;};if inner.stop {inner.render().unwrap();break;} else {inner.render().unwrap();}}std::thread::sleep(std::time::Duration::from_millis(100));});Cursors { inner, t }}pub fn stop(&self) {if let Ok(mut n) = self.inner.lock() {n.stop = true}}pub fn join(self) {self.stop();self.t.join().unwrap();}pub fn borrow_mut(&self,) -> Result<std::sync::MutexGuard<InnerCursors>,std::sync::PoisonError<std::sync::MutexGuard<'_, InnerCursors>>,> {let mut m = self.inner.lock()?;m.n_pre = 0;Ok(m)}}#[allow(dead_code)]pub enum Cursor {Static {pre: Cow<'static, str>,},Bar {pre: Cow<'static, str>,n: usize,i: usize,},Spin {pre: Cow<'static, str>,i: usize,},}impl Cursor {fn pre(&self) -> &str {match self {Cursor::Static { pre } => pre,Cursor::Bar { pre, .. } => pre,Cursor::Spin { pre, .. } => pre,}}fn n(&self) -> usize {match self {Cursor::Bar { n, .. } => {let mut n = *n;let mut r = 6;while n > 0 {n /= 10;r += 2}r}_ => 0,}}pub fn incr(&mut self) {match self {Cursor::Bar { i, .. } => *i += 1,_ => {}}}fn render<W: std::io::Write>(&mut self,stdout: &mut W,npre: usize,npost: usize,w: usize,) -> Result<(), std::io::Error> {match self {Cursor::Static { pre } => {for _ in 0..npre - pre.chars().count() {stdout.write_all(b" ")?;}stdout.write_all(pre.as_bytes())?;// Fil the rest of the line with spaces.for _ in 0..w - npre {stdout.write_all(b" ")?;}Ok(())}Cursor::Bar { pre, i, n } => {for _ in 0..npre - pre.chars().count() {stdout.write_all(b" ")?;}// Comupte the appropriate width for the bar.let w = w - npre - npost;// Output the bar.write!(stdout, "{} [", pre)?;let k = (w as usize * *i) / (*n - 1);for j in 0..w as usize {if j < k {write!(stdout, "=")?;} else if j == k {write!(stdout, ">")?;} else {write!(stdout, " ")?}}write!(stdout, "] {}/{}", *i, *n)?;let mut nw = npost - 6;{let mut n = *n;while n > 0 {n /= 10;nw -= 1}let mut n = *i;while n > 0 {n /= 10;nw -= 1}}for _ in 0..nw {stdout.write_all(b" ")?;}Ok(())}Cursor::Spin { pre, i } => {for _ in 0..npre - pre.chars().count() {stdout.write_all(b" ")?;}stdout.write_all(pre.as_bytes())?;stdout.write_all(b" ")?;const SYM: [&str; 8] = ["←", "↖", "↑", "↗", "→", "↘", "↓", "↙"];stdout.write_all(SYM[*i].as_bytes())?;*i = (*i + 1) % SYM.len();// Fill the rest of the line with spaces.for _ in 0..w - npre - 2 {stdout.write_all(b" ")?;}Ok(())}}}}impl InnerCursors {fn render(&mut self) -> Result<(), std::io::Error> {use terminal_size::*;let mut stdout = std::io::stdout();if let Some((Width(w), _)) = terminal_size() {if self.n_pre == 0 {self.n_post = 0;for c in self.cursors.iter() {let n_pre = c.pre().chars().count();self.n_pre = self.n_pre.max(n_pre);self.n_post = self.n_post.max(c.n());}}let n = (self.w + w as usize - 1) / w as usize;for _ in 0..self.drawn * n {stdout.write_all(b"\x1B[F")?;}self.w = w as usize;for c in self.cursors.iter_mut() {c.render(&mut stdout, self.n_pre, self.n_post, w as usize)?;// Clear the end of the line and move to the next one.stdout.write_all(b"\x1B[K\n")?;}self.drawn = self.cursors.len();// Erase the terminal after the cursor.stdout.write_all(b"\x1B[J")?;stdout.flush()?;}Ok(())}} - edit in pijul/src/main.rs at line 3
mod progress; - edit in pijul/src/commands/pushpull.rs at line 408[4.11788]→[4.72:154](∅→∅),[4.120449]→[4.72:154](∅→∅),[4.154]→[4.562:749](∅→∅),[4.562]→[4.562:749](∅→∅)
let progress = indicatif::ProgressBar::new(to_download.len() as u64);progress.set_style(indicatif::ProgressStyle::default_spinner().template(" Applying changes {wide_bar} {pos}/{len}"),); - edit in pijul/src/commands/pushpull.rs at line 410
progress.inc(1); - edit in pijul/src/commands/pushpull.rs at line 411
progress.set_style(indicatif::ProgressStyle::default_bar().template("✓ Applying changes {wide_bar} {pos}/{len}"),);progress.finish(); - edit in pijul/src/commands/pushpull.rs at line 418
let progress = indicatif::ProgressBar::new_spinner();progress.set_style(indicatif::ProgressStyle::default_spinner().template("{spinner} Outputting repository"),);progress.enable_steady_tick(100); - edit in pijul/src/commands/pushpull.rs at line 480[4.1293]→[4.2211:2372](∅→∅),[4.11136]→[4.2211:2372](∅→∅),[4.120955]→[4.2211:2372](∅→∅),[4.2372]→[4.120955:120956](∅→∅),[4.120955]→[4.120955:120956](∅→∅)
progress.set_style(indicatif::ProgressStyle::default_spinner().template("✓ Outputting repository"),);progress.finish(); - edit in pijul/src/commands/clone.rs at line 82
let progress = indicatif::ProgressBar::new_spinner();progress.set_style(indicatif::ProgressStyle::default_spinner().template("{spinner} Outputting repository"),);progress.enable_steady_tick(100); - edit in pijul/src/commands/clone.rs at line 92[4.15909]→[4.2373:2507](∅→∅),[4.185801]→[4.2373:2507](∅→∅),[4.2507]→[4.2563:2590](∅→∅),[4.185801]→[4.2563:2590](∅→∅)
progress.set_style(indicatif::ProgressStyle::default_spinner().template("✓ Outputting repository"),);progress.finish(); - replacement in pijul/Cargo.toml at line 4
version = "1.0.0-alpha.43"version = "1.0.0-alpha.44" - replacement in pijul/Cargo.toml at line 82
indicatif = "0.15"terminal_size = "0.1" - replacement in Cargo.toml at line 2
members = [ "pijul-macros", "pijul", "libpijul" ][4.1030201]members = [ "pijul-macros", "pijul", "libpijul", "progress" ] - edit in Cargo.nix at line 66
};# Debug support which might change between releases.# File a bug if you depend on any for non-debug work!debug = internal.debugCrate { inherit packageId; };};"progress" = rec {packageId = "progress";build = internal.buildRustCrateWithFeatures {packageId = "progress"; - edit in Cargo.nix at line 726[4.28722]→[4.275:330](∅→∅),[4.330]→[4.138789:138817](∅→∅),[4.138817]→[4.358:384](∅→∅),[4.358]→[4.358:384](∅→∅),[4.384]→[4.138818:138891](∅→∅),[4.390]→[4.28900:28920](∅→∅),[4.457]→[4.28900:28920](∅→∅),[4.138891]→[4.28900:28920](∅→∅),[4.28900]→[4.28900:28920](∅→∅),[4.28920]→[4.458:515](∅→∅),[4.515]→[4.28970:29018](∅→∅),[4.28970]→[4.28970:29018](∅→∅),[4.29018]→[4.516:595](∅→∅),[4.595]→[3.1585:1657](∅→∅),[3.1657]→[4.656:1256](∅→∅),[4.656]→[4.656:1256](∅→∅),[4.1256]→[4.75031:75043](∅→∅),[4.29073]→[4.75031:75043](∅→∅),[4.75043]→[4.1257:1298](∅→∅),[4.1298]→[4.70:104](∅→∅),[4.104]→[3.1658:1730](∅→∅),[3.1730]→[4.1399:1482](∅→∅),[4.1399]→[4.1399:1482](∅→∅),[4.1669]→[4.1669:1681](∅→∅),[4.1681]→[4.75043:75054](∅→∅),[4.75043]→[4.75043:75054](∅→∅),[4.75054]→[4.1682:1743](∅→∅),[4.1743]→[4.138892:138950](∅→∅),[4.138950]→[4.1826:1908](∅→∅),[4.1826]→[4.1826:1908](∅→∅),[4.1908]→[4.138951:139039](∅→∅),[4.2035]→[4.75063:75072](∅→∅),[4.139039]→[4.75063:75072](∅→∅),[4.75063]→[4.75063:75072](∅→∅)
"console" = rec {crateName = "console";version = "0.14.0";edition = "2018";sha256 = "1ajnr0rga4vya0fza12ighf3ffkm86w1rv8p5wf443s8nd30kj3w";authors = ["Armin Ronacher <armin.ronacher@active-4.com>"];dependencies = [{name = "encode_unicode";packageId = "encode_unicode";target = { target, features }: (target."windows" or false);}{name = "lazy_static";packageId = "lazy_static";}{name = "libc";packageId = "libc";}{name = "regex";packageId = "regex";optional = true;usesDefaultFeatures = false;features = [ "std" ];}{name = "terminal_size";packageId = "terminal_size";}{name = "unicode-width";packageId = "unicode-width";optional = true;}{name = "winapi";packageId = "winapi";target = { target, features }: (target."windows" or false);features = [ "winbase" "winuser" "consoleapi" "processenv" "wincon" ];}];features = {"ansi-parsing" = [ "regex" ];"default" = [ "unicode-width" "ansi-parsing" ];"windows-console-colors" = [ "ansi-parsing" "winapi-util" ];};resolvedDefaultFeatures = [ "ansi-parsing" "default" "regex" "unicode-width" ];}; - edit in Cargo.nix at line 1117
"encode_unicode" = rec {crateName = "encode_unicode";version = "0.3.6";edition = "2015";sha256 = "07w3vzrhxh9lpjgsg2y5bwzfar2aq35mdznvcp3zjl0ssj7d4mx3";authors = ["Torbjørn Birch Moltu <t.b.moltu@lyse.net>"];features = {"default" = [ "std" ];};resolvedDefaultFeatures = [ "default" "std" ];}; - edit in Cargo.nix at line 2423
"indicatif" = rec {crateName = "indicatif";version = "0.15.0";edition = "2018";sha256 = "1r4n50mclyi4c7b9c9mlma1rhchjamw71r3z8vgqcmp24mhvbakv";authors = ["Armin Ronacher <armin.ronacher@active-4.com>"];dependencies = [{name = "console";packageId = "console";}{name = "lazy_static";packageId = "lazy_static";}{name = "number_prefix";packageId = "number_prefix";}{name = "regex";packageId = "regex";usesDefaultFeatures = false;features = [ "std" ];}];features = {"improved_unicode" = [ "unicode-segmentation" "unicode-width" "console/unicode-width" ];"with_rayon" = [ "rayon" ];};resolvedDefaultFeatures = [ "default" ];}; - edit in Cargo.nix at line 3295
};"number_prefix" = rec {crateName = "number_prefix";version = "0.3.0";edition = "2015";sha256 = "0slm4mqmpgs6hvz22ycny9lvyvl9ivs80a1lncslp7lszz02zc0p";authors = ["Benjamin Sago <ogham@bsago.me>"];features = {"default" = [ "std" ];};resolvedDefaultFeatures = [ "default" "std" ]; - replacement in Cargo.nix at line 3556
version = "1.0.0-alpha.43";version = "1.0.0-alpha.44"; - edit in Cargo.nix at line 3634
}{name = "indicatif";packageId = "indicatif"; - edit in Cargo.nix at line 3696
name = "terminal_size";packageId = "terminal_size";}{ - edit in Cargo.nix at line 3958
"progress" = rec {crateName = "progress";version = "0.1.0";edition = "2018";crateBin = [{ name = "progress"; path = "src/main.rs"; }];src = lib.cleanSourceWith { filter = sourceFilter; src = ./progress; };authors = ["Pierre-Étienne Meunier <pmeunier@mailbox.org>"];dependencies = [{name = "terminal_size";packageId = "terminal_size";}];}; - replacement in Cargo.nix at line 4826
version = "1.0.63";version = "1.0.64"; - replacement in Cargo.nix at line 4828
sha256 = "1xhbc83n1pwiw02ddqf98gwynihscg69h2nfq0wajjvsfjwmsls3";sha256 = "0y9gk3yikncrc0zajmwc0pidr7zfwafawb4gidf6mqyskzf9g7kr"; - replacement in Cargo.nix at line 6766
resolvedDefaultFeatures = [ "basetsd" "cfg" "consoleapi" "errhandlingapi" "evntrace" "fileapi" "handleapi" "impl-debug" "impl-default" "in6addr" "inaddr" "ioapiset" "knownfolders" "lmcons" "memoryapi" "minschannel" "minwinbase" "minwindef" "mswsock" "namedpipeapi" "ntdef" "ntsecapi" "ntstatus" "objbase" "processenv" "processthreadsapi" "profileapi" "schannel" "securitybaseapi" "shlobj" "sspi" "std" "synchapi" "sysinfoapi" "threadpoollegacyapiset" "timezoneapi" "winbase" "wincon" "wincrypt" "windef" "winerror" "winioctl" "winnt" "winreg" "winsock2" "winuser" "ws2def" "ws2ipdef" "ws2tcpip" ];resolvedDefaultFeatures = [ "basetsd" "cfg" "consoleapi" "errhandlingapi" "evntrace" "fileapi" "handleapi" "impl-debug" "impl-default" "in6addr" "inaddr" "ioapiset" "knownfolders" "lmcons" "memoryapi" "minschannel" "minwinbase" "minwindef" "mswsock" "namedpipeapi" "ntdef" "ntsecapi" "ntstatus" "objbase" "processenv" "processthreadsapi" "profileapi" "schannel" "securitybaseapi" "shlobj" "sspi" "std" "synchapi" "sysinfoapi" "threadpoollegacyapiset" "timezoneapi" "winbase" "wincon" "wincrypt" "windef" "winerror" "winioctl" "winnt" "winreg" "winsock2" "ws2def" "ws2ipdef" "ws2tcpip" ]; - edit in Cargo.lock at line 231[4.4466]→[4.4466:4483](∅→∅),[4.4483]→[4.141614:141633](∅→∅),[4.141633]→[4.4502:4567](∅→∅),[4.4502]→[4.4502:4567](∅→∅),[4.4567]→[4.141634:141712](∅→∅),[4.141712]→[4.4645:4752](∅→∅),[4.4645]→[4.4645:4752](∅→∅),[4.4752]→[4.755:766](∅→∅),[4.652]→[4.1038025:1038027](∅→∅),[4.766]→[4.1038025:1038027](∅→∅),[4.1038025]→[4.1038025:1038027](∅→∅),[4.832]→[4.832:845](∅→∅)
name = "console"version = "0.14.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "7cc80946b3480f421c2f17ed1cb841753a371c7c5104f51d507e13f532c856aa"dependencies = ["encode_unicode","lazy_static","libc","regex","terminal_size","unicode-width","winapi",][[package]] - edit in Cargo.lock at line 389
name = "encode_unicode"version = "0.3.6"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"[[package]] - edit in Cargo.lock at line 831
][[package]]name = "indicatif"version = "0.15.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "7baab56125e25686df467fe470785512329883aab42696d661247aca2a2896e4"dependencies = ["console","lazy_static","number_prefix","regex", - edit in Cargo.lock at line 1141
[[package]]name = "number_prefix"version = "0.3.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "17b02fc0ff9a9e4b35b3342880f48e896ebf69f2967921fe8646bf5b7125956a" - replacement in Cargo.lock at line 1245
version = "1.0.0-alpha.43"version = "1.0.0-alpha.44" - edit in Cargo.lock at line 1264
"indicatif", - edit in Cargo.lock at line 1278
"terminal_size", - edit in Cargo.lock at line 1388
name = "progress"version = "0.1.0"dependencies = ["terminal_size",][[package]] - replacement in Cargo.lock at line 1678
version = "1.0.63"version = "1.0.64" - replacement in Cargo.lock at line 1680
checksum = "43535db9747a4ba938c0ce0a98cc631a46ebf943c9e1d604e091df6007620bf6"checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79"