Skip to content

Commit 37ac0ea

Browse files
committed
feat(doctor): show the package index revision + age in mcpp why deps
Since the refresh is lazy, "why did I get this version" often answers to "because it is the newest one your local index knows" — which is unguessable without naming the index and its age.
1 parent a947817 commit 37ac0ea

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/doctor.cppm

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import mcpp.fetcher.progress;
1919
import mcpp.home;
2020
import mcpp.platform;
2121
import mcpp.platform.process;
22+
import mcpp.pm.index_refresh; // staleness_note for `mcpp why deps`
2223
import mcpp.toolchain.detect;
2324
import mcpp.toolchain.msvc;
2425
import mcpp.toolchain.registry;
@@ -417,6 +418,14 @@ export int why_report(const std::string& topic) {
417418
}
418419
}
419420
if (all || topic == "deps") {
421+
// Which index answered, and how stale it is. Since #315 a build only
422+
// refreshes on a resolution miss, so "why did I get this version"
423+
// frequently has "because that is the newest one your local index
424+
// knows" as its answer — which is unguessable without this line.
425+
if (auto cfgW = mcpp::config::load_or_init(/*quiet=*/true)) {
426+
std::println("package index: {}",
427+
mcpp::pm::staleness_note(mcpp::config::make_xlings_env(*cfgW)));
428+
}
420429
std::println("dependencies (mcpp.lock):");
421430
std::ifstream in(ctx->projectRoot / "mcpp.lock");
422431
if (!in) {

0 commit comments

Comments
 (0)