MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / run_cutover

Function run_cutover

atomic-cli/src/commands/git/shim.rs:815–857  ·  view source on GitHub ↗

The reachable CB-13B cutover entry point: the CLI command owns the journaled cutover executor (and its typed inverse). The explicit opt-in consent is a precondition — the cutover never flips enablement implicitly — and every readiness refusal is reported verbatim without partial enablement (hook, remote and unsupported surfaces refuse).

(rollback: bool)

Source from the content-addressed store, hash-verified

813/// implicitly — and every readiness refusal is reported verbatim without
814/// partial enablement (hook, remote and unsupported surfaces refuse).
815fn run_cutover(rollback: bool) -> CliResult<()> {
816 let root = find_repository_root()?;
817 if rollback {
818 let mut repo = Repository::open(&root).map_err(CliError::from)?;
819 let undone = repo.rollback_shim_cutover().map_err(CliError::from)?;
820 print_success(&format!(
821 "Cutover {undone} rolled back through the journal's typed inverse; \
822 the legacy shadow writer fence is lifted and newer format fences are kept."
823 ));
824 return Ok(());
825 }
826 let config = shim_config(&root)?;
827 if !config.git.shim.enabled {
828 return Err(git_error(
829 "shim cutover requires the explicit opt-in consent; run \
830 `atomic git shim enable` first (the cutover never enables implicitly)",
831 ));
832 }
833 let repo = Repository::open(&root).map_err(CliError::from)?;
834 let outcome = repo.execute_shim_cutover().map_err(CliError::from)?;
835 if outcome.resumed {
836 print_success(&format!(
837 "Resumed the interrupted cutover {}: the fence was already durable and the \
838 Verified receipt is now appended.",
839 outcome
840 .operation
841 .map(|id| id.to_string())
842 .unwrap_or_default()
843 ));
844 } else if outcome.already_fenced {
845 print_info("The repository is already cut over to the colocated shim; nothing to do.");
846 } else {
847 print_success(&format!(
848 "Cutover {} journaled and verified: the colocated shim now owns writes and \
849 the legacy shadow writer is fenced.",
850 outcome
851 .operation
852 .map(|id| id.to_string())
853 .unwrap_or_default()
854 ));
855 }
856 Ok(())
857}
858
859/// Record one change-source degradation from an explicit shim command
860/// boundary (review R1: status returns its metrics without writing; only

Callers 1

runMethod · 0.85

Calls 8

find_repository_rootFunction · 0.85
openFunction · 0.85
print_successFunction · 0.85
shim_configFunction · 0.85
print_infoFunction · 0.85
rollback_shim_cutoverMethod · 0.80
execute_shim_cutoverMethod · 0.80
git_errorFunction · 0.70

Tested by

no test coverage detected