From 241ce8f9762013c5f19dc3dc201bf67bbe120e1a Mon Sep 17 00:00:00 2001 From: Kim Lindhardt Madsen Date: Wed, 18 Nov 2015 13:56:06 +0100 Subject: [PATCH] fix some rename errors after merge --- routers/api/v1/repo.go | 4 ---- routers/api/v1/repo_commits.go | 10 +++++----- routers/api/v1/repo_releases.go | 18 +++++++++--------- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/routers/api/v1/repo.go b/routers/api/v1/repo.go index 3c2af825c..380062fc4 100644 --- a/routers/api/v1/repo.go +++ b/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})) } -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 func CreateRepo(ctx *middleware.Context, opt api.CreateRepoOption) { // Shouldn't reach this condition, but just in case. diff --git a/routers/api/v1/repo_commits.go b/routers/api/v1/repo_commits.go index 6b6d25e17..a5d1611bc 100644 --- a/routers/api/v1/repo_commits.go +++ b/routers/api/v1/repo_commits.go @@ -11,7 +11,7 @@ import ( "github.com/gogits/gogs/modules/git" "github.com/gogits/gogs/modules/log" "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 { @@ -24,7 +24,7 @@ func ToApiSignature(signature *git.Signature) *api.Signature { func ToApiCommit(commit *git.Commit) *api.Commit { return &api.Commit{ - ID: commit.Id.String(), + ID: commit.ID.String(), Author: *ToApiSignature(commit.Author), Committer: *ToApiSignature(commit.Committer), CommitMessage: commit.CommitMessage, @@ -33,7 +33,7 @@ func ToApiCommit(commit *git.Commit) *api.Commit { func HEADCommit(ctx *middleware.Context) { 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, Addition: diffFile.Addition, Deletion: diffFile.Deletion, - Type: base.DiffTypeToStr(diffFile.Type), + Type: template.DiffTypeToStr(diffFile.Type), IsCreated: diffFile.IsCreated, IsDeleted: diffFile.IsDeleted, IsBin: diffFile.IsBin, @@ -130,7 +130,7 @@ func ToApiDiffLine(diffLine *models.DiffLine) *api.DiffLine { return &api.DiffLine{ LeftIdx: diffLine.LeftIdx, RightIdx: diffLine.RightIdx, - Type: base.DiffLineTypeToStr(diffLine.Type), + Type: template.DiffLineTypeToStr(diffLine.Type), Content: diffLine.Content, } } diff --git a/routers/api/v1/repo_releases.go b/routers/api/v1/repo_releases.go index d93bfd908..1cea43209 100644 --- a/routers/api/v1/repo_releases.go +++ b/routers/api/v1/repo_releases.go @@ -18,7 +18,7 @@ import ( func ToApiRelease(release *models.Release) *api.Release { return &api.Release{ - ID: release.Id, + ID: release.ID, Publisher: *ToApiUser(release.Publisher), TagName: release.TagName, LowerTagName: release.LowerTagName, @@ -56,7 +56,7 @@ func ListReleases(ctx *middleware.Context) { continue } if rel.TagName == rawTag { - rel.Publisher, err = models.GetUserByID(rel.PublisherId) + rel.Publisher, err = models.GetUserByID(rel.PublisherID) if err != nil { ctx.Handle(500, "GetUserById", err) return @@ -99,10 +99,10 @@ func ListReleases(ctx *middleware.Context) { tags[i] = &api.Release{ Title: 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 { ctx.Handle(500, "CommitsCount", err) return @@ -116,7 +116,7 @@ func ListReleases(ctx *middleware.Context) { continue } - rel.Publisher, err = models.GetUserByID(rel.PublisherId) + rel.Publisher, err = models.GetUserByID(rel.PublisherID) if err != nil { ctx.Handle(500, "GetUserById", err) return @@ -157,7 +157,7 @@ func ReleaseByName(ctx *middleware.Context) { return } - publisher, err := models.GetUserByID(rel.PublisherId) + publisher, err := models.GetUserByID(rel.PublisherID) if err != nil { if models.IsErrUserNotExist(err) { publisher = models.NewFakeUser() @@ -191,13 +191,13 @@ func CreateRelease(ctx *middleware.Context, form api.CreateReleaseOption) { } rel := &models.Release{ - RepoId: ctx.Repo.Repository.ID, + RepoID: ctx.Repo.Repository.ID, Publisher: ctx.User, - PublisherId: ctx.User.Id, + PublisherID: ctx.User.Id, Title: form.Title, TagName: form.TagName, Target: form.Target, - Sha1: commit.Id.String(), + Sha1: commit.ID.String(), NumCommits: commitsCount, Note: form.Note, IsDraft: form.IsDraft,