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

Method resolve

atomic-cli/src/commands/revise.rs:132–153  ·  view source on GitHub ↗

Resolve this reference to a sequence number. Returns the 0-indexed sequence number in the view.

(&self, change_count: u64)

Source from the content-addressed store, hash-verified

130 ///
131 /// Returns the 0-indexed sequence number in the view.
132 pub fn resolve(&self, change_count: u64) -> Result<u64, String> {
133 if change_count == 0 {
134 return Err("View is empty".to_string());
135 }
136
137 match self {
138 Self::Last => Ok(change_count - 1),
139 Self::Relative(n) => {
140 if *n >= change_count {
141 return Err(format!(
142 "Reference @~{} is out of range (view has {} changes)",
143 n, change_count
144 ));
145 }
146 Ok(change_count - 1 - n)
147 }
148 Self::Hash(_) => {
149 // Hash resolution requires repository access, handled separately
150 Err("Hash references must be resolved through the repository".to_string())
151 }
152 }
153 }
154
155 /// Get a human-readable description of this reference.
156 pub fn description(&self) -> String {

Callers 1

resolve_referenceMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected