1+ import scala .collection .parallel .CollectionConverters ._ // for .par
12
23case class Commit (sha : String , author : String , header : String , body : String ) {
34 def trimmedHeader = header.take(80 )
@@ -9,11 +10,11 @@ object GitHelper {
910 def processGitCommits (gitDir : java.io.File , previousTag : String , currentTag : String ): IndexedSeq [Commit ] = {
1011 import sys .process ._
1112 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
1314
1415 log.par.map(_.split(" " , 2 )).collect {
1516 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
1718 Commit (sha, author, title, body.mkString(" \n " ))
1819 }.toVector
1920 }
@@ -41,10 +42,12 @@ class GitInfo(gitDir: java.io.File, val previousTag: String, val currentTag: Str
4142 import GitHelper ._
4243 val commits = processGitCommits(gitDir, previousTag, currentTag)
4344
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)
4851
4952 val fixCommits =
5053 for {
0 commit comments