|
|
|
@ -7,6 +7,7 @@ package cmd |
|
|
|
|
import ( |
|
|
|
|
"errors" |
|
|
|
|
"net/http" |
|
|
|
|
"strings" |
|
|
|
|
|
|
|
|
|
"code.gitea.io/gitea/modules/log" |
|
|
|
|
"code.gitea.io/gitea/modules/private" |
|
|
|
@ -37,10 +38,10 @@ var CmdRestoreRepository = cli.Command{ |
|
|
|
|
Value: "", |
|
|
|
|
Usage: "Restore destination repository name", |
|
|
|
|
}, |
|
|
|
|
cli.StringSliceFlag{ |
|
|
|
|
cli.StringFlag{ |
|
|
|
|
Name: "units", |
|
|
|
|
Value: nil, |
|
|
|
|
Usage: `Which items will be restored, one or more units should be repeated with this flag. |
|
|
|
|
Value: "", |
|
|
|
|
Usage: `Which items will be restored, one or more units should be separated as comma. |
|
|
|
|
wiki, issues, labels, releases, release_assets, milestones, pull_requests, comments are allowed. Empty means all units.`, |
|
|
|
|
}, |
|
|
|
|
cli.BoolFlag{ |
|
|
|
@ -55,13 +56,16 @@ func runRestoreRepository(c *cli.Context) error { |
|
|
|
|
defer cancel() |
|
|
|
|
|
|
|
|
|
setting.LoadFromExisting() |
|
|
|
|
|
|
|
|
|
var units []string |
|
|
|
|
if s := c.String("units"); s != "" { |
|
|
|
|
units = strings.Split(s, ",") |
|
|
|
|
} |
|
|
|
|
statusCode, errStr := private.RestoreRepo( |
|
|
|
|
ctx, |
|
|
|
|
c.String("repo_dir"), |
|
|
|
|
c.String("owner_name"), |
|
|
|
|
c.String("repo_name"), |
|
|
|
|
c.StringSlice("units"), |
|
|
|
|
units, |
|
|
|
|
c.Bool("validation"), |
|
|
|
|
) |
|
|
|
|
if statusCode == http.StatusOK { |
|
|
|
|