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)
| 174 | /// Returns `CliError::ChangeNotFound` if the change doesn't exist, |
| 175 | /// or `CliError::Internal` if serialization fails. |
| 176 | pub fn load_change_data(repo: &Repository, hash: &Hash) -> CliResult<Bytes> { |
| 177 | // Load the change |
| 178 | let change = repo |
| 179 | .load_change(hash) |
| 180 | .map_err(|_| CliError::ChangeNotFound { |
| 181 | hash: hash.to_base32(), |
| 182 | })?; |
| 183 | |
| 184 | // Serialize to bytes |
| 185 | let mut buffer = Vec::new(); |
| 186 | change |
| 187 | .serialize(&mut buffer) |
| 188 | .map_err(|e| CliError::Internal(anyhow::anyhow!("Failed to serialize change: {}", e)))?; |
| 189 | |
| 190 | Ok(Bytes::from(buffer)) |
| 191 | } |
| 192 | |
| 193 | /// Get the on-disk path of a change file for direct file-based push. |
| 194 | /// |
no test coverage detected