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

Function load_change_data

atomic-cli/tests/fixtures/helpers_c6.rs:172–187  ·  view source on GitHub ↗

Load and serialize change data from the repository. Loads the change from the repository and serializes it to bytes suitable for uploading to a remote. # Arguments `repo` - The repository to load from `hash` - The hash of the change to load # Returns The serialized change data as bytes. # Errors Returns `CliError::ChangeNotFound` if the change doesn't exist, or `CliError::Internal` if seria

(repo: &Repository, hash: &Hash)

Source from the content-addressed store, hash-verified

170/// Returns `CliError::ChangeNotFound` if the change doesn't exist,
171/// or `CliError::Internal` if serialization fails.
172pub fn load_change_data(repo: &Repository, hash: &Hash) -> CliResult<Bytes> {
173 // Load the change
174 let change = repo
175 .load_change(hash)
176 .map_err(|_| CliError::ChangeNotFound {
177 hash: hash.to_base32(),
178 })?;
179
180 // Serialize to bytes
181 let mut buffer = Vec::new();
182 change
183 .serialize(&mut buffer)
184 .map_err(|e| CliError::Internal(anyhow::anyhow!("Failed to serialize change: {}", e)))?;
185
186 Ok(Bytes::from(buffer))
187}
188
189// Delta Transfer Protocol
190

Callers 1

upload_change_smartFunction · 0.70

Calls 3

load_changeMethod · 0.45
to_base32Method · 0.45
serializeMethod · 0.45

Tested by

no test coverage detected