summaryrefslogtreecommitdiffstats
path: root/routers/repo/view.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/repo/view.go')
-rw-r--r--routers/repo/view.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/routers/repo/view.go b/routers/repo/view.go
index 1967b511ca..c4e6a69220 100644
--- a/routers/repo/view.go
+++ b/routers/repo/view.go
@@ -11,6 +11,7 @@ import (
"fmt"
gotemplate "html/template"
"io/ioutil"
+ "net/url"
"path"
"strings"
@@ -31,6 +32,7 @@ const (
tplRepoHome base.TplName = "repo/home"
tplWatchers base.TplName = "repo/watchers"
tplForks base.TplName = "repo/forks"
+ tplMigrating base.TplName = "repo/migrating"
)
func renderDirectory(ctx *context.Context, treeLink string) {
@@ -356,9 +358,37 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st
}
}
+func safeURL(address string) string {
+ u, err := url.Parse(address)
+ if err != nil {
+ return address
+ }
+ u.User = nil
+ return u.String()
+}
+
// Home render repository home page
func Home(ctx *context.Context) {
if len(ctx.Repo.Units) > 0 {
+ if ctx.Repo.Repository.IsBeingCreated() {
+ task, err := models.GetMigratingTask(ctx.Repo.Repository.ID)
+ if err != nil {
+ ctx.ServerError("models.GetMigratingTask", err)
+ return
+ }
+ cfg, err := task.MigrateConfig()
+ if err != nil {
+ ctx.ServerError("task.MigrateConfig", err)
+ return
+ }
+
+ ctx.Data["Repo"] = ctx.Repo
+ ctx.Data["MigrateTask"] = task
+ ctx.Data["CloneAddr"] = safeURL(cfg.CloneAddr)
+ ctx.HTML(200, tplMigrating)
+ return
+ }
+
var firstUnit *models.Unit
for _, repoUnit := range ctx.Repo.Units {
if repoUnit.Type == models.UnitTypeCode {