From 00a864e693434bce687f3f5145d8369583197b78 Mon Sep 17 00:00:00 2001 From: Christopher Brickley Date: Tue, 26 Aug 2014 08:20:18 -0400 Subject: add commit compare functionality --- models/update.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'models/update.go') diff --git a/models/update.go b/models/update.go index 68a92ada..ec6a9790 100644 --- a/models/update.go +++ b/models/update.go @@ -101,7 +101,7 @@ func Update(refName, oldCommitId, newCommitId, userName, repoUserName, repoName commit := &base.PushCommits{} if err = CommitRepoAction(userId, ru.Id, userName, actEmail, - repos.Id, repoUserName, repoName, refName, commit); err != nil { + repos.Id, repoUserName, repoName, refName, commit, oldCommitId, newCommitId); err != nil { log.GitLogger.Fatal(4, "runUpdate.models.CommitRepoAction: %s/%s:%v", repoUserName, repoName, err) } return err @@ -152,7 +152,7 @@ func Update(refName, oldCommitId, newCommitId, userName, repoUserName, repoName //commits = append(commits, []string{lastCommit.Id().String(), lastCommit.Message()}) if err = CommitRepoAction(userId, ru.Id, userName, actEmail, - repos.Id, repoUserName, repoName, refName, &base.PushCommits{l.Len(), commits}); err != nil { + repos.Id, repoUserName, repoName, refName, &base.PushCommits{l.Len(), commits}, oldCommitId, newCommitId); err != nil { return fmt.Errorf("runUpdate.models.CommitRepoAction: %s/%s:%v", repoUserName, repoName, err) } return nil -- cgit v1.2.3 From 25c8d01676217ab37e117a2aefb77ff4aeed4448 Mon Sep 17 00:00:00 2001 From: Christopher Brickley Date: Mon, 22 Sep 2014 08:25:39 -0400 Subject: increase max commits in payload to 5 --- models/update.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'models/update.go') diff --git a/models/update.go b/models/update.go index ec6a9790..d939a908 100644 --- a/models/update.go +++ b/models/update.go @@ -23,6 +23,10 @@ type UpdateTask struct { NewCommitId string } +const ( + MAX_COMMITS int = 5 +) + func AddUpdateTask(task *UpdateTask) error { _, err := x.Insert(task) return err @@ -132,7 +136,6 @@ func Update(refName, oldCommitId, newCommitId, userName, repoUserName, repoName // if commits push commits := make([]*base.PushCommit, 0) - var maxCommits = 2 var actEmail string for e := l.Front(); e != nil; e = e.Next() { commit := e.Value.(*git.Commit) @@ -145,7 +148,7 @@ func Update(refName, oldCommitId, newCommitId, userName, repoUserName, repoName commit.Message(), commit.Author.Email, commit.Author.Name}) - if len(commits) >= maxCommits { + if len(commits) >= MAX_COMMITS { break } } -- cgit v1.2.3