mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-19 19:25:11 +02:00
PR: nothing to commit and has pull request check
This commit is contained in:
1 parent
37e0cee877
commit
1abfe4e05f
9 files changed
+143
-74
No files matched your search
@@ -466,6 +466,8 @@ pulls.compare_base = base
|
||||
pulls.compare_compare = compare
|
||||
pulls.filter_branch = Filter branch
|
||||
pulls.no_results = No results found.
|
||||
pulls.nothing_to_compare = There is nothing to compare because base and head branches are even.
|
||||
pulls.has_pull_request = `There is already a pull request between these two targets: <a href="%[1]s/pulls/%[3]d">%[2]s#%[3]d</a>`
|
||||
pulls.create = Create Pull Request
|
||||
pulls.title_desc = wants to merge %[1]d commits from <code>%[2]s</code> into <code>%[3]s</code>
|
||||
pulls.tab_conversation = Conversation
|
||||
|
||||
+12
-7
@@ -308,18 +308,23 @@ func (err ErrIssueNotExist) Error() string {
|
||||
// |____| |____/|____/____/____|_ /\___ >__ |____/ \___ >____ > |__|
|
||||
// \/ \/ |__| \/ \/
|
||||
|
||||
type ErrPullRepoNotExist struct {
|
||||
ID int64
|
||||
PullID int64
|
||||
type ErrPullRequestNotExist struct {
|
||||
ID int64
|
||||
PullID int64
|
||||
HeadRepoID int64
|
||||
BaseRepoID int64
|
||||
HeadBarcnh string
|
||||
BaseBranch string
|
||||
}
|
||||
|
||||
func IsErrPullRepoNotExist(err error) bool {
|
||||
_, ok := err.(ErrPullRepoNotExist)
|
||||
func IsErrPullRequestNotExist(err error) bool {
|
||||
_, ok := err.(ErrPullRequestNotExist)
|
||||
return ok
|
||||
}
|
||||
|
||||
func (err ErrPullRepoNotExist) Error() string {
|
||||
return fmt.Sprintf("pull repo does not exist [id: %d, pull_id: %d]", err.ID, err.PullID)
|
||||
func (err ErrPullRequestNotExist) Error() string {
|
||||
return fmt.Sprintf("pull request does not exist [id: %d, pull_id: %d, head_repo_id: %d, base_repo_id: %d, head_branch: %s, base_branch: %s]",
|
||||
err.ID, err.PullID, err.HeadRepoID, err.BaseRepoID, err.HeadBarcnh, err.BaseBranch)
|
||||
}
|
||||
|
||||
// _________ __
|
||||
|
||||
+62
-36
@@ -46,10 +46,10 @@ type Issue struct {
|
||||
MilestoneID int64
|
||||
Milestone *Milestone `xorm:"-"`
|
||||
AssigneeID int64
|
||||
Assignee *User `xorm:"-"`
|
||||
IsRead bool `xorm:"-"`
|
||||
IsPull bool // Indicates whether is a pull request or not.
|
||||
PullRepo *PullRepo `xorm:"-"`
|
||||
Assignee *User `xorm:"-"`
|
||||
IsRead bool `xorm:"-"`
|
||||
IsPull bool // Indicates whether is a pull request or not.
|
||||
*PullRequest `xorm:"-"`
|
||||
IsClosed bool
|
||||
Content string `xorm:"TEXT"`
|
||||
RenderedContent string `xorm:"-"`
|
||||
@@ -96,9 +96,13 @@ func (i *Issue) AfterSet(colName string, _ xorm.Cell) {
|
||||
log.Error(3, "GetUserByID[%d]: %v", i.ID, err)
|
||||
}
|
||||
case "is_pull":
|
||||
i.PullRepo, err = GetPullRepoByPullID(i.ID)
|
||||
if !i.IsPull {
|
||||
return
|
||||
}
|
||||
|
||||
i.PullRequest, err = GetPullRequestByPullID(i.ID)
|
||||
if err != nil {
|
||||
log.Error(3, "GetPullRepoByPullID[%d]: %v", i.ID, err)
|
||||
log.Error(3, "GetPullRequestByPullID[%d]: %v", i.ID, err)
|
||||
}
|
||||
case "created":
|
||||
i.Created = regulateTimeZone(i.Created)
|
||||
@@ -844,23 +848,25 @@ const (
|
||||
PLLL_ERQUEST_GIT
|
||||
)
|
||||
|
||||
// PullRepo represents relation between pull request and repositories.
|
||||
type PullRepo struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
PullID int64 `xorm:"INDEX"`
|
||||
HeadRepoID int64 `xorm:"UNIQUE(s)"`
|
||||
HeadRepo *Repository `xorm:"-"`
|
||||
BaseRepoID int64 `xorm:"UNIQUE(s)"`
|
||||
HeadUserName string
|
||||
HeadBarcnh string `xorm:"UNIQUE(s)"`
|
||||
BaseBranch string `xorm:"UNIQUE(s)"`
|
||||
MergeBase string `xorm:"VARCHAR(40)"`
|
||||
Type PullRequestType
|
||||
CanAutoMerge bool
|
||||
HasMerged bool
|
||||
// PullRequest represents relation between pull request and repositories.
|
||||
type PullRequest struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
PullID int64 `xorm:"INDEX"`
|
||||
PullIndex int64
|
||||
HeadRepoID int64 `xorm:"UNIQUE(s)"`
|
||||
HeadRepo *Repository `xorm:"-"`
|
||||
BaseRepoID int64 `xorm:"UNIQUE(s)"`
|
||||
HeadUserName string
|
||||
HeadBarcnh string `xorm:"UNIQUE(s)"`
|
||||
BaseBranch string `xorm:"UNIQUE(s)"`
|
||||
MergeBase string `xorm:"VARCHAR(40)"`
|
||||
MergedCommitID string `xorm:"VARCHAR(40)"`
|
||||
Type PullRequestType
|
||||
CanAutoMerge bool
|
||||
HasMerged bool
|
||||
}
|
||||
|
||||
func (pr *PullRepo) AfterSet(colName string, _ xorm.Cell) {
|
||||
func (pr *PullRequest) AfterSet(colName string, _ xorm.Cell) {
|
||||
var err error
|
||||
switch colName {
|
||||
case "head_repo_id":
|
||||
@@ -872,24 +878,24 @@ func (pr *PullRepo) AfterSet(colName string, _ xorm.Cell) {
|
||||
}
|
||||
|
||||
// NewPullRequest creates new pull request with labels for repository.
|
||||
func NewPullRequest(repo *Repository, pr *Issue, labelIDs []int64, uuids []string, pullRepo *PullRepo, patch []byte) (err error) {
|
||||
func NewPullRequest(repo *Repository, pull *Issue, labelIDs []int64, uuids []string, pr *PullRequest, patch []byte) (err error) {
|
||||
sess := x.NewSession()
|
||||
defer sessionRelease(sess)
|
||||
if err = sess.Begin(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = newIssue(sess, repo, pr, labelIDs, uuids); err != nil {
|
||||
if err = newIssue(sess, repo, pull, labelIDs, uuids); err != nil {
|
||||
return fmt.Errorf("newIssue: %v", err)
|
||||
}
|
||||
|
||||
// Notify watchers.
|
||||
act := &Action{
|
||||
ActUserID: pr.Poster.Id,
|
||||
ActUserName: pr.Poster.Name,
|
||||
ActEmail: pr.Poster.Email,
|
||||
ActUserID: pull.Poster.Id,
|
||||
ActUserName: pull.Poster.Name,
|
||||
ActEmail: pull.Poster.Email,
|
||||
OpType: PULL_REQUEST,
|
||||
Content: fmt.Sprintf("%d|%s", pr.Index, pr.Name),
|
||||
Content: fmt.Sprintf("%d|%s", pull.Index, pull.Name),
|
||||
RepoID: repo.ID,
|
||||
RepoUserName: repo.Owner.Name,
|
||||
RepoName: repo.Name,
|
||||
@@ -920,26 +926,46 @@ func NewPullRequest(repo *Repository, pr *Issue, labelIDs []int64, uuids []strin
|
||||
return fmt.Errorf("git apply --check: %v - %s", err, stderr)
|
||||
}
|
||||
}
|
||||
pullRepo.CanAutoMerge = !strings.Contains(stdout, "error: patch failed:")
|
||||
pr.CanAutoMerge = !strings.Contains(stdout, "error: patch failed:")
|
||||
|
||||
pullRepo.PullID = pr.ID
|
||||
if _, err = sess.Insert(pullRepo); err != nil {
|
||||
pr.PullID = pull.ID
|
||||
pr.PullIndex = pull.Index
|
||||
if _, err = sess.Insert(pr); err != nil {
|
||||
return fmt.Errorf("insert pull repo: %v", err)
|
||||
}
|
||||
|
||||
return sess.Commit()
|
||||
}
|
||||
|
||||
// GetPullRepoByPullID returns pull repo by given pull ID.
|
||||
func GetPullRepoByPullID(pullID int64) (*PullRepo, error) {
|
||||
pullRepo := new(PullRepo)
|
||||
has, err := x.Where("pull_id=?", pullID).Get(pullRepo)
|
||||
// GetPullRequest returnss a pull request by given info.
|
||||
func GetPullRequest(headRepoID, baseRepoID int64, headBranch, baseBranch string) (*PullRequest, error) {
|
||||
pr := &PullRequest{
|
||||
HeadRepoID: headRepoID,
|
||||
BaseRepoID: baseRepoID,
|
||||
HeadBarcnh: headBranch,
|
||||
BaseBranch: baseBranch,
|
||||
}
|
||||
|
||||
has, err := x.Get(pr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if !has {
|
||||
return nil, ErrPullRepoNotExist{0, pullID}
|
||||
return nil, ErrPullRequestNotExist{0, 0, headRepoID, baseRepoID, headBranch, baseBranch}
|
||||
}
|
||||
return pullRepo, nil
|
||||
|
||||
return pr, nil
|
||||
}
|
||||
|
||||
// GetPullRequestByPullID returns pull repo by given pull ID.
|
||||
func GetPullRequestByPullID(pullID int64) (*PullRequest, error) {
|
||||
pr := new(PullRequest)
|
||||
has, err := x.Where("pull_id=?", pullID).Get(pr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if !has {
|
||||
return nil, ErrPullRequestNotExist{0, pullID, 0, 0, "", ""}
|
||||
}
|
||||
return pr, nil
|
||||
}
|
||||
|
||||
// .____ ___. .__
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ func init() {
|
||||
new(User), new(PublicKey), new(Oauth2), new(AccessToken),
|
||||
new(Repository), new(DeployKey), new(Collaboration), new(Access),
|
||||
new(Watch), new(Star), new(Follow), new(Action),
|
||||
new(Issue), new(PullRepo), new(Comment), new(Attachment), new(IssueUser),
|
||||
new(Issue), new(PullRequest), new(Comment), new(Attachment), new(IssueUser),
|
||||
new(Label), new(IssueLabel), new(Milestone),
|
||||
new(Mirror), new(Release), new(LoginSource), new(Webhook),
|
||||
new(UpdateTask), new(HookTask),
|
||||
|
||||
@@ -4364,7 +4364,7 @@ func confLocaleLocale_deDeIni() (*asset, error) {
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _confLocaleLocale_enUsIni = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xc4\x7d\xfd\x72\xdc\x48\x8e\xe7\xff\x7c\x0a\xb6\x37\x7c\xee\x8e\x90\xcb\xd1\xdd\x71\x1f\xd1\x61\xbb\x4f\x96\xda\x1f\xbb\x96\xa5\xb1\xe4\x99\x9b\x73\x38\xd8\xac\x22\xab\x8a\xe3\x2a\xb2\x9a\x64\xb9\xac\xd9\xd8\x88\x7b\x8d\x7b\xbd\x7b\x92\x03\x7e\x00\xf2\x83\x64\xc9\xf6\xec\xc6\xdd\x3f\x12\x2b\x13\xf9\x85\x44\x22\x01\x24\x12\x99\xef\x76\x59\x51\x76\x8b\xf4\x49\x7a\x9a\xee\xf2\xaa\xde\x94\x5d\x97\x76\xe5\x66\xf9\x70\xdd\x74\x7d\x59\xa4\x2f\xaa\x9e\x7e\xb7\x9f\xaa\x45\x99\x24\xeb\x66\x5b\x12\xe8\x4b\xfa\x97\x14\x79\xb7\x9e\x37\x79\x5b\x50\xc2\xb9\x7d\x27\xe5\xe7\xdd\xa6\x69\x19\xe8\x37\xf9\x4a\xd6\xe5\x66\xc7\x65\xe8\x5f\xd2\x55\xab\x3a\xab\x6a\xfa\x79\x4d\x5f\xe9\xab\x3a\xe9\x9a\x45\x95\x6f\xb2\x20\x03\x09\x96\xff\x4b\xfa\x53\x5d\xa4\xd7\x7d\xb9\x4b\x1f\x77\xdb\x7c\xb3\x79\x9a\x77\x28\xd2\x97\x69\xbe\x58\x34\xfb\xba\x7f\xfc\x48\x32\xa4\xf2\x66\xdf\x5b\xed\x97\xfb\x5e\xd2\xf6\x3b\x4b\x7a\xb7\x4b\xda\x72\x55\xd1\xc0\x5a\x4a\x7a\xab\x9f\xc9\xa1\x9c\x77\x55\xcf\x9d\xfe\x8b\x7c\x25\x9f\xca\xb6\xab\x1a\xee\xcf\x9f\xe5\x2b\xd9\xe5\x2b\x06\xb8\xa2\x7f\x49\x5f\x6e\x77\x9b\x1c\x05\x6e\xf4\x33\xd9\xe4\xf5\x6a\x2f\x30\xaf\xf5\x33\x59\xb4\x25\x65\x65\x75\x79\xa0\xd4\x33\xfc\x48\xe9\xc7\x6c\x36\x4b\xf6\x84\xd3\x6c\xd7\x36\xcb\x6a\x53\x66\x79\x5d\x64\x5b\xc1\xda\x3b\x4a\x4f\x35\x3d\xa5\xf4\x94\xd3\x31\x8c\xb2\x20\x04\x65\x79\xa7\x63\xa1\xa9\x21\x7c\xe5\x5d\x82\xaa\xea\x7c\x6b\xa5\xf9\x33\x29\xb7\x79\xb5\xe1\x49\x78\xc8\x1f\xd4\xf9\xae\x3b\x34\x98\xaa\x2b\xfd\x24\x44\x64\xfd\xed\xae\x04\x1e\x1e\xde\xd0\x57\xb2\xc8\x77\xfd\x62\x9d\x73\x5f\xe5\x2b\x21\xa0\x5d\x43\x08\x69\xda\x5b\xc0\xd9\x8f\xa4\x69\x57\x79\x5d\xfd\x3d\xef\x05\x49\x97\xc1\xcf\x64\x5b\xb5\x6d\xc3\xf8\xbd\xc0\x47\x42\x23\xce\xb8\x1e\x4a\x79\x43\x98\x08\x6a\xe1\x9c\x6d\xb5\x6a\x05\x95\x9c\x79\x81\x5f\x5c\x0b\xe7\x2d\x9b\xf6\xa3\x66\x3c\xe7\xcf\x41\x51\xea\x84\xe6\xc6\xed\xe7\x35\x21\x5f\x73\x2f\xf0\x23\x02\xe8\x92\xbc\xd8\x12\x2a\x77\x79\x5d\x32\x8e\x4e\xf9\x17\xe1\x85\x7e\x25\x4a\x53\x59\x57\xf6\x7d\x55\xaf\x18\xd9\xa7\x92\x94\x5e\x6b\x52\x12\xe4\xb9\xb4\xdb\x66\xef\xa6\x93\xd2\xff\x4a\x3f\xd3\x2b\xf9\x29\x79\x41\x21\x64\xba\x92\x3c\x92\x2e\x5b\x96\x65\x21\x63\xe9\xd2\xe7\xf4\x9d\xec\xf6\x9b\x0d\x61\xed\x8f\x7d\xd9\xf5\x5c\xe8\x8a\x7e\xd3\xf8\xe5\x77\x52\x75\x1d\x7d\x50\xf2\x2b\x7c\x24\x34\x75\xf5\x02\x83\x39\xc3\x47\x92\xbc\xef\xca\xbc\x5d\xac\x3f\x24\xf2\x1f\x7d\xe5\x0f\xa6\xbd\x63\x93\xca\x84\xa4\x44\x24\x2d\x58\x03\xc9\xa2\x29\xf8\xc7\x19\xfd\xa3\xaa\xab\xba\xeb\x69\xc5\x7d\x48\xf4\x83\xc1\xe4\x4b\x26\xa0\xaf\x7a\x60\x41\x13\xb1\x7c\x3b\x9e\xc1\xf4\x79\xd5\x76\xfd\xc3\xbe\x22\x62\x7d\xbb\xaf\x13\x1e\x1f\xad\xb6\xac\x98\x1b\x13\x7a\xd1\x10\x8a\x90\xdc\xd2\xf8\x2e\x6e\xaf\xff\xf4\xfa\x24\xbd\x22\x4e\xb4\x6a\x4b\xfa\x4e\xa9\x0e\xfa\x47\x65\x7e\x9e\x25\x54\xca\x5a\x3a\xcf\xfb\x7c\x9e\x77\xa5\x47\x2b\x67\x0a\x75\xbb\x3c\xd0\x38\x73\x35\x70\xb0\xae\x8f\xc6\x3b\xb5\x42\xa8\x0e\x5d\x57\xae\x8e\x37\xbc\xb8\x28\x9d\x99\x1a\x0a\x5f\x6d\x4a\x4e\xa7\xaa\xd2\x57\x6f\xde\x5c\x9e\x3f\x4b\xcb\x7a\x55\xd5\x65\x7a\xa8\xfa\x75\xba\xef\x97\xff\x2d\x5b\x95\x75\xd9\x12\x8f\x5b\x54\x29\xad\xa9\x96\x28\x21\x25\xc2\x96\xc1\xcd\x92\xae\xdb\xd0\xda\x07\x7a\xaf\xaf\x5f\xa7\x17\x8c\xe2\x5d\xde\xaf\xd1\x91\x7e\x9d\x74\x7f\x6c\x18\x45\xae\xc1\x9b\x75\x99\x82\xca\x00\xd4\x2c\x0d\x1f\x69\xa1\x7d\x9c\x25\x65\xdb\x66\xc4\x96\xfa\xdb\x4c\x0b\x6b\x7d\x43\x48\xa9\x82\x48\xa7\x6e\xfa\x74\x5e\xa6\x28\x33\x4b\x12\xeb\xb0\x61\xf7\x74\xb7\xdb\x54\x0b\x59\xeb\x2f\x24\xcf\x23\x9a\x77\x10\xc5\x52\x08\x07\x44\x59\x5e\x80\x2e\x62\xcf\xbc\x1e\xd2\x88\x81\xa0\xfc\xba\x24\x06\xb8\xde\xaf\x84\xed\x6d\x9a\x7d\xf1\x1d\x28\xd5\x7a\xef\x09\x35\x7d\xdb\x50\x87\x81\x1d\x07\xe0\x9b\x38\x25\x8a\xe3\x4d\xab\x2d\xb7\x0d\xf1\x15\x47\xec\x15\x11\xd4\xa1\xa2\x4c\x1a\x69\x97\x7f\xa2\xf5\xd6\x37\x69\xbf\xae\xba\xb4\x20\x62\x5b\x70\xc5\xb4\x34\xf6\xb4\x5d\x08\x59\x10\x81\x0a\x69\x58\x5a\x3c\x07\x80\xda\xee\x89\x9a\xd6\x54\x19\x6f\x46\xbc\x73\x52\x95\x53\xfd\xc4\x90\xa8\x1e\xd0\x37\x51\x6e\x43\x5c\x99\xf9\xe6\x39\x3e\xf4\x77\x58\x3f\xf5\x2a\x5f\x2e\xa9\x57\x1d\x51\xc5\xcb\x74\xb1\x69\x88\xa4\xde\xbd\x7d\xdd\x31\xc1\xac\xb3\x5d\xd3\x62\x9b\xa3\xac\x2b\xfa\x74\x69\x01\xa2\x19\xa2\xde\x6f\xe7\xf4\xeb\xb0\xae\x88\x03\x00\xed\x5c\x82\x77\x73\x4a\xa5\x26\xf6\x1d\x4d\xe1\x49\x4a\x24\x4c\x23\x20\x94\x81\x00\x78\x0c\x45\xd5\xe5\x73\x9a\x7b\x06\x5f\xd2\xb6\xb5\x6f\x89\xac\xd6\x7d\xbf\xb3\x96\x5f\xde\xdc\x5c\x49\xd3\x2e\xf5\xae\xb6\xf3\x80\x32\x30\x07\x1b\xde\x78\xeb\xb4\xa9\x67\x20\x92\x7d\xbb\x19\xd0\x0f\x8d\xd5\x72\x8e\xe0\x85\xbb\xf0\x88\xff\x5c\x7b\xf4\x00\xcf\x1d\x49\x27\x07\x50\x13\xe1\xb8\xc4\x06\x48\x44\xdd\xec\xb8\xde\x80\xaa\x2f\x35\xc1\x93\x32\x36\x4d\x97\x2f\x5b\x27\xe5\x42\xf6\x09\xd8\xff\x96\x06\xac\x6c\xe4\xfa\x82\xd0\x00\x5e\x82\xd4\x65\xdb\x6c\x29\xf5\x39\xfd\xf3\x09\xbe\xfb\x17\x5c\x1f\x60\xf2\xa2\x20\xfe\xd6\x9d\xa4\x6f\x9f\x9f\xa5\xff\xf9\xe7\x9f\x7e\x9a\xa5\xaf\x7a\x5e\x89\x4c\x9c\x7f\x63\xa2\xa2\x4f\xd9\xc3\x1d\x28\xb1\x8c\x9e\xe8\xee\x1Line truncated
|
||||
var _confLocaleLocale_enUsIni = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xc4\x7d\xfd\x72\xdc\x48\x8e\xe7\xff\x7c\x0a\xb6\x37\x7c\xee\x8e\x90\xcb\xd1\xdd\x71\x1f\xd1\x61\xbb\x4f\x96\xda\x1f\xbb\x96\xa5\xb1\xe4\x99\x9b\x73\x38\xd8\xac\x22\xab\x8a\xe3\x2a\xb2\x9a\x64\xb9\xac\xd9\xd8\x88\x7b\x8d\x7b\xbd\x7b\x92\x03\x7e\x00\xf2\x83\x64\xc9\xf6\xec\xc6\xdd\x3f\x12\x2b\x13\xf9\x85\x44\x22\x01\x24\x12\x99\xef\x76\x59\x51\x76\x8b\xf4\x49\x7a\x9a\xee\xf2\xaa\xde\x94\x5d\x97\x76\xe5\x66\xf9\x70\xdd\x74\x7d\x59\xa4\x2f\xaa\x9e\x7e\xb7\x9f\xaa\x45\x99\x24\xeb\x66\x5b\x12\xe8\x4b\xfa\x97\x14\x79\xb7\x9e\x37\x79\x5b\x50\xc2\xb9\x7d\x27\xe5\xe7\xdd\xa6\x69\x19\xe8\x37\xf9\x4a\xd6\xe5\x66\xc7\x65\xe8\x5f\xd2\x55\xab\x3a\xab\x6a\xfa\x79\x4d\x5f\xe9\xab\x3a\xe9\x9a\x45\x95\x6f\xb2\x20\x03\x09\x96\xff\x4b\xfa\x53\x5d\xa4\xd7\x7d\xb9\x4b\x1f\x77\xdb\x7c\xb3\x79\x9a\x77\x28\xd2\x97\x69\xbe\x58\x34\xfb\xba\x7f\xfc\x48\x32\xa4\xf2\x66\xdf\x5b\xed\x97\xfb\x5e\xd2\xf6\x3b\x4b\x7a\xb7\x4b\xda\x72\x55\xd1\xc0\x5a\x4a\x7a\xab\x9f\xc9\xa1\x9c\x77\x55\xcf\x9d\xfe\x8b\x7c\x25\x9f\xca\xb6\xab\x1a\xee\xcf\x9f\xe5\x2b\xd9\xe5\x2b\x06\xb8\xa2\x7f\x49\x5f\x6e\x77\x9b\x1c\x05\x6e\xf4\x33\xd9\xe4\xf5\x6a\x2f\x30\xaf\xf5\x33\x59\xb4\x25\x65\x65\x75\x79\xa0\xd4\x33\xfc\x48\xe9\xc7\x6c\x36\x4b\xf6\x84\xd3\x6c\xd7\x36\xcb\x6a\x53\x66\x79\x5d\x64\x5b\xc1\xda\x3b\x4a\x4f\x35\x3d\xa5\xf4\x94\xd3\x31\x8c\xb2\x20\x04\x65\x79\xa7\x63\xa1\xa9\x21\x7c\xe5\x5d\x82\xaa\xea\x7c\x6b\xa5\xf9\x33\x29\xb7\x79\xb5\xe1\x49\x78\xc8\x1f\xd4\xf9\xae\x3b\x34\x98\xaa\x2b\xfd\x24\x44\x64\xfd\xed\xae\x04\x1e\x1e\xde\xd0\x57\xb2\xc8\x77\xfd\x62\x9d\x73\x5f\xe5\x2b\x21\xa0\x5d\x43\x08\x69\xda\x5b\xc0\xd9\x8f\xa4\x69\x57\x79\x5d\xfd\x3d\xef\x05\x49\x97\xc1\xcf\x64\x5b\xb5\x6d\xc3\xf8\xbd\xc0\x47\x42\x23\xce\xb8\x1e\x4a\x79\x43\x98\x08\x6a\xe1\x9c\x6d\xb5\x6a\x05\x95\x9c\x79\x81\x5f\x5c\x0b\xe7\x2d\x9b\xf6\xa3\x66\x3c\xe7\xcf\x41\x51\xea\x84\xe6\xc6\xed\xe7\x35\x21\x5f\x73\x2f\xf0\x23\x02\xe8\x92\xbc\xd8\x12\x2a\x77\x79\x5d\x32\x8e\x4e\xf9\x17\xe1\x85\x7e\x25\x4a\x53\x59\x57\xf6\x7d\x55\xaf\x18\xd9\xa7\x92\x94\x5e\x6b\x52\x12\xe4\xb9\xb4\xdb\x66\xef\xa6\x93\xd2\xff\x4a\x3f\xd3\x2b\xf9\x29\x79\x41\x21\x64\xba\x92\x3c\x92\x2e\x5b\x96\x65\x21\x63\xe9\xd2\xe7\xf4\x9d\xec\xf6\x9b\x0d\x61\xed\x8f\x7d\xd9\xf5\x5c\xe8\x8a\x7e\xd3\xf8\xe5\x77\x52\x75\x1d\x7d\x50\xf2\x2b\x7c\x24\x34\x75\xf5\x02\x83\x39\xc3\x47\x92\xbc\xef\xca\xbc\x5d\xac\x3f\x24\xf2\x1f\x7d\xe5\x0f\xa6\xbd\x63\x93\xca\x84\xa4\x44\x24\x2d\x58\x03\xc9\xa2\x29\xf8\xc7\x19\xfd\xa3\xaa\xab\xba\xeb\x69\xc5\x7d\x48\xf4\x83\xc1\xe4\x4b\x26\xa0\xaf\x7a\x60\x41\x13\xb1\x7c\x3b\x9e\xc1\xf4\x79\xd5\x76\xfd\xc3\xbe\x22\x62\x7d\xbb\xaf\x13\x1e\x1f\xad\xb6\xac\x98\x1b\x13\x7a\xd1\x10\x8a\x90\xdc\xd2\xf8\x2e\x6e\xaf\xff\xf4\xfa\x24\xbd\x22\x4e\xb4\x6a\x4b\xfa\x4e\xa9\x0e\xfa\x47\x65\x7e\x9e\x25\x54\xca\x5a\x3a\xcf\xfb\x7c\x9e\x77\xa5\x47\x2b\x67\x0a\x75\xbb\x3c\xd0\x38\x73\x35\x70\xb0\xae\x8f\xc6\x3b\xb5\x42\xa8\x0e\x5d\x57\xae\x8e\x37\xbc\xb8\x28\x9d\x99\x1a\x0a\x5f\x6d\x4a\x4e\xa7\xaa\xd2\x57\x6f\xde\x5c\x9e\x3f\x4b\xcb\x7a\x55\xd5\x65\x7a\xa8\xfa\x75\xba\xef\x97\xff\x2d\x5b\x95\x75\xd9\x12\x8f\x5b\x54\x29\xad\xa9\x96\x28\x21\x25\xc2\x96\xc1\xcd\x92\xae\xdb\xd0\xda\x07\x7a\xaf\xaf\x5f\xa7\x17\x8c\xe2\x5d\xde\xaf\xd1\x91\x7e\x9d\x74\x7f\x6c\x18\x45\xae\xc1\x9b\x75\x99\x82\xca\x00\xd4\x2c\x0d\x1f\x69\xa1\x7d\x9c\x25\x65\xdb\x66\xc4\x96\xfa\xdb\x4c\x0b\x6b\x7d\x43\x48\xa9\x82\x48\xa7\x6e\xfa\x74\x5e\xa6\x28\x33\x4b\x12\xeb\xb0\x61\xf7\x74\xb7\xdb\x54\x0b\x59\xeb\x2f\x24\xcf\x23\x9a\x77\x10\xc5\x52\x08\x07\x44\x59\x5e\x80\x2e\x62\xcf\xbc\x1e\xd2\x88\x81\xa0\xfc\xba\x24\x06\xb8\xde\xaf\x84\xed\x6d\x9a\x7d\xf1\x1d\x28\xd5\x7a\xef\x09\x35\x7d\xdb\x50\x87\x81\x1d\x07\xe0\x9b\x38\x25\x8a\xe3\x4d\xab\x2d\xb7\x0d\xf1\x15\x47\xec\x15\x11\xd4\xa1\xa2\x4c\x1a\x69\x97\x7f\xa2\xf5\xd6\x37\x69\xbf\xae\xba\xb4\x20\x62\x5b\x70\xc5\xb4\x34\xf6\xb4\x5d\x08\x59\x10\x81\x0a\x69\x58\x5a\x3c\x07\x80\xda\xee\x89\x9a\xd6\x54\x19\x6f\x46\xbc\x73\x52\x95\x53\xfd\xc4\x90\xa8\x1e\xd0\x37\x51\x6e\x43\x5c\x99\xf9\xe6\x39\x3e\xf4\x77\x58\x3f\xf5\x2a\x5f\x2e\xa9\x57\x1d\x51\xc5\xcb\x74\xb1\x69\x88\xa4\xde\xbd\x7d\xdd\x31\xc1\xac\xb3\x5d\xd3\x62\x9b\xa3\xac\x2b\xfa\x74\x69\x01\xa2\x19\xa2\xde\x6f\xe7\xf4\xeb\xb0\xae\x88\x03\x00\xed\x5c\x82\x77\x73\x4a\xa5\x26\xf6\x1d\x4d\xe1\x49\x4a\x24\x4c\x23\x20\x94\x81\x00\x78\x0c\x45\xd5\xe5\x73\x9a\x7b\x06\x5f\xd2\xb6\xb5\x6f\x89\xac\xd6\x7d\xbf\xb3\x96\x5f\xde\xdc\x5c\x49\xd3\x2e\xf5\xae\xb6\xf3\x80\x32\x30\x07\x1b\xde\x78\xeb\xb4\xa9\x67\x20\x92\x7d\xbb\x19\xd0\x0f\x8d\xd5\x72\x8e\xe0\x85\xbb\xf0\x88\xff\x5c\x7b\xf4\x00\xcf\x1d\x49\x27\x07\x50\x13\xe1\xb8\xc4\x06\x48\x44\xdd\xec\xb8\xde\x80\xaa\x2f\x35\xc1\x93\x32\x36\x4d\x97\x2f\x5b\x27\xe5\x42\xf6\x09\xd8\xff\x96\x06\xac\x6c\xe4\xfa\x82\xd0\x00\x5e\x82\xd4\x65\xdb\x6c\x29\xf5\x39\xfd\xf3\x09\xbe\xfb\x17\x5c\x1f\x60\xf2\xa2\x20\xfe\xd6\x9d\xa4\x6f\x9f\x9f\xa5\xff\xf9\xe7\x9f\x7e\x9a\xa5\xaf\x7a\x5e\x89\x4c\x9c\x7f\x63\xa2\xa2\x4f\xd9\xc3\x1d\x28\xb1\x8c\x9e\xe8\xee\x1Line truncated
|
||||
|
||||
func confLocaleLocale_enUsIniBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
@@ -4379,7 +4379,7 @@ func confLocaleLocale_enUsIni() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "conf/locale/locale_en-US.ini", size: 41606, mode: os.FileMode(420), modTime: time.Unix(1441178979, 0)}
|
||||
info := bindataFileInfo{name: "conf/locale/locale_en-US.ini", size: 41832, mode: os.FileMode(420), modTime: time.Unix(1441184579, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
@@ -317,6 +317,7 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
|
||||
return
|
||||
}
|
||||
ctx.Data["RepoLink"] = ctx.Repo.RepoLink
|
||||
ctx.Data["RepoRelPath"] = ctx.Repo.Owner.Name + "/" + ctx.Repo.Repository.Name
|
||||
|
||||
tags, err := ctx.Repo.GitRepo.GetTags()
|
||||
if err != nil {
|
||||
|
||||
+48
-25
@@ -170,12 +170,12 @@ func checkPullInfo(ctx *middleware.Context) *models.Issue {
|
||||
func PrepareViewPullInfo(ctx *middleware.Context, pull *models.Issue) *git.PullRequestInfo {
|
||||
repo := ctx.Repo.Repository
|
||||
|
||||
ctx.Data["HeadTarget"] = pull.PullRepo.HeadUserName + "/" + pull.PullRepo.HeadBarcnh
|
||||
ctx.Data["BaseTarget"] = ctx.Repo.Owner.Name + "/" + pull.PullRepo.BaseBranch
|
||||
ctx.Data["HeadTarget"] = pull.HeadUserName + "/" + pull.HeadBarcnh
|
||||
ctx.Data["BaseTarget"] = ctx.Repo.Owner.Name + "/" + pull.BaseBranch
|
||||
|
||||
headRepoPath, err := pull.PullRepo.HeadRepo.RepoPath()
|
||||
headRepoPath, err := pull.HeadRepo.RepoPath()
|
||||
if err != nil {
|
||||
ctx.Handle(500, "PullRepo.HeadRepo.RepoPath", err)
|
||||
ctx.Handle(500, "HeadRepo.RepoPath", err)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ func PrepareViewPullInfo(ctx *middleware.Context, pull *models.Issue) *git.PullR
|
||||
}
|
||||
|
||||
prInfo, err := headGitRepo.GetPullRequestInfo(models.RepoPath(repo.Owner.Name, repo.Name),
|
||||
pull.PullRepo.BaseBranch, pull.PullRepo.HeadBarcnh)
|
||||
pull.BaseBranch, pull.HeadBarcnh)
|
||||
if err != nil {
|
||||
ctx.Handle(500, "GetPullRequestInfo", err)
|
||||
return nil
|
||||
@@ -210,7 +210,10 @@ func ViewPullCommits(ctx *middleware.Context) {
|
||||
}
|
||||
prInfo.Commits = models.ValidateCommitsWithEmails(prInfo.Commits)
|
||||
ctx.Data["Commits"] = prInfo.Commits
|
||||
ctx.Data["CommitCount"] = prInfo.Commits.Len()
|
||||
|
||||
ctx.Data["Username"] = pull.HeadUserName
|
||||
ctx.Data["Reponame"] = pull.HeadRepo.Name
|
||||
ctx.HTML(200, PULL_COMMITS)
|
||||
}
|
||||
|
||||
@@ -226,9 +229,8 @@ func ViewPullFiles(ctx *middleware.Context) {
|
||||
if ctx.Written() {
|
||||
return
|
||||
}
|
||||
_ = prInfo
|
||||
|
||||
headRepoPath := models.RepoPath(pull.PullRepo.HeadUserName, pull.PullRepo.HeadRepo.Name)
|
||||
headRepoPath := models.RepoPath(pull.HeadUserName, pull.HeadRepo.Name)
|
||||
|
||||
headGitRepo, err := git.OpenRepository(headRepoPath)
|
||||
if err != nil {
|
||||
@@ -236,7 +238,7 @@ func ViewPullFiles(ctx *middleware.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
headCommitID, err := headGitRepo.GetCommitIdOfBranch(pull.PullRepo.HeadBarcnh)
|
||||
headCommitID, err := headGitRepo.GetCommitIdOfBranch(pull.HeadBarcnh)
|
||||
if err != nil {
|
||||
ctx.Handle(500, "GetCommitIdOfBranch", err)
|
||||
return
|
||||
@@ -257,9 +259,9 @@ func ViewPullFiles(ctx *middleware.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
headTarget := path.Join(pull.PullRepo.HeadUserName, pull.PullRepo.HeadRepo.Name)
|
||||
ctx.Data["Username"] = pull.PullRepo.HeadUserName
|
||||
ctx.Data["Reponame"] = pull.PullRepo.HeadRepo.Name
|
||||
headTarget := path.Join(pull.HeadUserName, pull.HeadRepo.Name)
|
||||
ctx.Data["Username"] = pull.HeadUserName
|
||||
ctx.Data["Reponame"] = pull.HeadRepo.Name
|
||||
ctx.Data["IsImageFile"] = headCommit.IsImageFile
|
||||
ctx.Data["SourcePath"] = setting.AppSubUrl + "/" + path.Join(headTarget, "src", headCommitID)
|
||||
ctx.Data["BeforeSourcePath"] = setting.AppSubUrl + "/" + path.Join(headTarget, "src", prInfo.MergeBase)
|
||||
@@ -348,7 +350,7 @@ func PrepareCompareDiff(
|
||||
headRepo *models.Repository,
|
||||
headGitRepo *git.Repository,
|
||||
prInfo *git.PullRequestInfo,
|
||||
baseBranch, headBranch string) {
|
||||
baseBranch, headBranch string) bool {
|
||||
|
||||
var (
|
||||
repo = ctx.Repo.Repository
|
||||
@@ -359,21 +361,26 @@ func PrepareCompareDiff(
|
||||
ctx.Data["CommitRepoLink"], err = headRepo.RepoLink()
|
||||
if err != nil {
|
||||
ctx.Handle(500, "RepoLink", err)
|
||||
return
|
||||
return false
|
||||
}
|
||||
|
||||
headCommitID, err := headGitRepo.GetCommitIdOfBranch(headBranch)
|
||||
if err != nil {
|
||||
ctx.Handle(500, "GetCommitIdOfBranch", err)
|
||||
return
|
||||
return false
|
||||
}
|
||||
ctx.Data["AfterCommitID"] = headCommitID
|
||||
|
||||
if headCommitID == prInfo.MergeBase {
|
||||
ctx.Data["IsNothingToCompare"] = true
|
||||
return true
|
||||
}
|
||||
|
||||
diff, err := models.GetDiffRange(models.RepoPath(headUser.Name, headRepo.Name),
|
||||
prInfo.MergeBase, headCommitID, setting.Git.MaxGitDiffLines)
|
||||
if err != nil {
|
||||
ctx.Handle(500, "GetDiffRange", err)
|
||||
return
|
||||
return false
|
||||
}
|
||||
ctx.Data["Diff"] = diff
|
||||
ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
|
||||
@@ -381,7 +388,7 @@ func PrepareCompareDiff(
|
||||
headCommit, err := headGitRepo.GetCommit(headCommitID)
|
||||
if err != nil {
|
||||
ctx.Handle(500, "GetCommit", err)
|
||||
return
|
||||
return false
|
||||
}
|
||||
|
||||
prInfo.Commits = models.ValidateCommitsWithEmails(prInfo.Commits)
|
||||
@@ -395,6 +402,7 @@ func PrepareCompareDiff(
|
||||
ctx.Data["SourcePath"] = setting.AppSubUrl + "/" + path.Join(headTarget, "src", headCommitID)
|
||||
ctx.Data["BeforeSourcePath"] = setting.AppSubUrl + "/" + path.Join(headTarget, "src", prInfo.MergeBase)
|
||||
ctx.Data["RawPath"] = setting.AppSubUrl + "/" + path.Join(headTarget, "raw", headCommitID)
|
||||
return false
|
||||
}
|
||||
|
||||
func CompareAndPullRequest(ctx *middleware.Context) {
|
||||
@@ -408,15 +416,30 @@ func CompareAndPullRequest(ctx *middleware.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
PrepareCompareDiff(ctx, headUser, headRepo, headGitRepo, prInfo, baseBranch, headBranch)
|
||||
pr, err := models.GetPullRequest(headRepo.ID, ctx.Repo.Repository.ID, headBranch, baseBranch)
|
||||
if err != nil {
|
||||
if !models.IsErrPullRequestNotExist(err) {
|
||||
ctx.Handle(500, "HasPullRequest", err)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
ctx.Data["HasPullRequest"] = true
|
||||
ctx.Data["PullRequest"] = pr
|
||||
ctx.HTML(200, COMPARE_PULL)
|
||||
return
|
||||
}
|
||||
|
||||
nothingToCompare := PrepareCompareDiff(ctx, headUser, headRepo, headGitRepo, prInfo, baseBranch, headBranch)
|
||||
if ctx.Written() {
|
||||
return
|
||||
}
|
||||
|
||||
// Setup information for new form.
|
||||
RetrieveRepoMetas(ctx, ctx.Repo.Repository)
|
||||
if ctx.Written() {
|
||||
return
|
||||
if !nothingToCompare {
|
||||
// Setup information for new form.
|
||||
RetrieveRepoMetas(ctx, ctx.Repo.Repository)
|
||||
if ctx.Written() {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
ctx.HTML(200, COMPARE_PULL)
|
||||
@@ -458,7 +481,7 @@ func CompareAndPullRequestPost(ctx *middleware.Context, form auth.CreateIssueFor
|
||||
return
|
||||
}
|
||||
|
||||
pr := &models.Issue{
|
||||
pull := &models.Issue{
|
||||
RepoID: repo.ID,
|
||||
Index: int64(repo.NumIssues) + 1,
|
||||
Name: form.Title,
|
||||
@@ -469,7 +492,7 @@ func CompareAndPullRequestPost(ctx *middleware.Context, form auth.CreateIssueFor
|
||||
IsPull: true,
|
||||
Content: form.Content,
|
||||
}
|
||||
if err := models.NewPullRequest(repo, pr, labelIDs, attachments, &models.PullRepo{
|
||||
if err := models.NewPullRequest(repo, pull, labelIDs, attachments, &models.PullRequest{
|
||||
HeadRepoID: headRepo.ID,
|
||||
BaseRepoID: repo.ID,
|
||||
HeadUserName: headUser.Name,
|
||||
@@ -482,6 +505,6 @@ func CompareAndPullRequestPost(ctx *middleware.Context, form auth.CreateIssueFor
|
||||
return
|
||||
}
|
||||
|
||||
log.Trace("Pull request created: %d/%d", repo.ID, pr.ID)
|
||||
ctx.Redirect(ctx.Repo.RepoLink + "/pulls/" + com.ToStr(pr.Index))
|
||||
log.Trace("Pull request created: %d/%d", repo.ID, pull.ID)
|
||||
ctx.Redirect(ctx.Repo.RepoLink + "/pulls/" + com.ToStr(pull.Index))
|
||||
}
|
||||
@@ -133,7 +133,7 @@
|
||||
|
||||
{{if .Issue.IsPull}}
|
||||
<div class="comment merge box">
|
||||
<a class="avatar text {{if .Issue.IsClosed}}grey{{else if .Issue.PullRepo.CanAutoMerge}}green{{else}}red{{end}}">
|
||||
<a class="avatar text {{if .Issue.IsClosed}}grey{{else if .Issue.CanAutoMerge}}green{{else}}red{{end}}">
|
||||
<span class="mega-octicon octicon-git-merge"></span>
|
||||
</a>
|
||||
<div class="content">
|
||||
@@ -142,17 +142,19 @@
|
||||
<div class="item text grey">
|
||||
{{$.i18n.Tr "repo.pulls.reopen_to_merge"}}
|
||||
</div>
|
||||
{{else if .Issue.PullRepo.CanAutoMerge}}
|
||||
{{else if .Issue.CanAutoMerge}}
|
||||
<div class="item text green">
|
||||
<span class="octicon octicon-check"></span>
|
||||
{{$.i18n.Tr "repo.pulls.can_auto_merge_desc"}}
|
||||
</div>
|
||||
{{if .IsRepositoryAdmin}}
|
||||
<div class="ui divider"></div>
|
||||
<div>
|
||||
<button class="ui green button">
|
||||
<span class="octicon octicon-git-merge"></span> {{$.i18n.Tr "repo.pulls.merge_pull_request"}}
|
||||
</button>
|
||||
</div>
|
||||
{{end}}
|
||||
{{else}}
|
||||
<div class="item text red">
|
||||
<span class="octicon octicon-x"></span>
|
||||
|
||||
@@ -45,10 +45,20 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{template "repo/issue/new_form" .}}
|
||||
|
||||
{{if .IsNothingToCompare}}
|
||||
<div class="ui segment">
|
||||
{{.i18n.Tr "repo.pulls.nothing_to_compare"}}
|
||||
</div>
|
||||
{{else if .HasPullRequest}}
|
||||
<div class="ui segment">
|
||||
{{.i18n.Tr "repo.pulls.has_pull_request" $.RepoLink $.RepoRelPath .PullRequest.PullIndex | Safe}}
|
||||
</div>
|
||||
{{else}}
|
||||
{{template "repo/issue/new_form" .}}
|
||||
{{template "repo/commits_table" .}}
|
||||
{{template "repo/diff_box" .}}
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user