From 8a18dfd03f2ce606abc08edc9689200993483d86 Mon Sep 17 00:00:00 2001 From: Seongmin Lee Date: Sat, 2 May 2026 15:17:06 +0900 Subject: [PATCH] lexicons: `git.{compareRevs,formatPatch,interdiffRevs}` to replace `repo.compare` xrpc method Signed-off-by: Seongmin Lee --- api/tangled/tempcompareRevs.go | 44 ++++++++++++++++ api/tangled/tempformatPatch.go | 48 ++++++++++++++++++ api/tangled/tempinterdiffRevs.go | 41 +++++++++++++++ lexicons/git/temp/compareRevs.json | 70 ++++++++++++++++++++++++++ lexicons/git/temp/formatPatch.json | 75 ++++++++++++++++++++++++++++ lexicons/git/temp/interdiffRevs.json | 60 ++++++++++++++++++++++ 6 files changed, 338 insertions(+) create mode 100644 api/tangled/tempcompareRevs.go create mode 100644 api/tangled/tempformatPatch.go create mode 100644 api/tangled/tempinterdiffRevs.go create mode 100644 lexicons/git/temp/compareRevs.json create mode 100644 lexicons/git/temp/formatPatch.json create mode 100644 lexicons/git/temp/interdiffRevs.json diff --git a/api/tangled/tempcompareRevs.go b/api/tangled/tempcompareRevs.go new file mode 100644 index 00000000..ad1c78ce --- /dev/null +++ b/api/tangled/tempcompareRevs.go @@ -0,0 +1,44 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.git.temp.compareRevs + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + GitTempCompareRevsNSID = "sh.tangled.git.temp.compareRevs" +) + +// GitTempCompareRevs_Output is the output of a sh.tangled.git.temp.compareRevs call. +type GitTempCompareRevs_Output struct { + // patch: format-patch output + Patch string `json:"patch" cborgen:"patch"` + // rev1: commit hash of rev1 + Rev1 *string `json:"rev1" cborgen:"rev1"` + // rev2: commit hash of rev2 + Rev2 *string `json:"rev2" cborgen:"rev2"` +} + +// GitTempCompareRevs calls the XRPC method "sh.tangled.git.temp.compareRevs". +// +// repo: AT-URI of the repository +// rev1: First revision (commit, branch, or tag) +// rev2: Second revision (commit, branch, or tag) +func GitTempCompareRevs(ctx context.Context, c util.LexClient, repo string, rev1 string, rev2 string) (*GitTempCompareRevs_Output, error) { + var out GitTempCompareRevs_Output + + params := map[string]interface{}{} + params["repo"] = repo + params["rev1"] = rev1 + params["rev2"] = rev2 + if err := c.LexDo(ctx, util.Query, "", "sh.tangled.git.temp.compareRevs", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/tangled/tempformatPatch.go b/api/tangled/tempformatPatch.go new file mode 100644 index 00000000..b5ab4174 --- /dev/null +++ b/api/tangled/tempformatPatch.go @@ -0,0 +1,48 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.git.temp.formatPatch + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + GitTempFormatPatchNSID = "sh.tangled.git.temp.formatPatch" +) + +// GitTempFormatPatch_Output is the output of a sh.tangled.git.temp.formatPatch call. +type GitTempFormatPatch_Output struct { + // patch: format-patch output + Patch string `json:"patch" cborgen:"patch"` + // rev1: commit hash of rev1 + Rev1 *string `json:"rev1" cborgen:"rev1"` + // rev2: commit hash of rev2 + Rev2 *string `json:"rev2" cborgen:"rev2"` +} + +// GitTempFormatPatch calls the XRPC method "sh.tangled.git.temp.formatPatch". +// +// repo1: AT-URI of the first repository +// repo2: AT-URI of the second repository. Inherited from repo1 when not provided +// rev1: First revision (commit, branch, or tag) +// rev2: Second revision (commit, branch, or tag) +func GitTempFormatPatch(ctx context.Context, c util.LexClient, repo1 string, repo2 string, rev1 string, rev2 string) (*GitTempFormatPatch_Output, error) { + var out GitTempFormatPatch_Output + + params := map[string]interface{}{} + params["repo1"] = repo1 + if repo2 != "" { + params["repo2"] = repo2 + } + params["rev1"] = rev1 + params["rev2"] = rev2 + if err := c.LexDo(ctx, util.Query, "", "sh.tangled.git.temp.formatPatch", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/tangled/tempinterdiffRevs.go b/api/tangled/tempinterdiffRevs.go new file mode 100644 index 00000000..08090775 --- /dev/null +++ b/api/tangled/tempinterdiffRevs.go @@ -0,0 +1,41 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.git.temp.interdiffRevs + +import ( + "bytes" + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + GitTempInterdiffRevsNSID = "sh.tangled.git.temp.interdiffRevs" +) + +// GitTempInterdiffRevs calls the XRPC method "sh.tangled.git.temp.interdiffRevs". +// +// base: Target revision (commit, branch, or tag) +// rev1: Previous revision (commit, branch, or tag) +// rev2: Current revision (commit, branch, or tag) +// sourceRepo: AT-URI of the source repository. Inherited from targetRepo when not provided +// targetRepo: AT-URI of the target repository +func GitTempInterdiffRevs(ctx context.Context, c util.LexClient, base string, rev1 string, rev2 string, sourceRepo string, targetRepo string) ([]byte, error) { + buf := new(bytes.Buffer) + + params := map[string]interface{}{} + params["base"] = base + params["rev1"] = rev1 + params["rev2"] = rev2 + if sourceRepo != "" { + params["sourceRepo"] = sourceRepo + } + params["targetRepo"] = targetRepo + if err := c.LexDo(ctx, util.Query, "", "sh.tangled.git.temp.interdiffRevs", params, nil, buf); err != nil { + return nil, err + } + + return buf.Bytes(), nil +} diff --git a/lexicons/git/temp/compareRevs.json b/lexicons/git/temp/compareRevs.json new file mode 100644 index 00000000..21475c72 --- /dev/null +++ b/lexicons/git/temp/compareRevs.json @@ -0,0 +1,70 @@ +{ + "lexicon": 1, + "id": "sh.tangled.git.temp.compareRevs", + "defs": { + "main": { + "type": "query", + "parameters": { + "type": "params", + "required": ["repo", "rev1", "rev2"], + "properties": { + "repo": { + "type": "string", + "format": "at-uri", + "description": "AT-URI of the repository" + }, + "rev1": { + "type": "string", + "description": "First revision (commit, branch, or tag)" + }, + "rev2": { + "type": "string", + "description": "Second revision (commit, branch, or tag)" + } + } + }, + "output": { + "encoding": "application/json", + "description": "Combined diff between rev1 and rev2", + "schema": { + "type": "object", + "required": ["rev1", "rev2", "patch"], + "properties": { + "rev1": { + "type": "ref", + "ref": "sh.tangled.git.temp.defs#hash", + "description": "commit hash of rev1" + }, + "rev2": { + "type": "ref", + "ref": "sh.tangled.git.temp.defs#hash", + "description": "commit hash of rev2" + }, + "patch": { + "type": "string", + "description": "format-patch output" + } + } + } + }, + "errors": [ + { + "name": "RepoNotFound", + "description": "Repository not found or access denied" + }, + { + "name": "RevisionNotFound", + "description": "One or both revisions not found" + }, + { + "name": "InvalidRequest", + "description": "Invalid request parameters" + }, + { + "name": "CompareError", + "description": "Failed to compare revisions" + } + ] + } + } +} diff --git a/lexicons/git/temp/formatPatch.json b/lexicons/git/temp/formatPatch.json new file mode 100644 index 00000000..97271d4a --- /dev/null +++ b/lexicons/git/temp/formatPatch.json @@ -0,0 +1,75 @@ +{ + "lexicon": 1, + "id": "sh.tangled.git.temp.formatPatch", + "defs": { + "main": { + "type": "query", + "parameters": { + "type": "params", + "required": ["repo1", "rev1", "rev2"], + "properties": { + "repo1": { + "type": "string", + "format": "at-uri", + "description": "AT-URI of the first repository" + }, + "rev1": { + "type": "string", + "description": "First revision (commit, branch, or tag)" + }, + "repo2": { + "type": "string", + "format": "at-uri", + "description": "AT-URI of the second repository. Inherited from repo1 when not provided" + }, + "rev2": { + "type": "string", + "description": "Second revision (commit, branch, or tag)" + } + } + }, + "output": { + "encoding": "application/json", + "description": "Format-Patch output", + "schema": { + "type": "object", + "required": ["rev1", "rev2", "patch"], + "properties": { + "rev1": { + "type": "ref", + "ref": "sh.tangled.git.temp.defs#hash", + "description": "commit hash of rev1" + }, + "rev2": { + "type": "ref", + "ref": "sh.tangled.git.temp.defs#hash", + "description": "commit hash of rev2" + }, + "patch": { + "type": "string", + "description": "format-patch output" + } + } + } + }, + "errors": [ + { + "name": "RepoNotFound", + "description": "Repository not found or access denied" + }, + { + "name": "RevisionNotFound", + "description": "One or both revisions not found" + }, + { + "name": "InvalidRequest", + "description": "Invalid request parameters" + }, + { + "name": "CompareError", + "description": "Failed to compare revisions" + } + ] + } + } +} diff --git a/lexicons/git/temp/interdiffRevs.json b/lexicons/git/temp/interdiffRevs.json new file mode 100644 index 00000000..5b3be685 --- /dev/null +++ b/lexicons/git/temp/interdiffRevs.json @@ -0,0 +1,60 @@ +{ + "lexicon": 1, + "id": "sh.tangled.git.temp.interdiffRevs", + "defs": { + "main": { + "type": "query", + "parameters": { + "type": "params", + "required": ["targetRepo", "base", "rev1", "rev2"], + "properties": { + "targetRepo": { + "type": "string", + "format": "at-uri", + "description": "AT-URI of the target repository" + }, + "base": { + "type": "string", + "description": "Target revision (commit, branch, or tag)" + }, + "sourceRepo": { + "type": "string", + "format": "at-uri", + "description": "AT-URI of the source repository. Inherited from targetRepo when not provided" + }, + "rev1": { + "type": "string", + "description": "Previous revision (commit, branch, or tag)" + }, + "rev2": { + "type": "string", + "description": "Current revision (commit, branch, or tag)" + } + } + }, + "output": { + "encoding": "*/*", + "description": "Interdiff output in application/json" + }, + "errors": [ + { + "name": "RepoNotFound", + "description": "Repository not found or access denied" + }, + { + "name": "RevisionNotFound", + "description": "One or both revisions not found" + }, + { + "name": "InvalidRequest", + "description": "Invalid request parameters" + }, + { + "name": "InterDiffError", + "description": "Failed to interdiff revisions" + } + ] + } + } +} + -- 2.51.2