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

Method reverse_log

atomic-repository/src/repository/history.rs:99–135  ·  view source on GitHub ↗

Get a reverse history log (most recent first). # Arguments `options` - Options controlling the history query # Returns A vector of history entries in reverse order.

(
        &self,
        options: HistoryOptions,
    )

Source from the content-addressed store, hash-verified

97 ///
98 /// A vector of history entries in reverse order.
99 pub fn reverse_log(
100 &self,
101 options: HistoryOptions,
102 ) -> Result<Vec<crate::history::HistoryEntry>, RepositoryError> {
103 let txn = self
104 .pristine
105 .read_txn()
106 .map_err(|e| RepositoryError::Database(e.to_string()))?;
107
108 let view_name = options.view.as_deref().unwrap_or(&self.current_view);
109 let view = txn
110 .get_view(view_name)
111 .map_err(|e| RepositoryError::Database(e.to_string()))?
112 .ok_or_else(|| RepositoryError::ViewNotFound {
113 name: view_name.to_string(),
114 })?;
115
116 let mut entries = crate::history::reverse_log(&txn, &view, &options)
117 .map_err(|e| RepositoryError::Database(e.to_string()))?;
118
119 // For draft views, filter out inherited entries
120 if view.kind.is_draft() && !options.include_inherited {
121 let ancestor_ids = Self::collect_ancestor_change_ids(&txn, &view)?;
122 entries.retain(|e| !ancestor_ids.contains(&e.node_id));
123 }
124
125 // Load headers if requested
126 if options.load_headers {
127 for entry in &mut entries {
128 if let Ok(change) = self.load_change(&entry.hash) {
129 entry.header = Some(change.hashed.header.clone());
130 }
131 }
132 }
133
134 Ok(entries)
135 }
136
137 /// Collect all change NodeIds from ancestor views' VIEW_CHANGES.
138 ///

Callers 2

runMethod · 0.80

Calls 7

reverse_logFunction · 0.85
read_txnMethod · 0.80
is_draftMethod · 0.80
get_viewMethod · 0.45
containsMethod · 0.45
load_changeMethod · 0.45
cloneMethod · 0.45

Tested by 1