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

Method write_marker

atomic-repository/src/repository/conflict_object.rs:473–489  ·  view source on GitHub ↗

Write one marker line in the exact format of the output layer: `MARKER ID [HASH8]` + newline (the hash part only when supplied).

(&mut self, marker: &str, id: usize, changes: Option<&[Hash]>)

Source from the content-addressed store, hash-verified

471 /// Write one marker line in the exact format of the output layer:
472 /// `MARKER ID [HASH8]` + newline (the hash part only when supplied).
473 fn write_marker(&mut self, marker: &str, id: usize, changes: Option<&[Hash]>) {
474 self.ensure_line_start();
475 self.out
476 .extend_from_slice(format!("{marker} {id}").as_bytes());
477 if let Some(hash) = changes.and_then(|c| c.first()) {
478 let hash_str = hash.to_base32();
479 let short = if hash_str.len() > 8 {
480 &hash_str[..8]
481 } else {
482 &hash_str
483 };
484 self.out.extend_from_slice(format!(" [{short}]").as_bytes());
485 }
486 self.out.push(b'\n');
487 self.line += 1;
488 self.at_line_start = true;
489 }
490
491 fn close_side(&mut self) {
492 if let Some(mut side) = self.current_side.take() {

Callers 8

begin_conflictMethod · 0.45
begin_zombie_conflictMethod · 0.45
begin_cyclic_conflictMethod · 0.45
conflict_nextMethod · 0.45
end_conflictMethod · 0.45
end_zombie_conflictMethod · 0.45
end_cyclic_conflictMethod · 0.45

Calls 5

ensure_line_startMethod · 0.45
as_bytesMethod · 0.45
to_base32Method · 0.45
lenMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected