|
|
|
@@ -52,25 +52,6 @@ func (repo *Repository) GetAllCommitsCount() (int64, error) { |
|
|
|
return AllCommitsCount(repo.Path) |
|
|
|
} |
|
|
|
|
|
|
|
func (repo *Repository) ParsePrettyFormatLogToList(logs []byte) (*list.List, error) { |
|
|
|
l := list.New() |
|
|
|
if len(logs) == 0 { |
|
|
|
return l, nil |
|
|
|
} |
|
|
|
|
|
|
|
parts := bytes.Split(logs, []byte{'\n'}) |
|
|
|
|
|
|
|
for _, commitID := range parts { |
|
|
|
commit, err := repo.GetCommit(string(commitID)) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
l.PushBack(commit) |
|
|
|
} |
|
|
|
|
|
|
|
return l, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (repo *Repository) parsePrettyFormatLogToList(logs []byte) (*list.List, error) { |
|
|
|
l := list.New() |
|
|
|
if len(logs) == 0 { |
|
|
|
@@ -460,7 +441,7 @@ type Contributor struct { |
|
|
|
Email string |
|
|
|
} |
|
|
|
|
|
|
|
func GetContributors(repoPath string) ([]Contributor, error) { |
|
|
|
func GetContributors(repoPath string) ([]Contributor, error){ |
|
|
|
cmd := NewCommand("shortlog", "-sne", "--all") |
|
|
|
stdout, err := cmd.RunInDir(repoPath) |
|
|
|
if err != nil { |
|
|
|
@@ -477,9 +458,9 @@ func GetContributors(repoPath string) ([]Contributor, error) { |
|
|
|
} |
|
|
|
number := oneCount[0:strings.Index(oneCount, "\t")] |
|
|
|
commitCnt, _ := strconv.Atoi(number) |
|
|
|
committer := oneCount[strings.Index(oneCount, "\t")+1 : strings.LastIndex(oneCount, " ")] |
|
|
|
committer := oneCount[strings.Index(oneCount, "\t")+1:strings.LastIndex(oneCount, " ")] |
|
|
|
committer = strings.Trim(committer, " ") |
|
|
|
email := oneCount[strings.Index(oneCount, "<")+1 : strings.Index(oneCount, ">")] |
|
|
|
email := oneCount[strings.Index(oneCount, "<")+1:strings.Index(oneCount, ">")] |
|
|
|
contributorsInfo[i] = Contributor{ |
|
|
|
commitCnt, committer, email, |
|
|
|
} |
|
|
|
|