work on #1818
This commit is contained in:
parent
a301c7ed26
commit
04af4b24fd
2
gogs.go
2
gogs.go
|
@ -17,7 +17,7 @@ import (
|
||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
const APP_VER = "0.6.16.1018 Beta"
|
const APP_VER = "0.6.16.1022 Beta"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||||
|
|
|
@ -310,7 +310,7 @@ func (err ErrIssueNotExist) Error() string {
|
||||||
|
|
||||||
type ErrPullRequestNotExist struct {
|
type ErrPullRequestNotExist struct {
|
||||||
ID int64
|
ID int64
|
||||||
PullID int64
|
IssueID int64
|
||||||
HeadRepoID int64
|
HeadRepoID int64
|
||||||
BaseRepoID int64
|
BaseRepoID int64
|
||||||
HeadBarcnh string
|
HeadBarcnh string
|
||||||
|
@ -323,8 +323,8 @@ func IsErrPullRequestNotExist(err error) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (err ErrPullRequestNotExist) Error() string {
|
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]",
|
return fmt.Sprintf("pull request does not exist [id: %d, issue_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)
|
err.ID, err.IssueID, err.HeadRepoID, err.BaseRepoID, err.HeadBarcnh, err.BaseBranch)
|
||||||
}
|
}
|
||||||
|
|
||||||
// _________ __
|
// _________ __
|
||||||
|
|
|
@ -250,13 +250,15 @@ func GetUnmergedPullRequest(headRepoID, baseRepoID int64, headBranch, baseBranch
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPullRequestByIssueID returns pull request by given issue ID.
|
// GetPullRequestByIssueID returns pull request by given issue ID.
|
||||||
func GetPullRequestByIssueID(pullID int64) (*PullRequest, error) {
|
func GetPullRequestByIssueID(issueID int64) (*PullRequest, error) {
|
||||||
pr := new(PullRequest)
|
pr := &PullRequest{
|
||||||
has, err := x.Where("pull_id=?", pullID).Get(pr)
|
IssueID: issueID,
|
||||||
|
}
|
||||||
|
has, err := x.Get(pr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else if !has {
|
} else if !has {
|
||||||
return nil, ErrPullRequestNotExist{0, pullID, 0, 0, "", ""}
|
return nil, ErrPullRequestNotExist{0, issueID, 0, 0, "", ""}
|
||||||
}
|
}
|
||||||
return pr, nil
|
return pr, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0.6.16.1018 Beta
|
0.6.16.1022 Beta
|
Loading…
Reference in New Issue