1
+ import scala .collection .parallel .CollectionConverters ._ // for .par
1
2
2
3
case class Commit (sha : String , author : String , header : String , body : String ) {
3
4
def trimmedHeader = header.take(80 )
@@ -9,11 +10,11 @@ object GitHelper {
9
10
def processGitCommits (gitDir : java.io.File , previousTag : String , currentTag : String ): IndexedSeq [Commit ] = {
10
11
import sys .process ._
11
12
val gitFormat = " %h %s" // sha and subject
12
- val log = Process (Seq (" git" , " --no-pager" , " log" , s " ${previousTag}.. ${currentTag}" , " --format=format:" + gitFormat, " --no-merges" , " --topo-order" ), gitDir).lineStream
13
+ val log = Process (Seq (" git" , " --no-pager" , " log" , s " ${previousTag}.. ${currentTag}" , " --format=format:" + gitFormat, " --no-merges" , " --topo-order" ), gitDir).lazyLines
13
14
14
15
log.par.map(_.split(" " , 2 )).collect {
15
16
case Array (sha, title) =>
16
- val (author :: body) = Process (Seq (" git" , " --no-pager" , " show" , sha, " --format=format:%aN%n%b" , " --quiet" ), gitDir).lineStream .toList
17
+ val (author :: body) = Process (Seq (" git" , " --no-pager" , " show" , sha, " --format=format:%aN%n%b" , " --quiet" ), gitDir).lazyLines .toList
17
18
Commit (sha, author, title, body.mkString(" \n " ))
18
19
}.toVector
19
20
}
@@ -41,10 +42,12 @@ class GitInfo(gitDir: java.io.File, val previousTag: String, val currentTag: Str
41
42
import GitHelper ._
42
43
val commits = processGitCommits(gitDir, previousTag, currentTag)
43
44
44
- val authors : Seq [(String , Int )] = {
45
- val grouped : Vector [(String , Int )] = (commits groupBy (_.author)).map { case (a, c) => a -> c.length } { collection.breakOut }
46
- (grouped sortBy (_._2)).reverse
47
- }
45
+ val authors : Seq [(String , Int )] =
46
+ commits
47
+ .groupBy(_.author)
48
+ .map{case (a, c) => a -> c.length}
49
+ .toVector
50
+ .sortBy(_._2)
48
51
49
52
val fixCommits =
50
53
for {
0 commit comments