gitlab_git 2.0.0.beta → 2.0.0.pre
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 +1 -2
- data/lib/gitlab_git/log_parser.rb +22 -14
- 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: 0725f82100a19e889e298d9547374c6f2aa447e4
|
4
|
+
data.tar.gz: 885471b182cd540905c1c60e7a50ac56304e4cce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed5d10618f109693809cef7d4de650c2ed187764ef33f2bf0c73b8a3ff46dde815191699318ef9be4fdfaa0d4980bc117750e64eb4c66de221daea891e3ac95e
|
7
|
+
data.tar.gz: 5a8a963698a50196d6fcb1474dbc2e9a387699fefd71c8d85c2fe750b11850cf91c785f6e1242c2b81c306a2e27535a5bf77fa81a4e76e00d718f8604c5fcb1d
|
data/lib/gitlab_git/git_stats.rb
CHANGED
@@ -10,8 +10,7 @@ module Gitlab
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def log
|
13
|
-
|
14
|
-
args = ['--format=%aN%x0a%aE%x0a%ad', '--date=short', '--shortstat', '--no-merges', '--max-count=8000']
|
13
|
+
args = ['--format=%aN%x0a%ad', '--date=short', '--shortstat', '--no-merges']
|
15
14
|
repo.git.run(nil, 'log', nil, {}, args)
|
16
15
|
rescue Grit::Git::GitTimeout
|
17
16
|
nil
|
@@ -2,23 +2,31 @@ 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
|
-
|
7
|
-
def self.parse_log(log_from_git)
|
5
|
+
# Data model: {author, date, additions, deletions}
|
6
|
+
def self.parse_log log_from_git
|
8
7
|
log = log_from_git.split("\n")
|
9
|
-
collection = []
|
10
|
-
|
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
8
|
|
17
|
-
|
18
|
-
|
19
|
-
|
9
|
+
i = 0
|
10
|
+
collection = []
|
11
|
+
entry = {}
|
20
12
|
|
21
|
-
|
13
|
+
while i <= log.size do
|
14
|
+
pos = i % 4
|
15
|
+
case pos
|
16
|
+
when 0
|
17
|
+
unless i == 0
|
18
|
+
collection.push(entry)
|
19
|
+
entry = {}
|
20
|
+
end
|
21
|
+
entry[:author] = log[i].to_s
|
22
|
+
when 1
|
23
|
+
entry[:date] = log[i].to_s
|
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
|
22
30
|
end
|
23
31
|
|
24
32
|
collection
|