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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0725f82100a19e889e298d9547374c6f2aa447e4
4
- data.tar.gz: 885471b182cd540905c1c60e7a50ac56304e4cce
3
+ metadata.gz: da25f5e49b2f2f7cacb78576ab4a3fde6bb0cf56
4
+ data.tar.gz: 340e2be3999981b3fa56bbbaa6c93fd47d0b5ff0
5
5
  SHA512:
6
- metadata.gz: ed5d10618f109693809cef7d4de650c2ed187764ef33f2bf0c73b8a3ff46dde815191699318ef9be4fdfaa0d4980bc117750e64eb4c66de221daea891e3ac95e
7
- data.tar.gz: 5a8a963698a50196d6fcb1474dbc2e9a387699fefd71c8d85c2fe750b11850cf91c785f6e1242c2b81c306a2e27535a5bf77fa81a4e76e00d718f8604c5fcb1d
6
+ metadata.gz: 4a44c137700945c9cb02b964ea79f886db546e7497c286be637ac3e6dcf0a5111ee6766bd9d77764516f625be9298364aa415f3578d9bdc65790707a460abe93
7
+ data.tar.gz: 435685c2c27baef6d6fb581ff3c35781bd7a4b356a1bee2ac44f9e84095cecc28f42f45c2cd0107a9d7ce98852e2ab67388a33c8f9a4180f6d69439bea8a93f4
@@ -10,7 +10,8 @@ module Gitlab
10
10
  end
11
11
 
12
12
  def log
13
- args = ['--format=%aN%x0a%ad', '--date=short', '--shortstat', '--no-merges']
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: {author, date, additions, deletions}
6
- def self.parse_log log_from_git
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
- 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
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab_git
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre
4
+ version: 2.0.0.pre2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitriy Zaporozhets