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

Method new

atomic-repository/src/repository/synthesis.rs:78–101  ·  view source on GitHub ↗

Construct and validate a merge-resolution origin with the given frontier. The frontier must be non-empty and canonically ordered.

(
        merge_commit: GitObjectId,
        parents: Vec<GitObjectId>,
        frontier: CausalFrontier,
    )

Source from the content-addressed store, hash-verified

76 /// Construct and validate a merge-resolution origin with the given
77 /// frontier. The frontier must be non-empty and canonically ordered.
78 pub fn new(
79 merge_commit: GitObjectId,
80 parents: Vec<GitObjectId>,
81 frontier: CausalFrontier,
82 ) -> Result<Self, RepositoryError> {
83 if frontier.is_empty() {
84 return Err(RepositoryError::InvalidOperation {
85 message: "a Git resolution requires a non-empty causal frontier".to_string(),
86 });
87 }
88 let origin = Self {
89 merge_commit,
90 parents,
91 frontier,
92 };
93 // Reuse the hashed classification contract so an origin that would
94 // fail change validation is refused before any bytes are written.
95 origin
96 .validated()
97 .map_err(|error| RepositoryError::InvalidOperation {
98 message: format!("invalid Git resolution origin: {error}"),
99 })?;
100 Ok(origin)
101 }
102
103 /// Validate the origin against the hashed classification contract.
104 pub fn validated(&self) -> Result<ChangeOrigin, RepositoryError> {

Callers

nothing calls this directly

Calls 2

validatedMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected