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:180–200  ·  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

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