mononoke/admin: clean up unodes subcommand a bit

Summary:
I pattern matched off of this for the previous diff in this stack, and spotted
a bit of clean up that might make sense here:

- Using `.help()` for a subcommand overrides the whole help text. We meant to
  use `.about()` here. I fixed this in some copy-pasted code as well.
- Printing debug output alongside real output makes it harder to select the
  real output. I fixed this by logging debug output to stderr instead.

Reviewed By: StanislavGlebik

Differential Revision: D23471560

fbshipit-source-id: 7900cfe65613c48abd77faad6d6a45a7aa523b36
This commit is contained in:
Thomas Orozco 2020-09-03 09:30:18 -07:00 committed by Facebook GitHub Bot
parent 179e4eb80e
commit d77cf89ead
2 changed files with 9 additions and 9 deletions

View File

@ -37,7 +37,7 @@ const ARG_PATH: &str = "path";
pub fn build_subcommand<'a, 'b>() -> App<'a, 'b> {
let csid_arg = Arg::with_name(ARG_CSID)
.help("{hg|boinsai} changset id or bookmark name")
.help("{hg|bonsai} changeset id or bookmark name")
.index(1)
.required(true);
@ -50,13 +50,13 @@ pub fn build_subcommand<'a, 'b>() -> App<'a, 'b> {
.about("derive, inspect and verify deleted files manifest")
.subcommand(
SubCommand::with_name(COMMAND_MANIFEST)
.help("recursively list all deleted files manifest entries under the given path")
.about("recursively list all deleted files manifest entries under the given path")
.arg(csid_arg.clone())
.arg(path_arg.clone()),
)
.subcommand(
SubCommand::with_name(COMMAND_VERIFY)
.help("verify deleted manifest against actual paths deleted in commits")
.about("verify deleted manifest against actual paths deleted in commits")
.arg(csid_arg.clone())
.arg(
Arg::with_name(ARG_LIMIT)

View File

@ -24,7 +24,7 @@ use manifest::{Entry, ManifestOps, PathOrPrefix};
use mononoke_types::{ChangesetId, MPath};
use revset::AncestorsNodeStream;
use slog::Logger;
use slog::{info, Logger};
use std::collections::BTreeSet;
use unodes::RootUnodeManifestId;
@ -45,7 +45,7 @@ fn path_resolve(path: &str) -> Result<Option<MPath>, Error> {
pub fn build_subcommand<'a, 'b>() -> App<'a, 'b> {
let csid_arg = Arg::with_name(ARG_CSID)
.help("{hg|boinsai} changset id or bookmark name")
.help("{hg|bonsai} changeset id or bookmark name")
.index(1)
.required(true);
@ -63,13 +63,13 @@ pub fn build_subcommand<'a, 'b>() -> App<'a, 'b> {
)
.subcommand(
SubCommand::with_name(COMMAND_TREE)
.help("recursively list all unode entries starting with prefix")
.about("recursively list all unode entries starting with prefix")
.arg(csid_arg.clone())
.arg(path_arg.clone()),
)
.subcommand(
SubCommand::with_name(COMMAND_VERIFY)
.help("verify unode tree agains hg-manifest")
.about("verify unode tree agains hg-manifest")
.arg(csid_arg.clone())
.arg(
Arg::with_name(ARG_LIMIT)
@ -148,8 +148,8 @@ fn subcommand_tree(
RootUnodeManifestId::derive(ctx.clone(), repo.clone(), csid)
.from_err()
.and_then(move |root| {
println!("ROOT: {:?}", root);
println!("PATH: {:?}", path);
info!(ctx.logger(), "ROOT: {:?}", root);
info!(ctx.logger(), "PATH: {:?}", path);
root.manifest_unode_id()
.find_entries(ctx, repo.get_blobstore(), vec![PathOrPrefix::Prefix(path)])
.for_each(|(path, entry)| {