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

Function status

atomic-cli/src/commands/rpc.rs:243–291  ·  view source on GitHub ↗
(args: &super::status::Status)

Source from the content-addressed store, hash-verified

241}
242
243pub fn status(args: &super::status::Status) -> CliResult<bool> {
244 if args.debug_ignore || args.no_reconcile || args.git {
245 return Ok(false);
246 }
247 if !super::workspace_txn::prepare_service_query(true)? {
248 return Ok(false);
249 }
250 let Some(session) = Service::open()? else {
251 return Ok(false);
252 };
253 // `--reindex` rebuilds the working-copy index through the wire's
254 // repair action, then falls through to the status read — the same
255 // compose the local body performs. The line renders from the wire's
256 // reindexed count with a client-side clock, byte-for-byte with the
257 // local reindex report.
258 if args.reindex {
259 let start = std::time::Instant::now();
260 let repair = session.repair(pb::RepairRequest {
261 repository: Some(session.reference.clone()),
262 meta: None,
263 action: pb::RepairAction::ReindexWorkingCopy as i32,
264 force: false,
265 view: String::new(),
266 });
267 match repair {
268 Ok(response) => {
269 if !args.json {
270 print_info(&format!(
271 "Reindexed {} files in {:.1}s",
272 response.reindexed,
273 start.elapsed().as_secs_f64()
274 ));
275 }
276 }
277 Err(error) if args.json => return Err(error),
278 Err(error) => {
279 print_warning(&format!("Reindex failed: {error}"));
280 }
281 }
282 }
283 let request = pb::StatusRequest {
284 repository: Some(session.reference.clone()),
285 options: Some(status_options_proto(&args.get_status_options())),
286 };
287 let response = session.status(request)?;
288
289 args.render_service_status(response)?;
290 Ok(true)
291}
292
293// ---------------------------------------------------------------------------
294// log

Callers 1

runMethod · 0.70

Calls 10

prepare_service_queryFunction · 0.85
openFunction · 0.85
print_infoFunction · 0.85
print_warningFunction · 0.85
status_options_protoFunction · 0.85
get_status_optionsMethod · 0.80
render_service_statusMethod · 0.80
repairMethod · 0.45
cloneMethod · 0.45
statusMethod · 0.45

Tested by

no test coverage detected