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

Method write_marker

atomic-core/src/output/repo/writer.rs:298–325  ·  view source on GitHub ↗

Write a conflict marker line. The format is: `MARKER ID [HASH]` followed by a newline.

(&mut self, marker: &str, id: u32, hash: Option<&Hash>)

Source from the content-addressed store, hash-verified

296 ///
297 /// The format is: `MARKER ID [HASH]` followed by a newline.
298 fn write_marker(&mut self, marker: &str, id: u32, hash: Option<&Hash>) -> std::io::Result<()> {
299 self.ensure_line_start()?;
300
301 // Write marker and ID
302 write!(self.writer, "{} {}", marker, id)?;
303 self.bytes_written += marker.len() as u64 + 1 + count_digits(id) as u64;
304
305 // Write hash if provided
306 if let Some(h) = hash {
307 let hash_str = h.to_base32();
308 // Only include first 8 chars of hash for readability
309 let short_hash = if hash_str.len() > 8 {
310 &hash_str[..8]
311 } else {
312 &hash_str
313 };
314 write!(self.writer, " [{}]", short_hash)?;
315 self.bytes_written += 3 + short_hash.len() as u64; // " [" + hash + "]"
316 }
317
318 // Write newline
319 self.writer.write_all(b"\n")?;
320 self.bytes_written += 1;
321 self.line += 1;
322 self.at_line_start = true;
323
324 Ok(())
325 }
326
327 /// Record a conflict with the given type.
328 fn record_conflict(&mut self, conflict_type: FileConflictType, id: u32, hash: Option<&Hash>) {

Callers 8

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

Calls 4

count_digitsFunction · 0.85
ensure_line_startMethod · 0.80
lenMethod · 0.45
to_base32Method · 0.45

Tested by

no test coverage detected