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

Function change_of

atomic-cli/tests/it/git_import_cb9b_test.rs:1084–1103  ·  view source on GitHub ↗

Find an imported change by Git sha in `view`.

(
    repo: &atomic_repository::Repository,
    view: &str,
    sha: &str,
)

Source from the content-addressed store, hash-verified

1082
1083/// Find an imported change by Git sha in `view`.
1084fn change_of(
1085 repo: &atomic_repository::Repository,
1086 view: &str,
1087 sha: &str,
1088) -> atomic_core::change::Change {
1089 let entries = repo.effective_history(Some(view)).unwrap();
1090 for entry in entries {
1091 let change = repo.load_change(&entry.hash).unwrap();
1092 let imported = change
1093 .unhashed
1094 .as_ref()
1095 .and_then(|v| v.get("git"))
1096 .and_then(|g| g.get("sha"))
1097 .and_then(|s| s.as_str());
1098 if imported == Some(sha) {
1099 return change;
1100 }
1101 }
1102 panic!("no imported change for git commit {sha}")
1103}
1104
1105/// Two-branch merge fixture with controllable leg commit times so both
1106/// valid sibling orders can be exercised (review blocker 1).

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