MCPcopy Create free account
hub / github.com/block/buzz / migrate_dev_repos_dir

Function migrate_dev_repos_dir

desktop/src-tauri/src/migration.rs:312–344  ·  view source on GitHub ↗

Copy the `.repos-dir` dotfile from `~/.buzz` → `~/.buzz-dev`, non-destructively. Must be called on dev builds BEFORE `resolve_repos_at_boot()` reads the dotfile, so the dev nest boots with the correct workspace configuration on its first launch. Skip-if-dest-exists so it is idempotent and never overwrites a value set directly by the dev nest.

()

Source from the content-addressed store, hash-verified

310/// its first launch. Skip-if-dest-exists so it is idempotent and never
311/// overwrites a value set directly by the dev nest.
312fn migrate_dev_repos_dir() {
313 let Some(home) = dirs::home_dir() else {
314 return;
315 };
316 let src = home.join(".buzz").join(".repos-dir");
317 if !src.exists() {
318 return;
319 }
320 let Some(dev_nest) = crate::managed_agents::nest_dir() else {
321 return;
322 };
323 let dst = dev_nest.join(".repos-dir");
324 // Skip if the dev nest already has its own .repos-dir.
325 if dst.exists() {
326 return;
327 }
328 // Ensure the dev nest directory itself exists — this migration runs before
329 // ensure_nest() in the boot sequence, so the directory may not yet exist.
330 if let Err(e) = std::fs::create_dir_all(&dev_nest) {
331 eprintln!(
332 "buzz-desktop: dev-nest-migration: failed to create dev nest {}: {e}",
333 dev_nest.display()
334 );
335 return;
336 }
337 match std::fs::copy(&src, &dst) {
338 Ok(_) => eprintln!(
339 "buzz-desktop: dev-nest-migration: migrated .repos-dir to {}",
340 dst.display()
341 ),
342 Err(e) => eprintln!("buzz-desktop: dev-nest-migration: failed to migrate .repos-dir: {e}"),
343 }
344}
345
346/// One-time migration of dev-build nest contents from `~/.buzz` → `~/.buzz-dev`.
347///

Callers 1

run_boot_migrationsFunction · 0.85

Calls 2

home_dirFunction · 0.85
nest_dirFunction · 0.85

Tested by

no test coverage detected