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

Method print_no_pending_changes

atomic-cli/src/commands/diff/helpers.rs:116–142  ·  view source on GitHub ↗

Explain that the working copy matches the view, and point at the change records that *are* inspectable. `atomic diff` with no `-c` compares disk against the view's recorded state. A clean working copy is a perfectly valid answer, but it is a dead end for someone who typed `atomic diff` expecting to see a change. Naming a real, copy-pasteable `-c` command for the most recent changes on this view t

(&self, repo: &Repository, view: &str)

Source from the content-addressed store, hash-verified

114 /// change. Naming a real, copy-pasteable `-c` command for the most
115 /// recent changes on this view turns the dead end into a next step.
116 pub(crate) fn print_no_pending_changes(&self, repo: &Repository, view: &str) {
117 if self.json {
118 let _ = json::print_json(&json::JsonDiff::empty(Some(view)));
119 return;
120 }
121
122 print_info("No changes detected");
123 println!();
124
125 let recent = self.recent_view_changes(repo, view, RECENT_CHANGE_SUGGESTIONS);
126
127 if recent.is_empty() {
128 print_hint(&format!(
129 "Working copy matches view `{view}`, which has no recorded changes yet."
130 ));
131 print_hint("Record the working copy with `atomic record -m \"<message>\"`.");
132 return;
133 }
134
135 print_hint(&format!(
136 "Working copy matches view `{view}`. To inspect a recorded change:"
137 ));
138 for (short_hash, message) in &recent {
139 print_hint(&format!(" atomic diff -c {short_hash} {message}"));
140 }
141 print_hint(" atomic log — list the changes on this view");
142 }
143
144 /// Collect up to `limit` recent changes on `view`, newest first, as
145 /// `(short_hash, message)` pairs for the no-pending-changes hint.

Callers 2

diffFunction · 0.80
runMethod · 0.80

Calls 5

print_infoFunction · 0.85
print_hintFunction · 0.85
recent_view_changesMethod · 0.80
print_jsonFunction · 0.70
is_emptyMethod · 0.45

Tested by

no test coverage detected