Skip to content

Commit a836bf7

Browse files
authored
Remove deprecated enable / disable repos feature (#555)
The API endpoints were removed in Sourcegraph 3.28
1 parent 65e7ea8 commit a836bf7

File tree

3 files changed

+28
-115
lines changed

3 files changed

+28
-115
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ All notable changes to `src-cli` are documented in this file.
1919

2020
### Removed
2121

22+
- The `src repos enable|disable` commands were removed as they are no longer supported.
23+
2224
## 3.28.3
2325

2426
### Fixed

cmd/src/repos.go

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
package main
22

33
import (
4+
"context"
45
"flag"
56
"fmt"
67
"time"
8+
9+
"github.com/sourcegraph/src-cli/internal/api"
710
)
811

912
var reposCommands commander
@@ -19,8 +22,6 @@ The commands are:
1922
2023
get gets a repository
2124
list lists repositories
22-
enable enables repositories
23-
disable disables repositories
2425
delete deletes repositories
2526
2627
Use "src repos [command] -h" for more information about a command.
@@ -88,3 +89,26 @@ type GitRef struct {
8889
Name string `json:"name"`
8990
DisplayName string `json:"displayName"`
9091
}
92+
93+
func fetchRepositoryID(ctx context.Context, client api.Client, repoName string) (string, error) {
94+
query := `query RepositoryID($repoName: String!) {
95+
repository(name: $repoName) {
96+
id
97+
}
98+
}`
99+
100+
var result struct {
101+
Repository struct {
102+
ID string
103+
}
104+
}
105+
if ok, err := client.NewRequest(query, map[string]interface{}{
106+
"repoName": repoName,
107+
}).Do(ctx, &result); err != nil || !ok {
108+
return "", err
109+
}
110+
if result.Repository.ID == "" {
111+
return "", fmt.Errorf("repository not found: %s", repoName)
112+
}
113+
return result.Repository.ID, nil
114+
}

cmd/src/repos_enable_disable.go

Lines changed: 0 additions & 113 deletions
This file was deleted.

0 commit comments

Comments
 (0)