Skip to content

Commit

Permalink
feat: ✨ gitea platform added
Browse files Browse the repository at this point in the history
This piggybacks on forgejo setup itself as mentioned in #14
  • Loading branch information
AkashRajpurohit committed Feb 2, 2025
1 parent 3f59727 commit 9207f8b
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Recently I have seen many developers [getting their GitHub account banned](https
- **Concurrency:** Sync multiple repositories concurrently to reduce the time required for backup.
- **Configuration File:** Easily manage your settings through a YAML configuration file.
- **Custom Backup Directory:** Specify the directory where you want to store your repositories.
- **Multi Platform:** Currently this project supports backing up repositories from all major Git hosting services like GitHub, GitLab, Bitbucket, and Forgejo.
- **Multi Platform:** Currently this project supports backing up repositories from all major Git hosting services like GitHub, GitLab, Bitbucket, Gitea and Forgejo.

## 🚀 Getting Started

Expand Down
3 changes: 2 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ var rootCmd = &cobra.Command{
platformClient = gitlab.NewGitlabClient(cfg.Server, cfg.Tokens)
case "bitbucket":
platformClient = bitbucket.NewBitbucketClient(cfg.Username, cfg.Tokens)
case "forgejo":
case "forgejo", "gitea":
// Forgejo and Gitea have same API, so we can use the same client
platformClient = forgejo.NewForgejoClient(cfg.Server, cfg.Tokens)
default:
if !hasRawURLs {
Expand Down
2 changes: 1 addition & 1 deletion pkg/bitbucket/bitbucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (c *BitbucketClient) Sync(cfg config.Config) error {
return err
}

gitSync.LogRepoCount(len(repos), "Bitbucket")
gitSync.LogRepoCount(len(repos), cfg.Platform)

gitSync.SyncReposWithConcurrency(cfg, repos, func(repo *bb.Repository) {
gitSync.CloneOrUpdateRepo(cfg.Workspace, repo.Name, cfg)
Expand Down
2 changes: 1 addition & 1 deletion pkg/forgejo/forgejo.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (c *ForgejoClient) Sync(cfg config.Config) error {
return err
}

gitSync.LogRepoCount(len(repos), "Forgejo")
gitSync.LogRepoCount(len(repos), cfg.Platform)

gitSync.SyncReposWithConcurrency(cfg, repos, func(repo *fg.Repository) {
gitSync.CloneOrUpdateRepo(repo.Owner.UserName, repo.Name, cfg)
Expand Down
2 changes: 1 addition & 1 deletion pkg/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (c *GitHubClient) Sync(cfg config.Config) error {
return err
}

gitSync.LogRepoCount(len(repos), "GitHub")
gitSync.LogRepoCount(len(repos), cfg.Platform)

gitSync.SyncReposWithConcurrency(cfg, repos, func(repo *gh.Repository) {
gitSync.CloneOrUpdateRepo(repo.GetOwner().GetLogin(), repo.GetName(), cfg)
Expand Down
2 changes: 1 addition & 1 deletion pkg/gitlab/gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (c *GitlabClient) Sync(cfg config.Config) error {
return err
}

gitSync.LogRepoCount(len(projects), "GitLab")
gitSync.LogRepoCount(len(projects), cfg.Platform)

gitSync.SyncReposWithConcurrency(cfg, projects, func(project *gl.Project) {
gitSync.CloneOrUpdateRepo(project.Namespace.FullPath, project.Path, cfg)
Expand Down

0 comments on commit 9207f8b

Please sign in to comment.