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

182
183 /// Find the sequence number for a hash in the current view.
184 fn find_sequence_for_hash(
185 &self,
186 repo: &Repository,
187 view_name: &str,
188 hash: &Hash,
189 ) -> CliResult<Option<u64>> {
190 let txn = repo
191 .pristine()
192 .read_txn()
193 .map_err(|e| CliError::Internal(anyhow::anyhow!("{}", e)))?;
194
195 let view = txn
196 .get_view(view_name)
197 .map_err(|e| CliError::Internal(anyhow::anyhow!("{}", e)))?
198 .ok_or_else(|| CliError::ViewNotFound {
199 name: view_name.to_string(),
200 })?;
201
202 find_change_sequence(&txn, &view, hash)
203 .map_err(|e| CliError::Internal(anyhow::anyhow!("{}", e)))
204 }
205
206 /// Resolve a hash prefix to a full hash.
207 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