Skip to content

Commit

Permalink
Revert "Invert --statitics switch to become --no-statistics"
Browse files Browse the repository at this point in the history
This reverts commit aeb8778.
  • Loading branch information
Byron committed Jul 21, 2020
1 parent 9e8df59 commit 93a9b30
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 24 deletions.
14 changes: 7 additions & 7 deletions src/plumbing/lean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ mod options {
/// Possible values are "less-time" and "less-memory". Default is "less-memory".
pub algorithm: Option<core::VerifyAlgorithm>,

/// do not automatically output statistical information about the pack
#[argh(switch)]
pub no_statistics: bool,
/// output statistical information about the pack
#[argh(switch, short = 's')]
pub statistics: bool,
/// verbose progress messages are printed line by line
#[argh(switch, short = 'v')]
pub verbose: bool,
Expand Down Expand Up @@ -103,7 +103,7 @@ pub fn main() -> Result<()> {
SubCommands::VerifyPack(VerifyPack {
path,
verbose,
no_statistics,
statistics,
algorithm,
decode,
re_encode,
Expand All @@ -113,10 +113,10 @@ pub fn main() -> Result<()> {
path,
progress,
core::Context {
output_statistics: if no_statistics {
None
} else {
output_statistics: if statistics {
Some(core::OutputFormat::Human)
} else {
None
},
algorithm: algorithm.unwrap_or(core::VerifyAlgorithm::LessTime),
thread_limit,
Expand Down
10 changes: 5 additions & 5 deletions src/plumbing/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ mod options {
/// Verify the integrity of a pack or index file
#[structopt(setting = AppSettings::ColoredHelp)]
VerifyPack {
/// Do not output statistical information about the pack
#[structopt(long)]
no_statistics: bool,
/// output statistical information about the pack
#[structopt(long, short = "s")]
statistics: bool,
/// Determine the format to use when outputting statistics.
#[structopt(
long,
Expand Down Expand Up @@ -189,7 +189,7 @@ pub fn main() -> Result<()> {
decode,
re_encode,
progress_keep_open,
no_statistics,
statistics,
} => prepare_and_run(
"verify-pack",
verbose,
Expand All @@ -201,7 +201,7 @@ pub fn main() -> Result<()> {
(true, true) | (false, true) => core::VerifyMode::Sha1CRC32DecodeEncode,
(false, false) => core::VerifyMode::Sha1CRC32,
};
let output_statistics = if no_statistics { None } else { Some(format) };
let output_statistics = if statistics { Some(format) } else { None };
core::verify_pack_or_pack_index(
path,
progress,
Expand Down
2 changes: 1 addition & 1 deletion tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* [x] choice of algorithm in pack-verify
* [x] use pack streaming in pack-verify by default
* [x] set some unit tests cases to use the streaming algorithm
* [x] invert '--statistics' to become '--no-statistics' (it's free now)
* [ ] invert '--statistics' to become '--no-statistics' (it's free now)
* **progress - convenience**
* [x] `inc()` method and`inc_by(step)` method
* [ ] a way to measure throughput on drop
Expand Down
16 changes: 5 additions & 11 deletions tests/stateless-journey.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,38 +53,32 @@ title "CLI ${kind}"
(with "no statistics"
it "verifies the pack index successfully and with desired output" && {
WITH_SNAPSHOT="$snapshot/plumbing-verify-pack-index-success" \
expect_run $SUCCESSFULLY "$exe_plumbing" verify-pack --no-statistics "$PACK_INDEX_FILE"
}
)
(with "statistics"
it "verifies the pack index successfully and with desired output" && {
WITH_SNAPSHOT="$snapshot/plumbing-verify-pack-index-with-statistics-success" \
expect_run $SUCCESSFULLY "$exe_plumbing" verify-pack "$PACK_INDEX_FILE"
}
)
(with "statistics and less-memory algorithm"
(with "statistics"
it "verifies the pack index successfully and with desired output" && {
WITH_SNAPSHOT="$snapshot/plumbing-verify-pack-index-with-statistics-success" \
expect_run $SUCCESSFULLY "$exe_plumbing" verify-pack --algorithm less-memory "$PACK_INDEX_FILE"
expect_run $SUCCESSFULLY "$exe_plumbing" verify-pack --statistics "$PACK_INDEX_FILE"
}
)
(with "decode"
it "verifies the pack index successfully and with desired output, and decodes all objects" && {
WITH_SNAPSHOT="$snapshot/plumbing-verify-pack-index-success" \
expect_run $SUCCESSFULLY "$exe_plumbing" verify-pack --no-statistics --algorithm less-memory --decode "$PACK_INDEX_FILE"
expect_run $SUCCESSFULLY "$exe_plumbing" verify-pack --algorithm less-memory --decode "$PACK_INDEX_FILE"
}
)
(with "re-encode"
it "verifies the pack index successfully and with desired output, and re-encodes all objects" && {
WITH_SNAPSHOT="$snapshot/plumbing-verify-pack-index-success" \
expect_run $SUCCESSFULLY "$exe_plumbing" verify-pack --algorithm less-time --no-statistics --re-encode "$PACK_INDEX_FILE"
expect_run $SUCCESSFULLY "$exe_plumbing" verify-pack --algorithm less-time --re-encode "$PACK_INDEX_FILE"
}
)
if test "$kind" = "max"; then
(with "statistics (JSON)"
it "verifies the pack index successfully and with desired output" && {
WITH_SNAPSHOT="$snapshot/plumbing-verify-pack-index-with-statistics-json-success" \
expect_run $SUCCESSFULLY "$exe_plumbing" --threads 1 verify-pack --format json "$PACK_INDEX_FILE"
expect_run $SUCCESSFULLY "$exe_plumbing" --threads 1 verify-pack --statistics --format json "$PACK_INDEX_FILE"
}
)
fi
Expand Down

0 comments on commit 93a9b30

Please sign in to comment.