mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 15:12:02 +00:00
code-search: handle changeset fork when creating a batch change via src-cli (#58156)
This commit is contained in:
parent
8f696e7db3
commit
01324538d7
@ -103,6 +103,7 @@ func (c *ChangesetSpec) MarshalJSON() ([]byte, error) {
|
||||
Body string `json:"body,omitempty"`
|
||||
Commits []GitCommitDescription `json:"commits,omitempty"`
|
||||
Published *PublishedValue `json:"published,omitempty"`
|
||||
Fork *bool `json:"fork,omitempty"`
|
||||
}{
|
||||
BaseRepository: c.BaseRepository,
|
||||
ExternalID: c.ExternalID,
|
||||
@ -113,6 +114,7 @@ func (c *ChangesetSpec) MarshalJSON() ([]byte, error) {
|
||||
Title: c.Title,
|
||||
Body: c.Body,
|
||||
Commits: c.Commits,
|
||||
Fork: c.Fork,
|
||||
}
|
||||
if !c.Published.Nil() {
|
||||
v.Published = &c.Published
|
||||
|
||||
@ -111,6 +111,26 @@ func TestParseChangesetSpec(t *testing.T) {
|
||||
}`,
|
||||
err: "2 errors occurred:\n\t* Must validate one and only one schema (oneOf)\n\t* commits: Array must have at most 1 items",
|
||||
},
|
||||
{
|
||||
name: "with fork",
|
||||
rawSpec: `{
|
||||
"baseRepository": "graphql-id",
|
||||
"baseRef": "refs/heads/master",
|
||||
"baseRev": "d34db33f",
|
||||
"headRef": "refs/heads/my-branch",
|
||||
"headRepository": "graphql-id",
|
||||
"title": "my title",
|
||||
"body": "my body",
|
||||
"published": false,
|
||||
"commits": [{
|
||||
"message": "commit message",
|
||||
"diff": "the diff",
|
||||
"authorName": "Mary McButtons",
|
||||
"authorEmail": "mary@example.com"
|
||||
}],
|
||||
"fork": true
|
||||
}`,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
|
||||
@ -60,6 +60,10 @@ const ChangesetSpecJSON = `{
|
||||
"description": "The GraphQL ID of the repository that contains the branch with this changeset's changes. Fork repositories and cross-repository changesets are not yet supported. Therefore, headRepository must be equal to baseRepository.",
|
||||
"examples": ["UmVwb3NpdG9yeTo5Cg=="]
|
||||
},
|
||||
"fork": {
|
||||
"type": "boolean",
|
||||
"description": "Whether to publish the changeset to a fork of the target repository. If omitted, the changeset will be published to a branch directly on the target repository, unless the global ` + "`" + `batches.enforceFork` + "`" + ` setting is enabled. If set, this property will override any global setting."
|
||||
},
|
||||
"headRef": {
|
||||
"type": "string",
|
||||
"description": "The full name of the Git ref that holds the changes proposed by this changeset. This ref will be created or updated with the commits.",
|
||||
|
||||
@ -55,6 +55,10 @@
|
||||
"description": "The GraphQL ID of the repository that contains the branch with this changeset's changes. Fork repositories and cross-repository changesets are not yet supported. Therefore, headRepository must be equal to baseRepository.",
|
||||
"examples": ["UmVwb3NpdG9yeTo5Cg=="]
|
||||
},
|
||||
"fork": {
|
||||
"type": "boolean",
|
||||
"description": "Whether to publish the changeset to a fork of the target repository. If omitted, the changeset will be published to a branch directly on the target repository, unless the global `batches.enforceFork` setting is enabled. If set, this property will override any global setting."
|
||||
},
|
||||
"headRef": {
|
||||
"type": "string",
|
||||
"description": "The full name of the Git ref that holds the changes proposed by this changeset. This ref will be created or updated with the commits.",
|
||||
|
||||
@ -478,6 +478,8 @@ type BranchChangesetSpec struct {
|
||||
Body string `json:"body"`
|
||||
// Commits description: The Git commits with the proposed changes. These commits are pushed to the head ref.
|
||||
Commits []*GitCommitDescription `json:"commits"`
|
||||
// Fork description: Whether to publish the changeset to a fork of the target repository. If omitted, the changeset will be published to a branch directly on the target repository, unless the global `batches.enforceFork` setting is enabled. If set, this property will override any global setting.
|
||||
Fork bool `json:"fork,omitempty"`
|
||||
// HeadRef description: The full name of the Git ref that holds the changes proposed by this changeset. This ref will be created or updated with the commits.
|
||||
HeadRef string `json:"headRef"`
|
||||
// HeadRepository description: The GraphQL ID of the repository that contains the branch with this changeset's changes. Fork repositories and cross-repository changesets are not yet supported. Therefore, headRepository must be equal to baseRepository.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user