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:204–224  ·  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

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