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

Method find_sequence_for_hash

atomic-cli/src/commands/change/command.rs:209–229  ·  view source on GitHub ↗

Find the sequence number for a hash in the current view.

(
        &self,
        repo: &Repository,
        view_name: &str,
        hash: &Hash,
    )

Source from the content-addressed store, hash-verified

207
208 /// Find the sequence number for a hash in the current view.
209 fn find_sequence_for_hash(
210 &self,
211 repo: &Repository,
212 view_name: &str,
213 hash: &Hash,
214 ) -> CliResult<Option<u64>> {
215 let txn = repo
216 .pristine()
217 .read_txn()
218 .map_err(|e| CliError::Internal(anyhow::anyhow!("{}", e)))?;
219
220 let view = txn
221 .get_view(view_name)
222 .map_err(|e| CliError::Internal(anyhow::anyhow!("{}", e)))?
223 .ok_or_else(|| CliError::ViewNotFound {
224 name: view_name.to_string(),
225 })?;
226
227 find_change_sequence(&txn, &view, hash)
228 .map_err(|e| CliError::Internal(anyhow::anyhow!("{}", e)))
229 }
230
231 /// Resolve a hash prefix to a full hash.
232 fn resolve_hash_prefix(

Callers 2

resolve_identifierMethod · 0.80
resolve_hash_prefixMethod · 0.80

Calls 4

read_txnMethod · 0.80
pristineMethod · 0.80
find_change_sequenceFunction · 0.50
get_viewMethod · 0.45

Tested by

no test coverage detected