-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGitLogService.scala
63 lines (48 loc) · 1.74 KB
/
GitLogService.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package gitlog
import java.util.Locale
import gitlog.FrontEndJsonModel.Author
import gitlog.GitLogJsonModel.{GitLog, LogEntry}
import org.joda.time.DateTime
import org.joda.time.format.{DateTimeFormat, DateTimeFormatter}
object GitLogService {
/**
* Count total number of commits
*/
def countCommits(log: GitLog): Int = ???
/**
* Count commits of a specific author. Author is defined like "Matthias Erch <[email protected]"
*/
def countCommitsOfUser(log: GitLog, author: String): Int = ???
/**
* Count number of contributers.
*
* Duplicates caused by multiple mail addresses for the same contributer are allowed.
*/
def countOfContributer(log: GitLog): Int = ???
val inputFormatter: DateTimeFormatter = DateTimeFormat.forPattern("EEE MMM dd HH:mm:ss yyyy Z").withLocale(Locale.ENGLISH)
val outputFormatter: DateTimeFormatter = DateTimeFormat.forPattern("yyyy-MM-dd").withLocale(Locale.ENGLISH)
/**
* Use [[inputFormatter]] and [[outputFormatter]] to get a [[Map]] of number of commits per day
*/
def logEntryPerDay(log: GitLog): Map[String, Int] = ???
/**
* Return a map of log entries per author name
*/
def logEntryByName(log: GitLog): Map[String, Seq[LogEntry]] = ???
/**
* Hints:
* - you may use split method of [[String]]
* - arrays support a takeWhile and dropWhile method
* - arrays support mkString to join ll elements to a string
*
*/
def authorFromLogEntry(logEntry: LogEntry): Author = ???
/**
* Transform a list of [[LogEntry]] into a list of [[Author]]
*/
def authorFromLogEntries(logEntries: Seq[LogEntry]): Seq[Author] = ???
/**
* Get a specific author from a list of authors
*/
def author(authors: Seq[Author], name: String): Author = ???
}