diff --git a/bots-common/git_utils.go b/bots-common/git_utils.go index 2b14f7b..2f82de0 100644 --- a/bots-common/git_utils.go +++ b/bots-common/git_utils.go @@ -45,6 +45,7 @@ type GitStatusLister interface { } type Git interface { + GitParseCommits(cwd string, commitIDs []string) (parsedCommits []commit, err error) GitCatFile(cwd, commitId, filename string) (data []byte, err error) GetPath() string diff --git a/devel-importer/main.go b/devel-importer/main.go index 08eea44..1c4db74 100644 --- a/devel-importer/main.go +++ b/devel-importer/main.go @@ -69,16 +69,17 @@ func main() { debugGitPath := flag.String("git-path", "", "Path for temporary git directory. Only used if DebugMode") flag.Parse() - git, err := common.CreateGitHandler("Autogits - Devel Importer", "not.exist", "devel-importer") + gh := common.GitHandlerGeneratorImpl{} + git, err := gh.CreateGitHandler("Autogits - Devel Importer", "not.exist", "devel-importer") if err != nil { log.Panicln("Failed to allocate git handler. Err:", err) } if DebugMode { - log.Println(" - working directory:" + git.GitPath) if len(*debugGitPath) > 0 { git.Close() - git.GitPath = *debugGitPath + gh.ReadExistingPath("Autogits - Devel Importer", "not.exist", *debugGitPath) } + log.Println(" - working directory:" + git.GetPath()) } else { defer git.Close() } @@ -164,7 +165,7 @@ func main() { log.Println("Num of old packages:", len(oldPackageNames)) // fork packags from pool - cmd := exec.Command("./git-importer", append([]string{"-r", git.GitPath}, oldPackageNames...)...) + cmd := exec.Command("./git-importer", append([]string{"-r", git.GetPath()}, oldPackageNames...)...) out, err := cmd.CombinedOutput() log.Println(string(out)) if err != nil { @@ -177,7 +178,7 @@ func main() { pkg := factoryRepos[i] // verify that package was created by `git-importer`, or it's scmsync package and clone it - fi, err := os.Stat(filepath.Join(git.GitPath, pkg.Name)) + fi, err := os.Stat(filepath.Join(git.GetPath(), pkg.Name)) if os.IsNotExist(err) { // scmsync? devel_project, err := runObsCommand("develproject", "openSUSE:Factory", pkg.Name) @@ -197,7 +198,7 @@ func main() { } // try again, should now exist - if fi, err = os.Stat(filepath.Join(git.GitPath, pkg.Name)); err != nil { + if fi, err = os.Stat(filepath.Join(git.GetPath(), pkg.Name)); err != nil { log.Panicln(err) } } else if err != nil { @@ -300,7 +301,7 @@ func main() { args[0] = "-p" args[1] = prj args[2] = "-r" - args[3] = git.GitPath + args[3] = git.GetPath() args = append(args, develProjectPackages...) cmd = exec.Command("./git-importer", args...) out, err = cmd.CombinedOutput()