Browse Source

fix some rename errors after merge

pull/2039/head
Kim Lindhardt Madsen 9 years ago
parent
commit
241ce8f976
  1. 4
      routers/api/v1/repo.go
  2. 10
      routers/api/v1/repo_commits.go
  3. 18
      routers/api/v1/repo_releases.go

4
routers/api/v1/repo.go

@ -159,10 +159,6 @@ func createRepo(ctx *middleware.Context, owner *models.User, opt api.CreateRepoO
ctx.JSON(201, ToApiRepository(owner, repo, api.Permission{true, true, true})) ctx.JSON(201, ToApiRepository(owner, repo, api.Permission{true, true, true}))
} }
func GetRepo(ctx *middleware.Context) {
ctx.JSON(200, ToApiRepository(ctx.Repo.Repository.Owner, ctx.Repo.Repository, api.Permission{}))
}
// https://github.com/kiliit/go-gogs-client/wiki/Repositories#create // https://github.com/kiliit/go-gogs-client/wiki/Repositories#create
func CreateRepo(ctx *middleware.Context, opt api.CreateRepoOption) { func CreateRepo(ctx *middleware.Context, opt api.CreateRepoOption) {
// Shouldn't reach this condition, but just in case. // Shouldn't reach this condition, but just in case.

10
routers/api/v1/repo_commits.go

@ -11,7 +11,7 @@ import (
"github.com/gogits/gogs/modules/git" "github.com/gogits/gogs/modules/git"
"github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/log"
"github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/modules/middleware"
"github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/template"
) )
func ToApiSignature(signature *git.Signature) *api.Signature { func ToApiSignature(signature *git.Signature) *api.Signature {
@ -24,7 +24,7 @@ func ToApiSignature(signature *git.Signature) *api.Signature {
func ToApiCommit(commit *git.Commit) *api.Commit { func ToApiCommit(commit *git.Commit) *api.Commit {
return &api.Commit{ return &api.Commit{
ID: commit.Id.String(), ID: commit.ID.String(),
Author: *ToApiSignature(commit.Author), Author: *ToApiSignature(commit.Author),
Committer: *ToApiSignature(commit.Committer), Committer: *ToApiSignature(commit.Committer),
CommitMessage: commit.CommitMessage, CommitMessage: commit.CommitMessage,
@ -33,7 +33,7 @@ func ToApiCommit(commit *git.Commit) *api.Commit {
func HEADCommit(ctx *middleware.Context) { func HEADCommit(ctx *middleware.Context) {
ctx.JSON(200, &api.Sha1{ ctx.JSON(200, &api.Sha1{
Sha1: ctx.Repo.Commit.Id.String(), Sha1: ctx.Repo.Commit.ID.String(),
}) })
} }
@ -95,7 +95,7 @@ func ToApiDiffFile(diffFile *models.DiffFile) *api.DiffFile {
Index: diffFile.Index, Index: diffFile.Index,
Addition: diffFile.Addition, Addition: diffFile.Addition,
Deletion: diffFile.Deletion, Deletion: diffFile.Deletion,
Type: base.DiffTypeToStr(diffFile.Type), Type: template.DiffTypeToStr(diffFile.Type),
IsCreated: diffFile.IsCreated, IsCreated: diffFile.IsCreated,
IsDeleted: diffFile.IsDeleted, IsDeleted: diffFile.IsDeleted,
IsBin: diffFile.IsBin, IsBin: diffFile.IsBin,
@ -130,7 +130,7 @@ func ToApiDiffLine(diffLine *models.DiffLine) *api.DiffLine {
return &api.DiffLine{ return &api.DiffLine{
LeftIdx: diffLine.LeftIdx, LeftIdx: diffLine.LeftIdx,
RightIdx: diffLine.RightIdx, RightIdx: diffLine.RightIdx,
Type: base.DiffLineTypeToStr(diffLine.Type), Type: template.DiffLineTypeToStr(diffLine.Type),
Content: diffLine.Content, Content: diffLine.Content,
} }
} }

18
routers/api/v1/repo_releases.go

@ -18,7 +18,7 @@ import (
func ToApiRelease(release *models.Release) *api.Release { func ToApiRelease(release *models.Release) *api.Release {
return &api.Release{ return &api.Release{
ID: release.Id, ID: release.ID,
Publisher: *ToApiUser(release.Publisher), Publisher: *ToApiUser(release.Publisher),
TagName: release.TagName, TagName: release.TagName,
LowerTagName: release.LowerTagName, LowerTagName: release.LowerTagName,
@ -56,7 +56,7 @@ func ListReleases(ctx *middleware.Context) {
continue continue
} }
if rel.TagName == rawTag { if rel.TagName == rawTag {
rel.Publisher, err = models.GetUserByID(rel.PublisherId) rel.Publisher, err = models.GetUserByID(rel.PublisherID)
if err != nil { if err != nil {
ctx.Handle(500, "GetUserById", err) ctx.Handle(500, "GetUserById", err)
return return
@ -99,10 +99,10 @@ func ListReleases(ctx *middleware.Context) {
tags[i] = &api.Release{ tags[i] = &api.Release{
Title: rawTag, Title: rawTag,
TagName: rawTag, TagName: rawTag,
Sha1: commit.Id.String(), Sha1: commit.ID.String(),
} }
tags[i].NumCommits, err = ctx.Repo.GitRepo.CommitsCount(commit.Id.String()) tags[i].NumCommits, err = ctx.Repo.GitRepo.CommitsCount(commit.ID.String())
if err != nil { if err != nil {
ctx.Handle(500, "CommitsCount", err) ctx.Handle(500, "CommitsCount", err)
return return
@ -116,7 +116,7 @@ func ListReleases(ctx *middleware.Context) {
continue continue
} }
rel.Publisher, err = models.GetUserByID(rel.PublisherId) rel.Publisher, err = models.GetUserByID(rel.PublisherID)
if err != nil { if err != nil {
ctx.Handle(500, "GetUserById", err) ctx.Handle(500, "GetUserById", err)
return return
@ -157,7 +157,7 @@ func ReleaseByName(ctx *middleware.Context) {
return return
} }
publisher, err := models.GetUserByID(rel.PublisherId) publisher, err := models.GetUserByID(rel.PublisherID)
if err != nil { if err != nil {
if models.IsErrUserNotExist(err) { if models.IsErrUserNotExist(err) {
publisher = models.NewFakeUser() publisher = models.NewFakeUser()
@ -191,13 +191,13 @@ func CreateRelease(ctx *middleware.Context, form api.CreateReleaseOption) {
} }
rel := &models.Release{ rel := &models.Release{
RepoId: ctx.Repo.Repository.ID, RepoID: ctx.Repo.Repository.ID,
Publisher: ctx.User, Publisher: ctx.User,
PublisherId: ctx.User.Id, PublisherID: ctx.User.Id,
Title: form.Title, Title: form.Title,
TagName: form.TagName, TagName: form.TagName,
Target: form.Target, Target: form.Target,
Sha1: commit.Id.String(), Sha1: commit.ID.String(),
NumCommits: commitsCount, NumCommits: commitsCount,
Note: form.Note, Note: form.Note,
IsDraft: form.IsDraft, IsDraft: form.IsDraft,

Loading…
Cancel
Save