From 8ec4e135e318c7799b2576a8729493c063da4a97 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 30 Jul 2026 17:05:12 -0300 Subject: --- vrsite/jj.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'vrsite/jj.go') diff --git a/vrsite/jj.go b/vrsite/jj.go index 55f4795..bb95d83 100644 --- a/vrsite/jj.go +++ b/vrsite/jj.go @@ -89,6 +89,24 @@ func resolveChange(repo, rev string) (string, error) { return id, nil } +// changeBrief resolves a revset to the one change it names, with everything a +// page says about it. One call answers both "which change" and "which commit +// is under it right now" — the second is what content is cached against, since +// a change id is a pointer and the commit beneath it is rewritten on every +// edit. +func changeBrief(repo, rev string) (Row, error) { + rows, err := LogRows(repo, rev, "", 1) + if err != nil { + return Row{}, err + } + for _, r := range rows { + if !r.Blank() { + return r, nil + } + } + return Row{}, fmt.Errorf("revset %q matches no change", rev) +} + func fileList(repo, rev string) ([]string, error) { out, err := jjRun(repo, "file", "list", "-r", rev) if err != nil { -- cgit v1.3