Browse Source

Add missing patch conflit pattern

tags/v0.9.99
Unknwon 8 years ago
parent
commit
a47baa1b7a
4 changed files with 8 additions and 7 deletions
  1. 1
    1
      README.md
  2. 1
    1
      gogs.go
  3. 5
    4
      models/pull.go
  4. 1
    1
      templates/.VERSION

+ 1
- 1
README.md View File



![](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 version: 0.8.27
##### Current version: 0.8.28


| Web | UI | Preview | | Web | UI | Preview |
|:-------------:|:-------:|:-------:| |:-------------:|:-------:|:-------:|

+ 1
- 1
gogs.go View File

"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )


const APP_VER = "0.8.27.0202"
const APP_VER = "0.8.28.0203"


func init() { func init() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())

+ 5
- 4
models/pull.go View File

"patch does not apply", "patch does not apply",
"already exists in working directory", "already exists in working directory",
"unrecognized input", "unrecognized input",
"error:",
} }


// testPatch checks if patch can be merged to base repository without conflit. // testPatch checks if patch can be merged to base repository without conflit.
return nil return nil
} }


log.Trace("PullRequest[%d].testPatch(patchPath): %s", pr.ID, patchPath)
log.Trace("PullRequest[%d].testPatch (patchPath): %s", pr.ID, patchPath)


if err := pr.BaseRepo.UpdateLocalCopy(); err != nil { if err := pr.BaseRepo.UpdateLocalCopy(); err != nil {
return fmt.Errorf("UpdateLocalCopy: %v", err) return fmt.Errorf("UpdateLocalCopy: %v", err)


// Checkout base branch. // Checkout base branch.
_, stderr, err := process.ExecDir(-1, pr.BaseRepo.LocalCopyPath(), _, stderr, err := process.ExecDir(-1, pr.BaseRepo.LocalCopyPath(),
fmt.Sprintf("PullRequest.Merge(git checkout): %v", pr.BaseRepo.ID),
fmt.Sprintf("PullRequest.Merge (git checkout): %v", pr.BaseRepo.ID),
"git", "checkout", pr.BaseBranch) "git", "checkout", pr.BaseBranch)
if err != nil { if err != nil {
return fmt.Errorf("git checkout: %s", stderr) return fmt.Errorf("git checkout: %s", stderr)


pr.Status = PULL_REQUEST_STATUS_CHECKING pr.Status = PULL_REQUEST_STATUS_CHECKING
_, stderr, err = process.ExecDir(-1, pr.BaseRepo.LocalCopyPath(), _, stderr, err = process.ExecDir(-1, pr.BaseRepo.LocalCopyPath(),
fmt.Sprintf("testPatch(git apply --check): %d", pr.BaseRepo.ID),
fmt.Sprintf("testPatch (git apply --check): %d", pr.BaseRepo.ID),
"git", "apply", "--check", patchPath) "git", "apply", "--check", patchPath)
if err != nil { if err != nil {
for i := range patchConflicts { for i := range patchConflicts {
if strings.Contains(stderr, patchConflicts[i]) { if strings.Contains(stderr, patchConflicts[i]) {
log.Trace("PullRequest[%d].testPatch(apply): has conflit", pr.ID)
log.Trace("PullRequest[%d].testPatch (apply): has conflit", pr.ID)
fmt.Println(stderr) fmt.Println(stderr)
pr.Status = PULL_REQUEST_STATUS_CONFLICT pr.Status = PULL_REQUEST_STATUS_CONFLICT
return nil return nil

+ 1
- 1
templates/.VERSION View File

0.8.27.0202
0.8.28.0203

Loading…
Cancel
Save