Gitea remote support

This commit is contained in:
Ryan McGuire 2024-01-16 14:32:12 -05:00
parent 94bbff6d07
commit 9747261a76
2 changed files with 12 additions and 4 deletions

View File

@ -57,6 +57,11 @@ cache:
```
## TODO
- [ ] Make generic, this is any git remote, not just GitLab
- [ ] Add Gitea support
- [ ] Add GitHub support
- [ ] Rename --gitlab flag to --remote
- [ ] Add option to select individual remote for `gpm cache load`
- [x] Use multi-gitlab by default in config init
- [x] Update docs for multi-gitlab
- [x] Remove all references to old keys

View File

@ -14,6 +14,7 @@ const giteaReposPerPage = 20
func (r *GiteaRemote) GetNumProjects(opts *remote.RemoteQueryOpts) int {
var projects int
_, resp, err := r.api.SearchRepos(gitea.SearchRepoOptions{ListOptions: gitea.ListOptions{PageSize: 1}})
if err != nil {
fmt.Println(err)
@ -30,7 +31,6 @@ func (r *GiteaRemote) StreamProjects(pi *load.ProgressInfo, opts *remote.RemoteQ
// Get projects. TODO support concurrency
giteaListOpts := gitea.ListOptions{Page: 1, PageSize: giteaReposPerPage}
for {
repos, resp, err := r.api.ListMyRepos(gitea.ListReposOptions{ListOptions: giteaListOpts})
@ -39,15 +39,18 @@ func (r *GiteaRemote) StreamProjects(pi *load.ProgressInfo, opts *remote.RemoteQ
if err != nil {
pi.ErrorChan <- err
break
} else if resp.NextPage == resp.PrevPage {
break
} else if len(repos) < 1 {
pi.ErrorChan <- errors.New("No gitea repos found")
break
}
// TODO finish implementing project load support
for _, repo := range repos {
fmt.Println(repo)
fmt.Printf("Repo: %#v\n", repo)
}
if resp.LastPage == resp.NextPage {
break
}
giteaListOpts.Page = resp.NextPage