Advertisement
Guest User

Untitled

a guest
Jul 10th, 2014
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.79 KB | None | 0 0
  1. import scala.io.Source
  2.  
  3. /**
  4.  * @author pawbara
  5.  */
  6. object Counter {
  7.  
  8.   def main(args: Array[String]) = {
  9.     assert(args.size == 2, "Need two commit logs")
  10.     val parsedArgs = args map(a => parseCommits(readCommitLogFromFile(a)))
  11.     val commitLogs = (parsedArgs(0), parsedArgs(1))
  12. //    print(countCommits(commitLogs._1, commitLogs._2) mkString("\r\n"))
  13.     println(countCommits(commitLogs))
  14.   }
  15.  
  16.   def countCommits(commitLogs: (List[String], List[String])) = {
  17.     (commitLogs._1.size, commitLogs._1 count (commitLogs._2 contains _), commitLogs._2.size)
  18. //    commits filter (otherBranchCommits contains _)
  19.   }
  20.  
  21.   def parseCommits(data: List[String]) = data filter(_.startsWith("    S"))
  22.  
  23.   def readCommitLogFromFile(filePath: String) = (Source fromFile filePath getLines()).toList
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement