gitlab_git 2.0.0.pre → 2.0.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gitlab_git/git_stats.rb +2 -1
- data/lib/gitlab_git/log_parser.rb +14 -22
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da25f5e49b2f2f7cacb78576ab4a3fde6bb0cf56
|
4
|
+
data.tar.gz: 340e2be3999981b3fa56bbbaa6c93fd47d0b5ff0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a44c137700945c9cb02b964ea79f886db546e7497c286be637ac3e6dcf0a5111ee6766bd9d77764516f625be9298364aa415f3578d9bdc65790707a460abe93
|
7
|
+
data.tar.gz: 435685c2c27baef6d6fb581ff3c35781bd7a4b356a1bee2ac44f9e84095cecc28f42f45c2cd0107a9d7ce98852e2ab67388a33c8f9a4180f6d69439bea8a93f4
|
data/lib/gitlab_git/git_stats.rb
CHANGED
@@ -10,7 +10,8 @@ module Gitlab
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def log
|
13
|
-
|
13
|
+
# Limit log to 8k commits to avoid timeout for huge projects
|
14
|
+
args = ['--format=%aN%x0a%aE%x0a%ad', '--date=short', '--shortstat', '--no-merges', '--max-count=8000']
|
14
15
|
repo.git.run(nil, 'log', nil, {}, args)
|
15
16
|
rescue Grit::Git::GitTimeout
|
16
17
|
nil
|
@@ -2,31 +2,23 @@ module Gitlab
|
|
2
2
|
module Git
|
3
3
|
class LogParser
|
4
4
|
# Parses the log file into a collection of commits
|
5
|
-
# Data model:
|
6
|
-
|
5
|
+
# Data model:
|
6
|
+
# {author_name, author_email, date, additions, deletions}
|
7
|
+
def self.parse_log(log_from_git)
|
7
8
|
log = log_from_git.split("\n")
|
8
|
-
|
9
|
-
i = 0
|
10
9
|
collection = []
|
11
|
-
entry = {}
|
12
10
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
when 3
|
25
|
-
changes = log[i].split(",")
|
26
|
-
entry[:additions] = changes[1].to_i unless changes[1].nil?
|
27
|
-
entry[:deletions] = changes[2].to_i unless changes[2].nil?
|
28
|
-
end
|
29
|
-
i += 1
|
11
|
+
log.each_slice(5) do |slice|
|
12
|
+
entry = {}
|
13
|
+
entry[:author_name] = slice[0]
|
14
|
+
entry[:author_email] = slice[1]
|
15
|
+
entry[:date] = slice[2]
|
16
|
+
|
17
|
+
changes = slice[4].split(",")
|
18
|
+
entry[:additions] = changes[1].to_i unless changes[1].nil?
|
19
|
+
entry[:deletions] = changes[2].to_i unless changes[2].nil?
|
20
|
+
|
21
|
+
collection.push(entry)
|
30
22
|
end
|
31
23
|
|
32
24
|
collection
|