#19 change request open
This commit is contained in:
@@ -265,7 +265,7 @@ func Execute(ctx context.Context, log logger.Logger, gitSource source.SourceCont
|
||||
case "checkupdate":
|
||||
js, err := json.Marshal(mvs)
|
||||
fmt.Println(fmt.Sprintf(`Modules get update: %s, %s`, js, err))
|
||||
case "update":
|
||||
case "open":
|
||||
if cliCfg.Path != "" { // update one dep
|
||||
path = cliCfg.Path
|
||||
if mod, ok = mvs[path]; !ok {
|
||||
@@ -294,6 +294,35 @@ func Execute(ctx context.Context, log logger.Logger, gitSource source.SourceCont
|
||||
log.Debug(ctx, fmt.Sprintf("Update successful for %s", path))
|
||||
}
|
||||
}
|
||||
case "update":
|
||||
if cliCfg.Path != "" { // update one dep
|
||||
path = cliCfg.Path
|
||||
if mod, ok = mvs[path]; !ok {
|
||||
log.Fatal(ctx, fmt.Sprintf("For %s update not exist", path))
|
||||
}
|
||||
log.Debug(ctx, fmt.Sprintf("Start update %s from %s to %s", path, mod.Module.Version, mod.Version))
|
||||
for _, branch := range cfg.Branches {
|
||||
if err := gitSource.RequestUpdate(ctx, branch, path, mod); err != nil {
|
||||
log.Fatal(ctx, fmt.Sprintf("failed to create pr: %v", err))
|
||||
}
|
||||
}
|
||||
log.Debug(ctx, fmt.Sprintf("Update successful for %s", path))
|
||||
return
|
||||
}
|
||||
for _, branch := range cfg.Branches { // update all dep
|
||||
for path, mod = range mvs {
|
||||
log.Debug(ctx, fmt.Sprintf("Start update %s from %s to %s", path, mod.Module.Version, mod.Version))
|
||||
err := gitSource.RequestUpdate(ctx, branch, path, mod)
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "already exists") {
|
||||
log.Debug(ctx, fmt.Sprintf("skip %s, branch already exists", path))
|
||||
continue
|
||||
}
|
||||
log.Fatal(ctx, fmt.Sprintf("failed to create pr: %v", err))
|
||||
}
|
||||
log.Debug(ctx, fmt.Sprintf("Update successful for %s", path))
|
||||
}
|
||||
}
|
||||
case "close":
|
||||
if cliCfg.Path != "" { // close one dep
|
||||
path = cliCfg.Path
|
||||
|
Reference in New Issue
Block a user