Fetch user if no --owner is given

Signed-off-by: Jonas Franz <info@jonasfranz.software>
pull/17/head
Jonas Franz 6 years ago
parent 509abf5a7f
commit 34686a649b
Signed by: JonasFranzDEV
GPG Key ID: 506AEEBE80BEDECD
  1. 9
      cmd/migrate-all.go
  2. 9
      cmd/migrate.go
  3. 2
      migrations/migratory.go
  4. 2
      migrations/repo.go

@ -30,7 +30,14 @@ func runMigrateAll(ctx *cli.Context) error {
m := &migrations.Migratory{
Client: gitea.NewClient(ctx.String("url"), ctx.String("token")),
Private: ctx.Bool("private"),
NewOwnerID: ctx.Int("owner"),
NewOwnerID: ctx.Int64("owner"),
}
if m.NewOwnerID == 0 {
usr, err := m.Client.GetMyUserInfo()
if err != nil {
return fmt.Errorf("cannot fetch user info about current user: %v", err)
}
m.NewOwnerID = usr.ID
}
c := context.Background()

@ -31,7 +31,14 @@ func runMigrate(ctx *cli.Context) error {
m := &migrations.Migratory{
Client: gitea.NewClient(ctx.String("url"), ctx.String("token")),
Private: ctx.Bool("private"),
NewOwnerID: ctx.Int("owner"),
NewOwnerID: ctx.Int64("owner"),
}
if m.NewOwnerID == 0 {
usr, err := m.Client.GetMyUserInfo()
if err != nil {
return fmt.Errorf("cannot fetch user info about current user: %v", err)
}
m.NewOwnerID = usr.ID
}
c := context.Background()
var gc *github.Client

@ -9,7 +9,7 @@ type Migratory struct {
AuthPassword string
Private bool
NewOwnerID int
NewOwnerID int64
repository *gitea.Repository
// key: github milestone id | value: gitea milestone id

@ -14,7 +14,7 @@ func (m *Migratory) Repository(gr *github.Repository) (*gitea.Repository, error)
AuthUsername: m.AuthUsername,
CloneAddr: gr.GetCloneURL(),
RepoName: gr.GetName(),
UID: m.NewOwnerID,
UID: int(m.NewOwnerID),
Private: m.Private,
})
return m.repository, err

Loading…
Cancel
Save