aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-06-28 15:43:28 -0400
committerUnknown <joe2010xtmf@163.com>2014-06-28 15:43:28 -0400
commit99713e1180ad149faf6442bba311fec6e501aa00 (patch)
tree3bdcbf737babf55b47d0e4a6d69970b297920e48 /cmd
parent5dbfe3c26c3dd227e287d52134e978084d5081e3 (diff)
parent1c46d68abaf08890e10386b3af674233b4dda2d3 (diff)
downloadgitea-99713e1180ad149faf6442bba311fec6e501aa00.tar.gz
gitea-99713e1180ad149faf6442bba311fec6e501aa00.zip
Merge branch 'dev' of github.com:gogits/gogs into dev
Diffstat (limited to 'cmd')
-rw-r--r--cmd/serve.go25
-rw-r--r--cmd/update.go27
2 files changed, 44 insertions, 8 deletions
diff --git a/cmd/serve.go b/cmd/serve.go
index 2a76da7937..351553b91e 100644
--- a/cmd/serve.go
+++ b/cmd/serve.go
@@ -13,6 +13,7 @@ import (
"strings"
"github.com/codegangsta/cli"
+ "github.com/satori/go.uuid"
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/log"
@@ -165,7 +166,9 @@ func runServ(k *cli.Context) {
return
}
- models.SetRepoEnvs(user.Id, user.Name, repoName, repoUserName)
+ //models.SetRepoEnvs(user.Id, user.Name, repoName, repoUserName)
+ uuid := uuid.NewV4().String()
+ os.Setenv("uuid", uuid)
gitcmd := exec.Command(verb, repoPath)
gitcmd.Dir = setting.RepoRootPath
@@ -177,4 +180,24 @@ func runServ(k *cli.Context) {
println("Gogs: internal error:", err)
log.GitLogger.Fatal("Fail to execute git command: %v", err)
}
+
+ if isWrite {
+ tasks, err := models.GetUpdateTasksByUuid(uuid)
+ if err != nil {
+ log.GitLogger.Fatal("Fail to get update task: %v", err)
+ }
+
+ for _, task := range tasks {
+ err = models.Update(task.RefName, task.OldCommitId, task.NewCommitId,
+ user.Name, repoUserName, repoName, user.Id)
+ if err != nil {
+ log.GitLogger.Fatal("Fail to update: %v", err)
+ }
+ }
+
+ err = models.DelUpdateTasksByUuid(uuid)
+ if err != nil {
+ log.GitLogger.Fatal("Fail to del update task: %v", err)
+ }
+ }
}
diff --git a/cmd/update.go b/cmd/update.go
index c030b6cfb2..551fd09ef3 100644
--- a/cmd/update.go
+++ b/cmd/update.go
@@ -6,10 +6,8 @@ package cmd
import (
"os"
- "strconv"
"github.com/codegangsta/cli"
-
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/log"
)
@@ -37,12 +35,27 @@ func runUpdate(c *cli.Context) {
log.GitLogger.Fatal("refName is empty, shouldn't use")
}
- userName := os.Getenv("userName")
- userId, _ := strconv.ParseInt(os.Getenv("userId"), 10, 64)
- repoUserName := os.Getenv("repoUserName")
- repoName := os.Getenv("repoName")
+ //userName := os.Getenv("userName")
+ //userId, _ := strconv.ParseInt(os.Getenv("userId"), 10, 64)
+ //repoUserName := os.Getenv("repoUserName")
+ //repoName := os.Getenv("repoName")
+ uuid := os.Getenv("uuid")
+
+ task := models.UpdateTask{
+ Uuid: uuid,
+ RefName: args[0],
+ OldCommitId: args[1],
+ NewCommitId: args[2],
+ }
+
+ log.GitLogger.Error("%v", task)
- if err := models.Update(args[0], args[1], args[2], userName, repoUserName, repoName, userId); err != nil {
+ if err := models.AddUpdateTask(&task); err != nil {
log.GitLogger.Fatal(err.Error())
}
+
+ /*if err := models.Update(args[0], args[1], args[2], userName, repoUserName, repoName, userId); err != nil {
+ log.GitLogger.Fatal(err.Error())
+ }*/
+ //setEnvs(args[0], args[1], args[2], userName, repoUserName, repoName, userId)
}