gitlab_git 2.0.0.beta → 2.0.0.pre

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 721ce63ea203619c49c42fd796634d7076ebad3b
4
- data.tar.gz: 3d7ac5846bc15878beddfedb4bc8378048359d43
3
+ metadata.gz: 0725f82100a19e889e298d9547374c6f2aa447e4
4
+ data.tar.gz: 885471b182cd540905c1c60e7a50ac56304e4cce
5
5
  SHA512:
6
- metadata.gz: 216f0f37fa7f9b38ce2bf9710ed9773210af4128e6f874124f0c5e26865fcf9739ef8d38cddea671c05c195fe7021dd4287a1d8f2511f8618400539e1833c799
7
- data.tar.gz: 4df9626fbf0a5c1c18d603d64bc93fa7a998dccddaac7ae424461bbf36fc11b0f9e73f7817f6beb456cb43fcb89e2d124da2d1fe439e00a08f5676adf146235f
6
+ metadata.gz: ed5d10618f109693809cef7d4de650c2ed187764ef33f2bf0c73b8a3ff46dde815191699318ef9be4fdfaa0d4980bc117750e64eb4c66de221daea891e3ac95e
7
+ data.tar.gz: 5a8a963698a50196d6fcb1474dbc2e9a387699fefd71c8d85c2fe750b11850cf91c785f6e1242c2b81c306a2e27535a5bf77fa81a4e76e00d718f8604c5fcb1d
@@ -10,8 +10,7 @@ module Gitlab
10
10
  end
11
11
 
12
12
  def log
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']
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
- # {author_name, author_email, date, additions, deletions}
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
- 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?
9
+ i = 0
10
+ collection = []
11
+ entry = {}
20
12
 
21
- collection.push(entry)
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
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.beta
4
+ version: 2.0.0.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitriy Zaporozhets