gitlab_git 6.3.0 → 7.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,8 +16,9 @@ module Gitlab
16
16
  end
17
17
 
18
18
  def files_count
19
- args = [ref, '-r', '--name-only' ]
20
- repo.git.native(:ls_tree, {}, args).split("\n").count
19
+ index = repo.rugged.index
20
+ index.read_tree(repo.rugged.head.target.tree)
21
+ index.count
21
22
  end
22
23
 
23
24
  def authors_count
@@ -31,21 +32,26 @@ module Gitlab
31
32
  protected
32
33
 
33
34
  def collect_authors
34
- shortlog = repo.git.shortlog({e: true, s: true }, ref)
35
+ commits = repo.log(ref: ref, limit: 0)
36
+
37
+ author_stats = {}
38
+ commits.each do |commit|
39
+ if author_stats.key?(commit.author[:name])
40
+ author_stats[commit.author[:name]][:count] += 1
41
+ else
42
+ author_stats[commit.author[:name]] = {
43
+ email: commit.author[:email],
44
+ count: 1
45
+ }
46
+ end
47
+ end
35
48
 
36
49
  authors = []
37
-
38
- lines = shortlog.split("\n")
39
-
40
- lines.each do |line|
41
- data = line.split("\t")
42
- commits = data.first
43
- author = Grit::Actor.from_string(data.last)
44
-
50
+ author_stats.each do |author_name, info|
45
51
  authors << OpenStruct.new(
46
- name: author.name,
47
- email: author.email,
48
- commits: commits.to_i
52
+ name: author_name,
53
+ email: info[:email],
54
+ commits: info[:count]
49
55
  )
50
56
  end
51
57
 
@@ -54,8 +60,7 @@ module Gitlab
54
60
 
55
61
  def build_graph(n = 4)
56
62
  from, to = (Date.today.prev_day(n*7)), Date.today
57
- args = ['--all', "--since=#{from.to_s}", '--format=%ad' ]
58
- rev_list = repo.git.native(:rev_list, {}, args).split("\n")
63
+ rev_list = repo.commits_since(from)
59
64
 
60
65
  commits_dates = rev_list.values_at(* rev_list.each_index.select {|i| i.odd?})
61
66
  commits_dates = commits_dates.map { |date_str| Time.parse(date_str).to_date.to_s }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab_git
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.3.0
4
+ version: 7.0.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitriy Zaporozhets
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-23 00:00:00.000000000 Z
11
+ date: 2014-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gitlab-linguist
@@ -25,61 +25,61 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: gitlab-grit
28
+ name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.6'
33
+ version: '4.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.6'
40
+ version: '4.0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: activesupport
42
+ name: rugged
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '4.0'
47
+ version: 0.21.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '4.0'
54
+ version: 0.21.0
55
55
  - !ruby/object:Gem::Dependency
56
- name: rugged
56
+ name: charlock_holmes
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.21.0
61
+ version: '0.6'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.21.0
68
+ version: '0.6'
69
69
  - !ruby/object:Gem::Dependency
70
- name: charlock_holmes
70
+ name: rubyzip
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0.6'
75
+ version: '1.1'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0.6'
82
+ version: '1.1'
83
83
  description: GitLab wrapper around git objects
84
84
  email: dmitriy.zaporozhets@gmail.com
85
85
  executables: []
@@ -93,6 +93,7 @@ files:
93
93
  - lib/gitlab_git/blob_snippet.rb
94
94
  - lib/gitlab_git/branch.rb
95
95
  - lib/gitlab_git/commit.rb
96
+ - lib/gitlab_git/commit_stats.rb
96
97
  - lib/gitlab_git/compare.rb
97
98
  - lib/gitlab_git/diff.rb
98
99
  - lib/gitlab_git/encoding_helper.rb
@@ -119,9 +120,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
120
  version: '0'
120
121
  required_rubygems_version: !ruby/object:Gem::Requirement
121
122
  requirements:
122
- - - ">="
123
+ - - ">"
123
124
  - !ruby/object:Gem::Version
124
- version: '0'
125
+ version: 1.3.1
125
126
  requirements: []
126
127
  rubyforge_project:
127
128
  rubygems_version: 2.2.2