Skip to content

Commit

Permalink
examples: use settings_for_new_workspace() when initializing workspace
Browse files Browse the repository at this point in the history
Spotted while replacing callers of CommandHelper::settings().
  • Loading branch information
yuja committed Jan 6, 2025
1 parent 1f6e207 commit 127f7e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions cli/examples/custom-backend/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ fn run_custom_command(
match command {
CustomCommand::InitJit => {
let wc_path = command_helper.cwd();
let settings = command_helper.settings_for_new_workspace(wc_path)?;
// Initialize a workspace with the custom backend
Workspace::init_with_backend(
command_helper.settings(),
&settings,
wc_path,
&|settings, store_path| Ok(Box::new(JitBackend::init(settings, store_path)?)),
Signer::from_settings(command_helper.settings())
.map_err(WorkspaceInitError::SignInit)?,
Signer::from_settings(&settings).map_err(WorkspaceInitError::SignInit)?,
)?;
Ok(())
}
Expand Down
6 changes: 3 additions & 3 deletions cli/examples/custom-working-copy/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,17 @@ fn run_custom_command(
match command {
CustomCommand::InitConflicts => {
let wc_path = command_helper.cwd();
let settings = command_helper.settings_for_new_workspace(wc_path)?;
let backend_initializer = |settings: &UserSettings, store_path: &Path| {
let backend: Box<dyn Backend> =
Box::new(GitBackend::init_internal(settings, store_path)?);
Ok(backend)
};
Workspace::init_with_factories(
command_helper.settings(),
&settings,
wc_path,
&backend_initializer,
Signer::from_settings(command_helper.settings())
.map_err(WorkspaceInitError::SignInit)?,
Signer::from_settings(&settings).map_err(WorkspaceInitError::SignInit)?,
&ReadonlyRepo::default_op_store_initializer(),
&ReadonlyRepo::default_op_heads_store_initializer(),
&ReadonlyRepo::default_index_store_initializer(),
Expand Down

0 comments on commit 127f7e2

Please sign in to comment.