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

Method with_file_ops

atomic-core/src/change/change.rs:176–205  ·  view source on GitHub ↗

Create a new change with semantic layer operations. # Arguments `header` - Change metadata (message, authors, timestamp) `hunks` - The graph modifications in this change `file_ops` - Semantic layer operations (Trunk → Branch → Leaf) `contents` - The content blob referenced by operations `dependencies` - Changes that must be applied before this one

(
        header: ChangeHeader,
        hunks: Vec<GraphOp<Option<Hash>>>,
        file_ops: Vec<FileOps>,
        contents: Vec<u8>,
        dependencies: Vec<Hash>,
    )

Source from the content-addressed store, hash-verified

174 /// * `contents` - The content blob referenced by operations
175 /// * `dependencies` - Changes that must be applied before this one
176 pub fn with_file_ops(
177 header: ChangeHeader,
178 hunks: Vec<GraphOp<Option<Hash>>>,
179 file_ops: Vec<FileOps>,
180 contents: Vec<u8>,
181 dependencies: Vec<Hash>,
182 ) -> Self {
183 let contents_hash = Hash::of(&contents);
184
185 Self {
186 hashed: HashedChange {
187 header,
188 kind: ChangeKind::Durable,
189 supersedes: None,
190 origin: ChangeOrigin::Native,
191 causal_frontier: CausalFrontier::empty(),
192 dependencies,
193 extra_known: Vec::new(),
194 metadata: Vec::new(),
195 span: None,
196 provenance: Vec::new(),
197 hunks,
198 file_ops,
199 contents_hash,
200 },
201 unhashed: None,
202 signature: None,
203 contents,
204 }
205 }
206
207 /// Create an empty change with just a header.
208 ///

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected