Unified · Split
| @@ -292,9 +292,9 @@ dependencies = [ · 291 unmodified lines | |||
| 292 | 292 | ||
| 293 | [[package]] | 293 | [[package]] |
| 294 | name = "cpuid-bool" | 294 | name = "cpuid-bool" |
| 295 | version = "0.1.1" | 295 | version = "0.1.2" |
| 296 | source = "registry+https://github.com/rust-lang/crates.io-index" | 296 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 297 | checksum = "ec6763c20301ab0dc67051d1b6f4cc9132ad9e6eddcb1f10c6c53ea6d6ae2183" | 297 | checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" |
| 298 | 298 | ||
| 299 | [[package]] | 299 | [[package]] |
| 300 | name = "crc" | 300 | name = "crc" |
| @@ -538,9 +538,9 @@ checksum = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789" · 237 unmodified lines | |||
| 538 | 538 | ||
| 539 | [[package]] | 539 | [[package]] |
| 540 | name = "futures-lite" | 540 | name = "futures-lite" |
| 541 | version = "0.1.5" | 541 | version = "0.1.6" |
| 542 | source = "registry+https://github.com/rust-lang/crates.io-index" | 542 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 543 | checksum = "08e706d5c313fd50778b4d2fd779b90ca79d474eebe4b4cb3e44b5f84ea799fe" | 543 | checksum = "af0bbcb0ec905ef6ee23fab499119b5da2362b8697d66e08d1ef01a8c0d438e2" |
| 544 | dependencies = [ | 544 | dependencies = [ |
| 545 | "fastrand", | 545 | "fastrand", |
| 546 | "futures-core", | 546 | "futures-core", |
| @@ -1107,22 +1107,23 @@ checksum = "7e0456befd48169b9f13ef0f0ad46d492cf9d2dbb918bcf38e01eed4ce3ec5e4" · 560 unmodified lines | |||
| 1107 | 1107 | ||
| 1108 | [[package]] | 1108 | [[package]] |
| 1109 | name = "proc-macro2" | 1109 | name = "proc-macro2" |
| 1110 | version = "1.0.18" | 1110 | version = "1.0.19" |
| 1111 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1111 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1112 | checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa" | 1112 | checksum = "04f5f085b5d71e2188cb8271e5da0161ad52c3f227a661a3c135fdf28e258b12" |
| 1113 | dependencies = [ | 1113 | dependencies = [ |
| 1114 | "unicode-xid", | 1114 | "unicode-xid", |
| 1115 | ] | 1115 | ] |
| 1116 | 1116 | ||
| 1117 | [[package]] | 1117 | [[package]] |
| 1118 | name = "prodash" | 1118 | name = "prodash" |
| 1119 | version = "7.0.3" | 1119 | version = "7.0.4" |
| 1120 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1120 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1121 | checksum = "07b07566ec8357eb8ff124bceecfe456c5cc6ff9667ffeb13ded2d47f6697776" | 1121 | checksum = "ee4fa33fe64f4fca880cebacf1645cb75ae75990f4d2804ac15842ed38fe0e25" |
| 1122 | dependencies = [ | 1122 | dependencies = [ |
| 1123 | "crosstermion", | 1123 | "crosstermion", |
| 1124 | "dashmap", | 1124 | "dashmap", |
| 1125 | "futures-core", | 1125 | "futures-core", |
| 1126 | "futures-lite", | ||
| 1126 | "futures-util", | 1127 | "futures-util", |
| 1127 | "humantime 2.0.1", | 1128 | "humantime 2.0.1", |
| 1128 | "log", | 1129 | "log", |
| @@ -1455,9 +1456,9 @@ dependencies = [ · 326 unmodified lines | |||
| 1455 | 1456 | ||
| 1456 | [[package]] | 1457 | [[package]] |
| 1457 | name = "syn" | 1458 | name = "syn" |
| 1458 | version = "1.0.34" | 1459 | version = "1.0.35" |
| 1459 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1460 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1460 | checksum = "936cae2873c940d92e697597c5eee105fb570cd5689c695806f672883653349b" | 1461 | checksum = "fb7f4c519df8c117855e19dd8cc851e89eb746fe7a73f0157e0d95fdec5369b0" |
| 1461 | dependencies = [ | 1462 | dependencies = [ |
| 1462 | "proc-macro2", | 1463 | "proc-macro2", |
| 1463 | "quote", | 1464 | "quote", |
| @@ -6,6 +6,7 @@ pub struct Log { · 5 unmodified lines | |||
| 6 | max: Option<u32>, | 6 | max: Option<u32>, |
| 7 | unit: Option<&'static str>, | 7 | unit: Option<&'static str>, |
| 8 | last_set: Option<std::time::SystemTime>, | 8 | last_set: Option<std::time::SystemTime>, |
| 9 | step: u32, | ||
| 9 | current_level: usize, | 10 | current_level: usize, |
| 10 | max_level: usize, | 11 | max_level: usize, |
| 11 | } | 12 | } |
| @@ -19,6 +20,7 @@ impl Log { · 7 unmodified lines | |||
| 19 | current_level: 0, | 20 | current_level: 0, |
| 20 | max_level: max_level.unwrap_or(usize::MAX), | 21 | max_level: max_level.unwrap_or(usize::MAX), |
| 21 | max: None, | 22 | max: None, |
| 23 | step: 0, | ||
| 22 | unit: None, | 24 | unit: None, |
| 23 | last_set: None, | 25 | last_set: None, |
| 24 | } | 26 | } |
| @@ -33,6 +35,7 @@ impl Progress for Log { · 8 unmodified lines | |||
| 33 | name: format!("{}::{}", self.name, Into::<String>::into(name)), | 35 | name: format!("{}::{}", self.name, Into::<String>::into(name)), |
| 34 | current_level: self.current_level + 1, | 36 | current_level: self.current_level + 1, |
| 35 | max_level: self.max_level, | 37 | max_level: self.max_level, |
| 38 | step: 0, | ||
| 36 | max: None, | 39 | max: None, |
| 37 | unit: None, | 40 | unit: None, |
| 38 | last_set: None, | 41 | last_set: None, |
| @@ -45,6 +48,7 @@ impl Progress for Log { · 6 unmodified lines | |||
| 45 | } | 48 | } |
| 46 | 49 | ||
| 47 | fn set(&mut self, step: u32) { | 50 | fn set(&mut self, step: u32) { |
| 51 | self.step = step; | ||
| 48 | if self.current_level > self.max_level { | 52 | if self.current_level > self.max_level { |
| 49 | return; | 53 | return; |
| 50 | } | 54 | } |
| @@ -69,6 +73,10 @@ impl Progress for Log { · 18 unmodified lines | |||
| 69 | } | 73 | } |
| 70 | } | 74 | } |
| 71 | 75 | ||
| 76 | fn inc_by(&mut self, step: u32) { | ||
| 77 | self.set(self.step + step) | ||
| 78 | } | ||
| 79 | |||
| 72 | fn message(&mut self, level: MessageLevel, message: impl Into<String>) { | 80 | fn message(&mut self, level: MessageLevel, message: impl Into<String>) { |
| 73 | let message: String = message.into(); | 81 | let message: String = message.into(); |
| 74 | match level { | 82 | match level { |
| @@ -38,6 +38,20 @@ pub trait Progress { · 37 unmodified lines | |||
| 38 | /// **Note**: that this call has no effect unless `init(…)` was called before. | 38 | /// **Note**: that this call has no effect unless `init(…)` was called before. |
| 39 | fn set(&mut self, step: u32); | 39 | fn set(&mut self, step: u32); |
| 40 | 40 | ||
| 41 | /// Increment the current progress to the given `step`. The cost of this call is negligible, | ||
| 42 | /// making manual throttling *not* necessary. | ||
| 43 | /// | ||
| 44 | /// **Note**: that this call has no effect unless `init(…)` was called before. | ||
| 45 | fn inc_by(&mut self, step: u32); | ||
| 46 | |||
| 47 | /// Increment the current progress to the given 1. The cost of this call is negligible, | ||
| 48 | /// making manual throttling *not* necessary. | ||
| 49 | /// | ||
| 50 | /// **Note**: that this call has no effect unless `init(…)` was called before. | ||
| 51 | fn inc(&mut self) { | ||
| 52 | self.inc_by(1) | ||
| 53 | } | ||
| 54 | |||
| 41 | /// Create a `message` of the given `level` and store it with the progress tree. | 55 | /// Create a `message` of the given `level` and store it with the progress tree. |
| 42 | /// | 56 | /// |
| 43 | /// Use this to provide additional,human-readable information about the progress | 57 | /// Use this to provide additional,human-readable information about the progress |
| @@ -71,6 +85,8 @@ impl Progress for Discard { · 27 unmodified lines | |||
| 71 | 85 | ||
| 72 | fn set(&mut self, _step: u32) {} | 86 | fn set(&mut self, _step: u32) {} |
| 73 | 87 | ||
| 88 | fn inc_by(&mut self, _step: u32) {} | ||
| 89 | |||
| 74 | fn message(&mut self, _level: MessageLevel, _message: impl Into<String>) {} | 90 | fn message(&mut self, _level: MessageLevel, _message: impl Into<String>) {} |
| 75 | } | 91 | } |
| 76 | 92 | ||
| @@ -107,6 +123,13 @@ where · 30 unmodified lines | |||
| 107 | } | 123 | } |
| 108 | } | 124 | } |
| 109 | 125 | ||
| 126 | fn inc_by(&mut self, step: u32) { | ||
| 127 | match self { | ||
| 128 | Either::Left(l) => l.inc_by(step), | ||
| 129 | Either::Right(r) => r.inc_by(step), | ||
| 130 | } | ||
| 131 | } | ||
| 132 | |||
| 110 | fn message(&mut self, level: MessageLevel, message: impl Into<String>) { | 133 | fn message(&mut self, level: MessageLevel, message: impl Into<String>) { |
| 111 | match self { | 134 | match self { |
| 112 | Either::Left(l) => l.message(level, message), | 135 | Either::Left(l) => l.message(level, message), |
| @@ -147,6 +170,10 @@ where · 34 unmodified lines | |||
| 147 | self.0.set(step) | 170 | self.0.set(step) |
| 148 | } | 171 | } |
| 149 | 172 | ||
| 173 | fn inc_by(&mut self, step: u32) { | ||
| 174 | self.0.inc_by(step) | ||
| 175 | } | ||
| 176 | |||
| 150 | fn message(&mut self, level: MessageLevel, message: impl Into<String>) { | 177 | fn message(&mut self, level: MessageLevel, message: impl Into<String>) { |
| 151 | self.0.message(level, message) | 178 | self.0.message(level, message) |
| 152 | } | 179 | } |
| @@ -17,6 +17,10 @@ impl Progress for Item { · 16 unmodified lines | |||
| 17 | Item::set(self, step) | 17 | Item::set(self, step) |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | fn inc_by(&mut self, step: u32) { | ||
| 21 | self.inc_by(step) | ||
| 22 | } | ||
| 23 | |||
| 20 | fn message(&mut self, level: MessageLevel, message: impl Into<String>) { | 24 | fn message(&mut self, level: MessageLevel, message: impl Into<String>) { |
| 21 | Item::message( | 25 | Item::message( |
| 22 | self, | 26 | self, |
| @@ -132,10 +132,10 @@ impl index::File { · 131 unmodified lines | |||
| 132 | use git_object::Kind::*; | 132 | use git_object::Kind::*; |
| 133 | match object_kind { | 133 | match object_kind { |
| 134 | Tree | Commit | Tag => { | 134 | Tree | Commit | Tag => { |
| 135 | let obj = borrowed::Object::from_bytes(object_kind, buf.as_slice()) | 135 | let borrowed_object = borrowed::Object::from_bytes(object_kind, buf.as_slice()) |
| 136 | .map_err(|err| Error::ObjectDecode(err, object_kind, index_entry.oid))?; | 136 | .map_err(|err| Error::ObjectDecode(err, object_kind, index_entry.oid))?; |
| 137 | if let Mode::Sha1CRC32DecodeEncode = mode { | 137 | if let Mode::Sha1CRC32DecodeEncode = mode { |
| 138 | let object = owned::Object::from(obj); | 138 | let object = owned::Object::from(borrowed_object); |
| 139 | encode_buf.clear(); | 139 | encode_buf.clear(); |
| 140 | object.write_to(&mut *encode_buf)?; | 140 | object.write_to(&mut *encode_buf)?; |
| 141 | if encode_buf != buf { | 141 | if encode_buf != buf { |
| @@ -25,8 +25,7 @@ · 24 unmodified lines | |||
| 25 | * [x] set some unit tests cases to use the streaming algorithm | 25 | * [x] set some unit tests cases to use the streaming algorithm |
| 26 | * [x] invert '--statistics' to become '--no-statistics' (it's free now) | 26 | * [x] invert '--statistics' to become '--no-statistics' (it's free now) |
| 27 | * **progress - convenience** | 27 | * **progress - convenience** |
| 28 | * [ ] `inc()` method | 28 | * [x] `inc()` method and`inc_by(step)` method |
| 29 | * [ ] `inc_by(step)` method | ||
| 30 | * [ ] a way to measure throughput on drop | 29 | * [ ] a way to measure throughput on drop |
| 31 | * [ ] percentages somewhere near the progress bar | 30 | * [ ] percentages somewhere near the progress bar |
| 32 | * **plumbing - explode pack** | 31 | * **plumbing - explode pack** |