|
|
|
@ -193,12 +193,12 @@ func Diff(ctx *middleware.Context) { |
|
|
|
|
|
|
|
|
|
userName := ctx.Repo.Owner.Name |
|
|
|
|
repoName := ctx.Repo.Repository.Name |
|
|
|
|
commitId := ctx.Repo.CommitId |
|
|
|
|
commitID := ctx.Repo.CommitID |
|
|
|
|
|
|
|
|
|
commit := ctx.Repo.Commit |
|
|
|
|
commit.CommitMessage = commit.CommitMessage |
|
|
|
|
diff, err := models.GetDiffCommit(models.RepoPath(userName, repoName), |
|
|
|
|
commitId, setting.Git.MaxGitDiffLines) |
|
|
|
|
commitID, setting.Git.MaxGitDiffLines) |
|
|
|
|
if err != nil { |
|
|
|
|
ctx.Handle(404, "GetDiffCommit", err) |
|
|
|
|
return |
|
|
|
@ -236,17 +236,17 @@ func Diff(ctx *middleware.Context) { |
|
|
|
|
ctx.Data["Username"] = userName |
|
|
|
|
ctx.Data["Reponame"] = repoName |
|
|
|
|
ctx.Data["IsImageFile"] = isImageFile |
|
|
|
|
ctx.Data["Title"] = commit.Summary() + " · " + base.ShortSha(commitId) |
|
|
|
|
ctx.Data["Title"] = commit.Summary() + " · " + base.ShortSha(commitID) |
|
|
|
|
ctx.Data["Commit"] = commit |
|
|
|
|
ctx.Data["Author"] = models.ValidateCommitWithEmail(commit) |
|
|
|
|
ctx.Data["Diff"] = diff |
|
|
|
|
ctx.Data["Parents"] = parents |
|
|
|
|
ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0 |
|
|
|
|
ctx.Data["SourcePath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "src", commitId) |
|
|
|
|
ctx.Data["SourcePath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "src", commitID) |
|
|
|
|
if commit.ParentCount() > 0 { |
|
|
|
|
ctx.Data["BeforeSourcePath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "src", parents[0]) |
|
|
|
|
} |
|
|
|
|
ctx.Data["RawPath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "raw", commitId) |
|
|
|
|
ctx.Data["RawPath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "raw", commitID) |
|
|
|
|
ctx.HTML(200, DIFF) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -255,17 +255,17 @@ func CompareDiff(ctx *middleware.Context) { |
|
|
|
|
ctx.Data["IsDiffCompare"] = true |
|
|
|
|
userName := ctx.Repo.Owner.Name |
|
|
|
|
repoName := ctx.Repo.Repository.Name |
|
|
|
|
beforeCommitId := ctx.Params(":before") |
|
|
|
|
afterCommitId := ctx.Params(":after") |
|
|
|
|
beforeCommitID := ctx.Params(":before") |
|
|
|
|
afterCommitID := ctx.Params(":after") |
|
|
|
|
|
|
|
|
|
commit, err := ctx.Repo.GitRepo.GetCommit(afterCommitId) |
|
|
|
|
commit, err := ctx.Repo.GitRepo.GetCommit(afterCommitID) |
|
|
|
|
if err != nil { |
|
|
|
|
ctx.Handle(404, "GetCommit", err) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
diff, err := models.GetDiffRange(models.RepoPath(userName, repoName), beforeCommitId, |
|
|
|
|
afterCommitId, setting.Git.MaxGitDiffLines) |
|
|
|
|
diff, err := models.GetDiffRange(models.RepoPath(userName, repoName), beforeCommitID, |
|
|
|
|
afterCommitID, setting.Git.MaxGitDiffLines) |
|
|
|
|
if err != nil { |
|
|
|
|
ctx.Handle(404, "GetDiffRange", err) |
|
|
|
|
return |
|
|
|
@ -290,7 +290,7 @@ func CompareDiff(ctx *middleware.Context) { |
|
|
|
|
return isImage |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
commits, err := commit.CommitsBeforeUntil(beforeCommitId) |
|
|
|
|
commits, err := commit.CommitsBeforeUntil(beforeCommitID) |
|
|
|
|
if err != nil { |
|
|
|
|
ctx.Handle(500, "CommitsBeforeUntil", err) |
|
|
|
|
return |
|
|
|
@ -299,17 +299,17 @@ func CompareDiff(ctx *middleware.Context) { |
|
|
|
|
|
|
|
|
|
ctx.Data["Commits"] = commits |
|
|
|
|
ctx.Data["CommitCount"] = commits.Len() |
|
|
|
|
ctx.Data["BeforeCommitId"] = beforeCommitId |
|
|
|
|
ctx.Data["AfterCommitId"] = afterCommitId |
|
|
|
|
ctx.Data["BeforeCommitID"] = beforeCommitID |
|
|
|
|
ctx.Data["AfterCommitID"] = afterCommitID |
|
|
|
|
ctx.Data["Username"] = userName |
|
|
|
|
ctx.Data["Reponame"] = repoName |
|
|
|
|
ctx.Data["IsImageFile"] = isImageFile |
|
|
|
|
ctx.Data["Title"] = "Comparing " + base.ShortSha(beforeCommitId) + "..." + base.ShortSha(afterCommitId) + " · " + userName + "/" + repoName |
|
|
|
|
ctx.Data["Title"] = "Comparing " + base.ShortSha(beforeCommitID) + "..." + base.ShortSha(afterCommitID) + " · " + userName + "/" + repoName |
|
|
|
|
ctx.Data["Commit"] = commit |
|
|
|
|
ctx.Data["Diff"] = diff |
|
|
|
|
ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0 |
|
|
|
|
ctx.Data["SourcePath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "src", afterCommitId) |
|
|
|
|
ctx.Data["BeforeSourcePath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "src", beforeCommitId) |
|
|
|
|
ctx.Data["RawPath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "raw", afterCommitId) |
|
|
|
|
ctx.Data["SourcePath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "src", afterCommitID) |
|
|
|
|
ctx.Data["BeforeSourcePath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "src", beforeCommitID) |
|
|
|
|
ctx.Data["RawPath"] = setting.AppSubUrl + "/" + path.Join(userName, repoName, "raw", afterCommitID) |
|
|
|
|
ctx.HTML(200, DIFF) |
|
|
|
|
} |
|
|
|
|