summaryrefslogtreecommitdiff
path: root/vrsite/jj.go
diff options
context:
space:
mode:
Diffstat (limited to 'vrsite/jj.go')
-rw-r--r--vrsite/jj.go18
1 files changed, 18 insertions, 0 deletions
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 {