소스 검색

Merge branch 'develop' of https://github.com/tanapoln/gogs into develop

Unknwon 8 년 전
부모
커밋
44ed991726
10개의 변경된 파일65개의 추가작업 그리고 5개의 파일을 삭제
  1. 1 1
      README.md
  2. 1 0
      cmd/web.go
  3. 2 0
      conf/locale/locale_en-US.ini
  4. 1 1
      gogs.go
  5. 0 0
      modules/bindata/bindata.go
  6. 1 1
      public/config.codekit
  7. 39 0
      routers/repo/branch.go
  8. 9 0
      routers/repo/issue.go
  9. 1 1
      templates/.VERSION
  10. 10 1
      templates/repo/issue/view_content.tmpl

+ 1 - 1
README.md

@@ -3,7 +3,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
 
 
 ![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true)
 ![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true)
 
 
-##### Current tip version: 0.9.102 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions or submit a task on [alpha stage automated binary building system](https://build.gogs.io/))
+##### Current tip version: 0.9.103 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions or submit a task on [alpha stage automated binary building system](https://build.gogs.io/))
 
 
 | Web | UI  | Preview  |
 | Web | UI  | Preview  |
 |:-------------:|:-------:|:-------:|
 |:-------------:|:-------:|:-------:|

+ 1 - 0
cmd/web.go

@@ -559,6 +559,7 @@ func runWeb(ctx *cli.Context) error {
 		}, context.RepoRef())
 		}, context.RepoRef())
 
 
 		// m.Get("/branches", repo.Branches)
 		// m.Get("/branches", repo.Branches)
+		m.Post("/branches/:name/delete", reqSignIn, reqRepoWriter, repo.DeleteBranchPost)
 
 
 		m.Group("/wiki", func() {
 		m.Group("/wiki", func() {
 			m.Get("/?:page", repo.Wiki)
 			m.Get("/?:page", repo.Wiki)

+ 2 - 0
conf/locale/locale_en-US.ini

@@ -580,6 +580,8 @@ pulls.cannot_auto_merge_desc = This pull request can't be merged automatically b
 pulls.cannot_auto_merge_helper = Please merge manually in order to resolve the conflicts.
 pulls.cannot_auto_merge_helper = Please merge manually in order to resolve the conflicts.
 pulls.merge_pull_request = Merge Pull Request
 pulls.merge_pull_request = Merge Pull Request
 pulls.open_unmerged_pull_exists = `You can't perform reopen operation because there is already an open pull request (#%d) from same repository with same merge information and is waiting for merging.`
 pulls.open_unmerged_pull_exists = `You can't perform reopen operation because there is already an open pull request (#%d) from same repository with same merge information and is waiting for merging.`
+pulls.delete_branch = Delete Branch
+pulls.delete_branch_has_new_commits = Branch cannot be deleted because it has new commits after mergence.
 
 
 milestones.new = New Milestone
 milestones.new = New Milestone
 milestones.open_tab = %d Open
 milestones.open_tab = %d Open

+ 1 - 1
gogs.go

@@ -17,7 +17,7 @@ import (
 	"github.com/gogits/gogs/modules/setting"
 	"github.com/gogits/gogs/modules/setting"
 )
 )
 
 
-const APP_VER = "0.9.102.1220"
+const APP_VER = "0.9.103.1221"
 
 
 func init() {
 func init() {
 	runtime.GOMAXPROCS(runtime.NumCPU())
 	runtime.GOMAXPROCS(runtime.NumCPU())

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
modules/bindata/bindata.go


+ 1 - 1
public/config.codekit

@@ -1,6 +1,6 @@
 {
 {
 "CodeKitInfo": "This is a CodeKit 2.x project configuration file. It is designed to sync project settings across multiple machines. MODIFYING THE CONTENTS OF THIS FILE IS A POOR LIFE DECISION. If you do so, you will likely cause CodeKit to crash. This file is not useful unless accompanied by the project that created it in CodeKit 2. This file is not backwards-compatible with CodeKit 1.x. For more information, see: http:\/\/incident57.com\/codekit",
 "CodeKitInfo": "This is a CodeKit 2.x project configuration file. It is designed to sync project settings across multiple machines. MODIFYING THE CONTENTS OF THIS FILE IS A POOR LIFE DECISION. If you do so, you will likely cause CodeKit to crash. This file is not useful unless accompanied by the project that created it in CodeKit 2. This file is not backwards-compatible with CodeKit 1.x. For more information, see: http:\/\/incident57.com\/codekit",
-"creatorBuild": "19115",
+"creatorBuild": "19127",
 "files": {
 "files": {
 	"\/css\/github.min.css": {
 	"\/css\/github.min.css": {
 		"fileType": 16,
 		"fileType": 16,

+ 39 - 0
routers/repo/branch.go

@@ -5,8 +5,11 @@
 package repo
 package repo
 
 
 import (
 import (
+	"github.com/gogits/git-module"
+
 	"github.com/gogits/gogs/modules/base"
 	"github.com/gogits/gogs/modules/base"
 	"github.com/gogits/gogs/modules/context"
 	"github.com/gogits/gogs/modules/context"
+	"github.com/gogits/gogs/modules/log"
 )
 )
 
 
 const (
 const (
@@ -29,3 +32,39 @@ func Branches(ctx *context.Context) {
 	ctx.Data["Branches"] = brs
 	ctx.Data["Branches"] = brs
 	ctx.HTML(200, BRANCH)
 	ctx.HTML(200, BRANCH)
 }
 }
+
+func DeleteBranchPost(ctx *context.Context) {
+	branchName := ctx.Params(":name")
+	commitID := ctx.Query("commit")
+
+	defer func() {
+		redirectTo := ctx.Query("redirect_to")
+		if len(redirectTo) == 0 {
+			redirectTo = ctx.Repo.RepoLink
+		}
+		ctx.Redirect(redirectTo)
+	}()
+
+	if !ctx.Repo.GitRepo.IsBranchExist(branchName) {
+		return
+	}
+	if len(commitID) > 0 {
+		branchCommitID, err := ctx.Repo.GitRepo.GetBranchCommitID(branchName)
+		if err != nil {
+			log.Error(4, "GetBranchCommitID: %v", err)
+			return
+		}
+
+		if branchCommitID != commitID {
+			ctx.Flash.Error(ctx.Tr("repo.pulls.delete_branch_has_new_commits"))
+			return
+		}
+	}
+
+	if err := ctx.Repo.GitRepo.DeleteBranch(branchName, git.DeleteBranchOptions{
+		Force: false,
+	}); err != nil {
+		log.Error(4, "DeleteBranch: %v", err)
+		return
+	}
+}

+ 9 - 0
routers/repo/issue.go

@@ -629,6 +629,15 @@ func ViewIssue(ctx *context.Context) {
 		}
 		}
 	}
 	}
 
 
+	if issue.IsPull && issue.PullRequest.HasMerged {
+		pull := issue.PullRequest
+		ctx.Data["IsPullBranchDeletable"] = pull.BaseRepoID == pull.HeadRepoID &&
+			ctx.Repo.IsWriter() && ctx.Repo.GitRepo.IsBranchExist(pull.HeadBranch)
+
+		deleteBranchUrl := ctx.Repo.RepoLink + "/branches/" + pull.HeadBranch + "/delete"
+		ctx.Data["DeleteBranchLink"] = fmt.Sprintf("%s?commit=%s&redirect_to=%s", deleteBranchUrl, pull.MergedCommitID, ctx.Data["Link"])
+	}
+
 	ctx.Data["Participants"] = participants
 	ctx.Data["Participants"] = participants
 	ctx.Data["NumParticipants"] = len(participants)
 	ctx.Data["NumParticipants"] = len(participants)
 	ctx.Data["Issue"] = issue
 	ctx.Data["Issue"] = issue

+ 1 - 1
templates/.VERSION

@@ -1 +1 @@
-0.9.102.1220
+0.9.103.1221

+ 10 - 1
templates/repo/issue/view_content.tmpl

@@ -163,6 +163,15 @@
 								<div class="item text purple">
 								<div class="item text purple">
 									{{$.i18n.Tr "repo.pulls.has_merged"}}
 									{{$.i18n.Tr "repo.pulls.has_merged"}}
 								</div>
 								</div>
+								{{if .IsPullBranchDeletable}}
+									<div class="ui divider"></div>
+									<div>
+										<form class="ui form" action="{{.DeleteBranchLink}}" method="post">
+											{{.CsrfTokenHtml}}
+											<button class="ui red button">{{$.i18n.Tr "repo.pulls.delete_branch"}}</button>
+										</form>
+									</div>
+								{{end}}
 							{{else if .Issue.IsClosed}}
 							{{else if .Issue.IsClosed}}
 								<div class="item text grey">
 								<div class="item text grey">
 									{{$.i18n.Tr "repo.pulls.reopen_to_merge"}}
 									{{$.i18n.Tr "repo.pulls.reopen_to_merge"}}
@@ -265,7 +274,7 @@
 					<div class="item">
 					<div class="item">
 						<a class="ui label {{if not .IsChecked}}hide{{end}}" id="label_{{.ID}}" href="{{$.RepoLink}}/issues?labels={{.ID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}">{{.Name}}</a>
 						<a class="ui label {{if not .IsChecked}}hide{{end}}" id="label_{{.ID}}" href="{{$.RepoLink}}/issues?labels={{.ID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}">{{.Name}}</a>
 					</div>
 					</div>
-					
+
 				{{end}}
 				{{end}}
 			</div>
 			</div>
 
 

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.