#8 GetPulls.
This commit is contained in:
parent
de2eafaac5
commit
2309bba07e
@ -147,13 +147,11 @@ func (g *Gitea) RequestOpen(ctx context.Context, branch string, path string, mod
|
|||||||
}
|
}
|
||||||
defer checkout(wtree, *baseRef)
|
defer checkout(wtree, *baseRef)
|
||||||
|
|
||||||
if len(g.pulls) == 0 {
|
|
||||||
g.pulls, err = GetPulls(ctx, g.URL, g.Owner, g.Repository, g.Password)
|
g.pulls, err = GetPulls(ctx, g.URL, g.Owner, g.Repository, g.Password)
|
||||||
if err != nil && err != ErrPRNotExist {
|
if err != nil {
|
||||||
logger.Error(ctx, fmt.Sprintf("GetPulls error: %s", err))
|
logger.Error(ctx, fmt.Sprintf("GetPulls error: %s", err))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for _, pull := range g.pulls {
|
for _, pull := range g.pulls {
|
||||||
if strings.Contains(pull.Title, path) && strings.Contains(pull.Base.Ref, branch) {
|
if strings.Contains(pull.Title, path) && strings.Contains(pull.Base.Ref, branch) {
|
||||||
@ -302,13 +300,11 @@ func (g *Gitea) RequestClose(ctx context.Context, branch string, path string) er
|
|||||||
logger.Debug(ctx, fmt.Sprintf("RequestClose start, mod title: %s", path))
|
logger.Debug(ctx, fmt.Sprintf("RequestClose start, mod title: %s", path))
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
if len(g.pulls) == 0 {
|
|
||||||
g.pulls, err = GetPulls(ctx, g.URL, g.Owner, g.Repository, g.Password)
|
g.pulls, err = GetPulls(ctx, g.URL, g.Owner, g.Repository, g.Password)
|
||||||
if err != nil && err != ErrPRNotExist {
|
if err != nil {
|
||||||
logger.Error(ctx, fmt.Sprintf("GetPulls error: %s", err))
|
logger.Error(ctx, fmt.Sprintf("GetPulls error: %s", err))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
prExist := false
|
prExist := false
|
||||||
var b string // Name of the branch to be deleted
|
var b string // Name of the branch to be deleted
|
||||||
@ -343,13 +339,11 @@ func (g *Gitea) RequestUpdate(ctx context.Context, branch string, path string, m
|
|||||||
logger.Debug(ctx, fmt.Sprintf("RequestUpdate start, mod title: %s", path))
|
logger.Debug(ctx, fmt.Sprintf("RequestUpdate start, mod title: %s", path))
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
if len(g.pulls) == 0 {
|
|
||||||
g.pulls, err = GetPulls(ctx, g.URL, g.Owner, g.Repository, g.Password)
|
g.pulls, err = GetPulls(ctx, g.URL, g.Owner, g.Repository, g.Password)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error(ctx, fmt.Sprintf("GetPulls error: %s", err))
|
logger.Error(ctx, fmt.Sprintf("GetPulls error: %s", err))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
prExist := false
|
prExist := false
|
||||||
for _, pull := range g.pulls {
|
for _, pull := range g.pulls {
|
||||||
@ -387,13 +381,11 @@ func (g *Gitea) RequestList(ctx context.Context, branch string) (map[string]stri
|
|||||||
logger.Debug(ctx, fmt.Sprintf("RequestList for %s", branch))
|
logger.Debug(ctx, fmt.Sprintf("RequestList for %s", branch))
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
if len(g.pulls) == 0 {
|
|
||||||
g.pulls, err = GetPulls(ctx, g.URL, g.Owner, g.Repository, g.Password)
|
g.pulls, err = GetPulls(ctx, g.URL, g.Owner, g.Repository, g.Password)
|
||||||
if err != nil && err != ErrPRNotExist {
|
if err != nil {
|
||||||
logger.Error(ctx, fmt.Sprintf("GetPulls error: %s", err))
|
logger.Error(ctx, fmt.Sprintf("GetPulls error: %s", err))
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var path string
|
var path string
|
||||||
rMap := make(map[string]string)
|
rMap := make(map[string]string)
|
||||||
|
@ -140,13 +140,11 @@ func (g *Github) RequestOpen(ctx context.Context, branch string, path string, mo
|
|||||||
logger.Fatal(ctx, fmt.Sprintf("failed to get worktree: %v", err))
|
logger.Fatal(ctx, fmt.Sprintf("failed to get worktree: %v", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(g.pulls) == 0 {
|
|
||||||
g.pulls, err = GetPulls(ctx, g.URL, g.Owner, g.Repository, g.Password)
|
g.pulls, err = GetPulls(ctx, g.URL, g.Owner, g.Repository, g.Password)
|
||||||
if err != nil && err != ErrPRNotExist {
|
if err != nil {
|
||||||
logger.Error(ctx, fmt.Sprintf("GetPulls error: %s", err))
|
logger.Error(ctx, fmt.Sprintf("GetPulls error: %s", err))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for _, pull := range g.pulls {
|
for _, pull := range g.pulls {
|
||||||
if strings.Contains(pull.Title, path) && strings.Contains(pull.Base.Ref, branch) {
|
if strings.Contains(pull.Title, path) && strings.Contains(pull.Base.Ref, branch) {
|
||||||
@ -300,13 +298,11 @@ func (g *Github) RequestList(ctx context.Context, branch string) (map[string]str
|
|||||||
logger.Debug(ctx, fmt.Sprintf("RequestList for %s", branch))
|
logger.Debug(ctx, fmt.Sprintf("RequestList for %s", branch))
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
if len(g.pulls) == 0 {
|
|
||||||
g.pulls, err = GetPulls(ctx, g.URL, g.Owner, g.Repository, g.Password)
|
g.pulls, err = GetPulls(ctx, g.URL, g.Owner, g.Repository, g.Password)
|
||||||
if err != nil && err != ErrPRNotExist {
|
if err != nil {
|
||||||
logger.Error(ctx, fmt.Sprintf("GetPulls error: %s", err))
|
logger.Error(ctx, fmt.Sprintf("GetPulls error: %s", err))
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var path string
|
var path string
|
||||||
rMap := make(map[string]string)
|
rMap := make(map[string]string)
|
||||||
|
@ -144,13 +144,11 @@ func (g *Gitlab) RequestOpen(ctx context.Context, branch string, path string, mo
|
|||||||
}
|
}
|
||||||
defer checkout(wtree, *baseRef)
|
defer checkout(wtree, *baseRef)
|
||||||
|
|
||||||
if len(g.pulls) == 0 {
|
g.pulls, err = GetPulls(ctx, g.URL, g.Owner, g.Repository, g.Password)
|
||||||
g.pulls, err = GetPulls(ctx, g.URL, g.RepositoryId, branch, g.Password)
|
if err != nil {
|
||||||
if err != nil && err != ErrPRNotExist {
|
|
||||||
logger.Error(ctx, fmt.Sprintf("GetPulls error: %s", err))
|
logger.Error(ctx, fmt.Sprintf("GetPulls error: %s", err))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for _, pull := range g.pulls {
|
for _, pull := range g.pulls {
|
||||||
if strings.Contains(pull.Title, path) {
|
if strings.Contains(pull.Title, path) {
|
||||||
@ -297,13 +295,11 @@ func (g *Gitlab) RequestClose(ctx context.Context, branch string, path string) e
|
|||||||
logger.Debug(ctx, fmt.Sprintf("RequestClose start, mod title: %s", path))
|
logger.Debug(ctx, fmt.Sprintf("RequestClose start, mod title: %s", path))
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
if len(g.pulls) == 0 {
|
g.pulls, err = GetPulls(ctx, g.URL, g.Owner, g.Repository, g.Password)
|
||||||
g.pulls, err = GetPulls(ctx, g.URL, g.RepositoryId, branch, g.Password)
|
if err != nil {
|
||||||
if err != nil && err != ErrPRNotExist {
|
|
||||||
logger.Error(ctx, fmt.Sprintf("GetPulls error: %s", err))
|
logger.Error(ctx, fmt.Sprintf("GetPulls error: %s", err))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
prExist := false
|
prExist := false
|
||||||
var b string // Name of the branch to be deleted
|
var b string // Name of the branch to be deleted
|
||||||
@ -338,13 +334,11 @@ func (g *Gitlab) RequestUpdate(ctx context.Context, branch string, path string,
|
|||||||
logger.Debug(ctx, fmt.Sprintf("RequestUpdate start, mod title: %s", path))
|
logger.Debug(ctx, fmt.Sprintf("RequestUpdate start, mod title: %s", path))
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
if len(g.pulls) == 0 {
|
g.pulls, err = GetPulls(ctx, g.URL, g.Owner, g.Repository, g.Password)
|
||||||
g.pulls, err = GetPulls(ctx, g.URL, g.RepositoryId, branch, g.Password)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error(ctx, fmt.Sprintf("GetPulls error: %s", err))
|
logger.Error(ctx, fmt.Sprintf("GetPulls error: %s", err))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
prExist := false
|
prExist := false
|
||||||
for _, pull := range g.pulls {
|
for _, pull := range g.pulls {
|
||||||
@ -382,13 +376,11 @@ func (g *Gitlab) RequestList(ctx context.Context, branch string) (map[string]str
|
|||||||
logger.Debug(ctx, fmt.Sprintf("RequestList for %s", branch))
|
logger.Debug(ctx, fmt.Sprintf("RequestList for %s", branch))
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
if len(g.pulls) == 0 {
|
g.pulls, err = GetPulls(ctx, g.URL, g.Owner, g.Repository, g.Password)
|
||||||
g.pulls, err = GetPulls(ctx, g.URL, g.RepositoryId, branch, g.Password)
|
if err != nil {
|
||||||
if err != nil && err != ErrPRNotExist {
|
|
||||||
logger.Error(ctx, fmt.Sprintf("GetPulls error: %s", err))
|
logger.Error(ctx, fmt.Sprintf("GetPulls error: %s", err))
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var path string
|
var path string
|
||||||
rMap := make(map[string]string)
|
rMap := make(map[string]string)
|
||||||
|
Loading…
Reference in New Issue
Block a user