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

Method log

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

Get a forward history log for the current view. For **draft** views, only changes that are "new" on this view are returned — inherited changes from ancestor views are filtered out. Pass `--all` (via [`HistoryOptions::include_inherited`]) to see the full change log including inherited entries. Returns an iterator over history entries starting from the given sequence number and proceeding forward

(
        &self,
        options: HistoryOptions,
    )

Source from the content-addressed store, hash-verified

32 /// }
33 /// ```
34 pub fn log(
35 &self,
36 options: HistoryOptions,
37 ) -> Result<Vec<crate::history::HistoryEntry>, RepositoryError> {
38 let txn = self
39 .pristine
40 .read_txn()
41 .map_err(|e| RepositoryError::Database(e.to_string()))?;
42
43 let view_name = options.view.as_deref().unwrap_or(&self.current_view);
44 let view = txn
45 .get_view(view_name)
46 .map_err(|e| RepositoryError::Database(e.to_string()))?
47 .ok_or_else(|| RepositoryError::ViewNotFound {
48 name: view_name.to_string(),
49 })?;
50
51 // For draft views, build a set of ancestor change NodeIds so we
52 // can filter out inherited entries. This makes `atomic log` on a
53 // draft view show only "what's new" rather than the full history
54 // of every ancestor view.
55 let ancestor_ids: Option<HashSet<NodeId>> =
56 if view.kind.is_draft() && !options.include_inherited {
57 Some(Self::collect_ancestor_change_ids(&txn, &view)?)
58 } else {
59 None
60 };
61
62 let iter = crate::history::log(&txn, &view, &options)
63 .map_err(|e| RepositoryError::Database(e.to_string()))?;
64
65 // Collect entries, loading headers if requested
66 let mut entries = Vec::new();
67 for result in iter {
68 let mut entry = result.map_err(|e| RepositoryError::Database(e.to_string()))?;
69
70 // Skip inherited entries on draft views
71 if let Some(ref ids) = ancestor_ids {
72 if ids.contains(&entry.node_id) {
73 continue;
74 }
75 }
76
77 // Load header if requested
78 if options.load_headers {
79 if let Ok(change) = self.load_change(&entry.hash) {
80 entry = entry.with_change_header(change.hashed.header.clone());
81 }
82 }
83
84 entries.push(entry);
85 }
86
87 Ok(entries)
88 }
89
90 /// Get a reverse history log (most recent first).
91 ///

Callers 15

resolve_referenceMethod · 0.80
find_by_hashMethod · 0.80
display_dry_runMethod · 0.80
execute_reviseMethod · 0.80
runMethod · 0.80
get_imported_shasMethod · 0.80
run_asyncMethod · 0.80
runMethod · 0.80
print_coverageMethod · 0.80
runMethod · 0.80
run_asyncMethod · 0.80
logFunction · 0.80

Calls 9

read_txnMethod · 0.80
is_draftMethod · 0.80
with_change_headerMethod · 0.80
logFunction · 0.50
get_viewMethod · 0.45
containsMethod · 0.45
load_changeMethod · 0.45
cloneMethod · 0.45
pushMethod · 0.45