mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
rename new_context method
Summary: This method is a footgun: it's easy to find for bootcampers working on migration to new CLI and it's not a good choice for all usecases. Let's rename it to stress out that it provided basic logging which won't suit every usecase. Reviewed By: clara-9 Differential Revision: D38469579 fbshipit-source-id: 5b08b0b1e5de4d2a54f2ed32f7a8585e19fd3c22
This commit is contained in:
parent
97d45dc989
commit
474614a431
@ -192,8 +192,11 @@ impl MononokeApp {
|
||||
&self.env.readonly_storage
|
||||
}
|
||||
|
||||
/// Create a basic CoreContext.
|
||||
pub fn new_context(&self) -> CoreContext {
|
||||
/// Create a basic CoreContext without scuba logging. Good choice for
|
||||
/// simple CLI tools like admin.
|
||||
///
|
||||
/// Warning: returned context doesn't provide any scuba logging!
|
||||
pub fn new_basic_context(&self) -> CoreContext {
|
||||
CoreContext::new_with_logger(self.env.fb, self.logger().clone())
|
||||
}
|
||||
|
||||
@ -406,7 +409,7 @@ impl MononokeApp {
|
||||
let blobstore = if redaction == Redaction::Enabled {
|
||||
let redacted_blobs = self
|
||||
.repo_factory
|
||||
.redacted_blobs(self.new_context(), &storage_config.metadata)
|
||||
.redacted_blobs(self.new_basic_context(), &storage_config.metadata)
|
||||
.await?;
|
||||
RedactedBlobstore::new(
|
||||
blobstore,
|
||||
|
@ -36,7 +36,7 @@ pub enum BlobstoreSubcommand {
|
||||
}
|
||||
|
||||
pub async fn run(app: MononokeApp, args: CommandArgs) -> Result<()> {
|
||||
let ctx = app.new_context();
|
||||
let ctx = app.new_basic_context();
|
||||
|
||||
let blobstore = app
|
||||
.open_blobstore(&args.repo_blobstore_args)
|
||||
|
@ -99,7 +99,7 @@ async fn get_blobstore(
|
||||
}
|
||||
|
||||
pub async fn run(app: MononokeApp, args: CommandArgs) -> Result<()> {
|
||||
let ctx = app.new_context();
|
||||
let ctx = app.new_basic_context();
|
||||
|
||||
let repo_arg = args.repo_args.id_or_name()?;
|
||||
let (_repo_name, repo_config) = app.repo_config(repo_arg)?;
|
||||
|
@ -97,7 +97,7 @@ pub enum BookmarksSubcommand {
|
||||
}
|
||||
|
||||
pub async fn run(app: MononokeApp, args: CommandArgs) -> Result<()> {
|
||||
let ctx = app.new_context();
|
||||
let ctx = app.new_basic_context();
|
||||
|
||||
let repo: Repo = app
|
||||
.open_repo(&args.repo)
|
||||
|
@ -77,7 +77,7 @@ pub enum ChangelogSubcommand {
|
||||
}
|
||||
|
||||
pub async fn run(app: MononokeApp, args: CommandArgs) -> Result<()> {
|
||||
let ctx = app.new_context();
|
||||
let ctx = app.new_basic_context();
|
||||
|
||||
let repo: Repo = app
|
||||
.open_repo(&args.repo_args)
|
||||
|
@ -120,7 +120,7 @@ pub enum CommitSubcommand {
|
||||
}
|
||||
|
||||
pub async fn run(app: MononokeApp, args: CommandArgs) -> Result<()> {
|
||||
let ctx = app.new_context();
|
||||
let ctx = app.new_basic_context();
|
||||
|
||||
let repo: Repo = app
|
||||
.open_repo(&args.repo_args)
|
||||
|
@ -60,7 +60,7 @@ pub struct Repo {
|
||||
}
|
||||
|
||||
pub async fn run(app: MononokeApp, args: CommandArgs) -> Result<()> {
|
||||
let ctx = app.new_context();
|
||||
let ctx = app.new_basic_context();
|
||||
|
||||
let repo: Repo = app
|
||||
.open_repo(&args.repo)
|
||||
|
@ -202,7 +202,7 @@ impl FetchPublicArgs {
|
||||
}
|
||||
|
||||
pub async fn run(app: MononokeApp, args: CommandArgs) -> Result<()> {
|
||||
let ctx = app.new_context();
|
||||
let ctx = app.new_basic_context();
|
||||
let repo: Repo = app.open_repo(&args.repo).await?;
|
||||
let input_format = args.input_format;
|
||||
|
||||
|
@ -53,7 +53,7 @@ pub enum EphemeralStoreSubcommand {
|
||||
}
|
||||
|
||||
pub async fn run(app: MononokeApp, args: CommandArgs) -> Result<()> {
|
||||
let ctx = app.new_context();
|
||||
let ctx = app.new_basic_context();
|
||||
let repo: Repo = app.open_repo(&args.repo).await?;
|
||||
|
||||
let subcommand_result = match args.subcommand {
|
||||
|
@ -81,7 +81,7 @@ pub enum ManifestKind {
|
||||
}
|
||||
|
||||
pub async fn run(app: MononokeApp, args: CommandArgs) -> Result<()> {
|
||||
let ctx = app.new_context();
|
||||
let ctx = app.new_basic_context();
|
||||
|
||||
let repo: Repo = app
|
||||
.open_repo(&args.repo_args)
|
||||
|
@ -114,7 +114,7 @@ impl FilestoreItemIdArgs {
|
||||
}
|
||||
|
||||
pub async fn run(app: MononokeApp, args: CommandArgs) -> Result<()> {
|
||||
let ctx = app.new_context();
|
||||
let ctx = app.new_basic_context();
|
||||
|
||||
let repo: Repo = app
|
||||
.open_repo(&args.repo)
|
||||
|
@ -89,7 +89,7 @@ pub enum HgSyncSubcommand {
|
||||
}
|
||||
|
||||
pub async fn run(app: MononokeApp, args: CommandArgs) -> Result<()> {
|
||||
let ctx = app.new_context();
|
||||
let ctx = app.new_basic_context();
|
||||
|
||||
let repo: Repo = app
|
||||
.open_repo(&args.repo)
|
||||
|
@ -79,7 +79,7 @@ pub enum MutableRenamesSubcommand {
|
||||
}
|
||||
|
||||
pub async fn run(app: MononokeApp, args: CommandArgs) -> Result<()> {
|
||||
let ctx = app.new_context();
|
||||
let ctx = app.new_basic_context();
|
||||
|
||||
let repo: Repo = app
|
||||
.open_repo(&args.repo)
|
||||
|
@ -69,7 +69,7 @@ pub enum RedactionSubcommand {
|
||||
}
|
||||
|
||||
pub async fn run(app: MononokeApp, args: CommandArgs) -> Result<()> {
|
||||
let ctx = app.new_context();
|
||||
let ctx = app.new_basic_context();
|
||||
|
||||
match args.subcommand {
|
||||
RedactionSubcommand::CreateKeyList(create_args) => {
|
||||
|
@ -33,7 +33,7 @@ pub struct Repo {
|
||||
}
|
||||
|
||||
pub async fn run(app: MononokeApp, args: CommandArgs) -> Result<()> {
|
||||
let ctx = app.new_context();
|
||||
let ctx = app.new_basic_context();
|
||||
|
||||
let repo: Repo = app
|
||||
.open_repo(&args.repo)
|
||||
|
@ -78,7 +78,7 @@ fn get_blobstore_key(key_arg: Option<String>, config: RepoConfig) -> Result<Stri
|
||||
}
|
||||
|
||||
pub async fn run(app: MononokeApp, args: CommandArgs) -> Result<()> {
|
||||
let ctx = app.new_context();
|
||||
let ctx = app.new_basic_context();
|
||||
let repo_arg = args.repo.id_or_name()?;
|
||||
let (_, repo_config) = app.repo_config(repo_arg)?;
|
||||
let logger = &app.logger();
|
||||
|
@ -58,7 +58,7 @@ pub async fn run(app: MononokeApp, args: CommandArgs) -> Result<()> {
|
||||
.await
|
||||
.context("Failed to open repo")?;
|
||||
|
||||
let ctx = app.new_context();
|
||||
let ctx = app.new_basic_context();
|
||||
|
||||
stream::iter(entries)
|
||||
.try_for_each_concurrent(args.concurrency, {
|
||||
|
@ -46,7 +46,7 @@ pub struct CommandArgs {
|
||||
}
|
||||
|
||||
pub async fn run(app: MononokeApp, args: CommandArgs) -> Result<()> {
|
||||
let ctx = app.new_context();
|
||||
let ctx = app.new_basic_context();
|
||||
|
||||
let mut content = String::new();
|
||||
File::open(&args.bonsai_file)
|
||||
|
@ -303,7 +303,7 @@ fn print_name_hash_pairs(pairs: impl IntoIterator<Item = (String, impl Display)>
|
||||
}
|
||||
|
||||
pub async fn run(app: MononokeApp, args: CommandArgs) -> Result<()> {
|
||||
let ctx = app.new_context();
|
||||
let ctx = app.new_basic_context();
|
||||
|
||||
let repo: BlobRepo = app
|
||||
.open_repo(&args.repo_args)
|
||||
|
@ -93,7 +93,7 @@ pub struct Repo {
|
||||
}
|
||||
|
||||
pub async fn run(app: MononokeApp, args: CommandArgs) -> Result<()> {
|
||||
let ctx = app.new_context();
|
||||
let ctx = app.new_basic_context();
|
||||
|
||||
let repo: Repo = app
|
||||
.open_repo(&args.repo_args)
|
||||
|
Loading…
Reference in New Issue
Block a user