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

Function change_of

atomic-cli/tests/it/git_import_cb9c_test.rs:154–173  ·  view source on GitHub ↗
(
    repo: &atomic_repository::Repository,
    view: &str,
    git_sha: &str,
)

Source from the content-addressed store, hash-verified

152}
153
154fn change_of(
155 repo: &atomic_repository::Repository,
156 view: &str,
157 git_sha: &str,
158) -> atomic_core::change::Change {
159 let entries = repo.effective_history(Some(view)).unwrap();
160 for entry in entries {
161 let change = repo.load_change(&entry.hash).unwrap();
162 let sha = change
163 .unhashed
164 .as_ref()
165 .and_then(|value| value.get("git"))
166 .and_then(|git| git.get("sha"))
167 .and_then(|sha| sha.as_str());
168 if sha == Some(git_sha) {
169 return change;
170 }
171 }
172 panic!("no imported change for git commit {git_sha}")
173}
174
175fn projected(
176 repo: &atomic_repository::Repository,

Calls 6

effective_historyMethod · 0.80
as_refMethod · 0.80
getMethod · 0.65
unwrapMethod · 0.45
load_changeMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected