Compare commits
1 Commits
Author | SHA256 | Date | |
---|---|---|---|
3d8671a7fe |
48
common/pr_conflict_resolution.go
Normal file
48
common/pr_conflict_resolution.go
Normal file
@@ -0,0 +1,48 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var UnknownParser error = errors.New("Cannot parse path")
|
||||
|
||||
type PRConflictResolver interface {
|
||||
/*
|
||||
stage_content -> { merge_base (stage1), head (stage2), merge_head (stage3) }
|
||||
*/
|
||||
Resolve(path string, stage_contents [3]string) error
|
||||
}
|
||||
|
||||
var resolvers []PRConflictResolver = []PRConflictResolver{
|
||||
&submodule_conflict_resolver{},
|
||||
}
|
||||
|
||||
func ResolveMergeConflict(path string, file_contents [3]string) error {
|
||||
for _, r := range resolvers {
|
||||
if err := r.Resolve(path, file_contents); err != UnknownParser {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return UnknownParser
|
||||
}
|
||||
|
||||
type submodule_conflict_resolver struct{}
|
||||
|
||||
func (*submodule_conflict_resolver) Resolve(path string, stage [3]string) error {
|
||||
if path != ".gitmodules" {
|
||||
return UnknownParser
|
||||
}
|
||||
return UnknownParser
|
||||
}
|
||||
|
||||
type changes_file_resolver struct{}
|
||||
|
||||
func (*changes_file_resolver) Resolve(path string, stage [3]string) error {
|
||||
if !strings.HasSuffix(path, ".changes") {
|
||||
return UnknownParser
|
||||
}
|
||||
|
||||
return UnknownParser
|
||||
}
|
10
common/pr_conflict_resolution_test.go
Normal file
10
common/pr_conflict_resolution_test.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package common_test
|
||||
|
||||
import "testing"
|
||||
|
||||
func ResolveSubmoduleConflicts(t *testing.T) {
|
||||
}
|
||||
|
||||
func ResolveChangesFileConflict(t *testing.T) {
|
||||
}
|
||||
|
Reference in New Issue
Block a user