devel-importer: adapt for scmsync packages
This commit is contained in:
@@ -22,6 +22,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net/url"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
@@ -92,6 +93,27 @@ func (refs *GitReferences) addReference(id, branch string) {
|
||||
refs.refs = append(refs.refs, GitReference{Branch: branch, Id: id})
|
||||
}
|
||||
|
||||
func (e *GitHandler) CloneDevel(gitDir, outName, urlString string) error {
|
||||
url, err := url.Parse(urlString)
|
||||
branch := url.Fragment
|
||||
url.Fragment = ""
|
||||
|
||||
params := []string{"clone", "-o", "devel"}
|
||||
if len(branch) > 0 {
|
||||
params = append(params, "-b", branch)
|
||||
}
|
||||
params = append(params, url.String(), outName)
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("error parsing SSH URL. %w", err);
|
||||
}
|
||||
out, err := e.GitExecWithOutput(gitDir, params...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error cloning %s.\n%s\nerr: %w", urlString, out, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e *GitHandler) GitBranchHead(gitDir, branchName string) (string, error) {
|
||||
id, err := e.GitExecWithOutput(gitDir, "rev-list", "-1", branchName)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user