1
0
Fork 0
mirror of https://github.com/Luzifer/github2gitea.git synced 2024-11-14 01:42:47 +00:00

Add option to disable mirroring

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2019-07-27 20:25:39 +02:00
parent 5fafc594a8
commit 4158d83636
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E
3 changed files with 4 additions and 1 deletions

View file

@ -34,6 +34,7 @@ Usage of github2gitea:
--migrate-archived Create migrations for archived repos --migrate-archived Create migrations for archived repos
--migrate-forks Create migrations for forked repos --migrate-forks Create migrations for forked repos
--migrate-private Migrate private repos (the given Github Token will be entered as sync credential!) (default true) --migrate-private Migrate private repos (the given Github Token will be entered as sync credential!) (default true)
--no-mirror Do not enable mirroring but instad do a one-time clone
--source-expression string Regular expression to match the full name of the source repo (i.e. '^Luzifer/.*$') --source-expression string Regular expression to match the full name of the source repo (i.e. '^Luzifer/.*$')
--target-user int ID of the User / Organization in Gitea to assign the repo to --target-user int ID of the User / Organization in Gitea to assign the repo to
--target-user-name string Username of the given ID (to check whether repo already exists) --target-user-name string Username of the given ID (to check whether repo already exists)
@ -52,6 +53,7 @@ You can see there is a lot of options you need to set so here is a little walk-t
| `migrate-archived` | | Set to `true` to also create migrations for archived repos | | `migrate-archived` | | Set to `true` to also create migrations for archived repos |
| `migrate-forks` | | Set to `true` to also create migrations for forked repos | | `migrate-forks` | | Set to `true` to also create migrations for forked repos |
| `migrate-private` | | Set to `false` not to create migrations for private repos | | `migrate-private` | | Set to `false` not to create migrations for private repos |
| `no-mirror` | | Set to `true` not to set up mirroring but only clone the repo |
| `source-expression` | X | Regular expression to match the *full name* of the repo: `^Luzifer/` will for example match `Luzifer/github2gitea` | | `source-expression` | X | Regular expression to match the *full name* of the repo: `^Luzifer/` will for example match `Luzifer/github2gitea` |
| `target-user` | X | ID of your Gitea user or organization (ask your instance admin to look it up in the site admin) | | `target-user` | X | ID of your Gitea user or organization (ask your instance admin to look it up in the site admin) |
| `target-user-name` | X | Name of the user the ID belongs to | | `target-user-name` | X | Name of the user the ID belongs to |

View file

@ -28,7 +28,7 @@ func createMigrationRequestFromGithubRepo(gr *github.Repository) createMigration
CloneAddr: strFromPtr(gr.CloneURL), CloneAddr: strFromPtr(gr.CloneURL),
Description: strFromPtr(gr.Description), Description: strFromPtr(gr.Description),
Issues: boolFromPtr(gr.HasIssues), Issues: boolFromPtr(gr.HasIssues),
Mirror: true, Mirror: !cfg.NoMirror,
Private: boolFromPtr(gr.Private), Private: boolFromPtr(gr.Private),
PullRequests: boolFromPtr(gr.HasIssues), PullRequests: boolFromPtr(gr.HasIssues),
RepoName: strFromPtr(gr.Name), RepoName: strFromPtr(gr.Name),

View file

@ -28,6 +28,7 @@ var (
MigrateArchived bool `flag:"migrate-archived" default:"false" description:"Create migrations for archived repos"` MigrateArchived bool `flag:"migrate-archived" default:"false" description:"Create migrations for archived repos"`
MigrateForks bool `flag:"migrate-forks" default:"false" description:"Create migrations for forked repos"` MigrateForks bool `flag:"migrate-forks" default:"false" description:"Create migrations for forked repos"`
MigratePrivate bool `flag:"migrate-private" default:"true" description:"Migrate private repos (the given Github Token will be entered as sync credential!)"` MigratePrivate bool `flag:"migrate-private" default:"true" description:"Migrate private repos (the given Github Token will be entered as sync credential!)"`
NoMirror bool `flag:"no-mirror" default:"false" description:"Do not enable mirroring but instad do a one-time clone"`
SourceExpression string `flag:"source-expression" default:"" description:"Regular expression to match the full name of the source repo (i.e. '^Luzifer/.*$')" validate:"nonzero"` SourceExpression string `flag:"source-expression" default:"" description:"Regular expression to match the full name of the source repo (i.e. '^Luzifer/.*$')" validate:"nonzero"`
TargetUser int64 `flag:"target-user" default:"0" description:"ID of the User / Organization in Gitea to assign the repo to" validate:"nonzero"` TargetUser int64 `flag:"target-user" default:"0" description:"ID of the User / Organization in Gitea to assign the repo to" validate:"nonzero"`
TargetUserName string `flag:"target-user-name" default:"" description:"Username of the given ID (to check whether repo already exists)" validate:"nonzero"` TargetUserName string `flag:"target-user-name" default:"" description:"Username of the given ID (to check whether repo already exists)" validate:"nonzero"`