gitlab_git 6.2.2 → 6.3.0

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: d94dbbdaea6c14edfa048c5930d03fbdebc4d1b0
4
- data.tar.gz: 31dbfbc4ea14ba40215166478e1d8faa818ec6fb
3
+ metadata.gz: f512e6aa7aeac3ab0fd43175bc3d53e50f510776
4
+ data.tar.gz: 4949e60987b1dbe296a97d0a041a09091cd1cf44
5
5
  SHA512:
6
- metadata.gz: b7053dab7208ea7d2495c7d88cd7a018494fc55a493315cc2e4f5a99582f774265a22bc5991a4a2153127a7ad3f1f9d788eb15f2677948e543cd1100cab173d1
7
- data.tar.gz: 5ae987f97a3bf7cedbc4b833785bddbf57dac8385d54267c085a293019853d979936403bbc3e9d58ca1915e7c62822f9ae1e0ec94dcbc21e649f84bf3cfbac7d
6
+ metadata.gz: 9b4d0e7beb1942463241b37cee1e02c719a0a8cbfca5f5d5a1920d91b47ab4f2be781dd0f33e33ff312b31154162cc3219e465375ee6c56fa0242b5b32980eaf
7
+ data.tar.gz: a370d903817cfc3f8893741ddd042cee6d74482cfcfaed36d35e257223bf7efa846104c2fd5da75a84da2a737140b482debed0b79a4f76a34eb44f1339d44a08
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.2.2
1
+ 6.3.0
data/lib/gitlab_git.rb CHANGED
@@ -16,7 +16,7 @@ end
16
16
 
17
17
  # Gitlab::Git
18
18
  require_relative "gitlab_git/popen"
19
- require_relative "gitlab_git/encoding_herlper"
19
+ require_relative 'gitlab_git/encoding_helper'
20
20
  require_relative "gitlab_git/blame"
21
21
  require_relative "gitlab_git/blob"
22
22
  require_relative "gitlab_git/commit"
@@ -1,20 +1,22 @@
1
1
  module Gitlab
2
2
  module Git
3
3
  class Blame
4
- attr_accessor :repository, :sha, :path
5
4
 
6
5
  def initialize(repository, sha, path)
7
- @repository, @sha, @path = repository, sha, path
6
+ @repo = repository.rugged
7
+ @blame = Rugged::Blame.new(@repo, path)
8
+ @blob = @repo.blob_at(sha, path)
9
+ @lines = @blob.content.split("\n")
8
10
  end
9
11
 
10
12
  def each
11
- raw_blame = Grit::Blob.blame(repository.raw, sha, path)
13
+ @blame.each do |blame|
14
+ from = blame[:final_start_line_number] - 1
15
+ commit = @repo.lookup(blame[:final_commit_id])
12
16
 
13
- raw_blame.each do |commit, lines|
14
- next unless commit
15
-
16
- commit = Gitlab::Git::Commit.new(commit)
17
- yield(commit, lines)
17
+ yield(Gitlab::Git::Commit.new(commit),
18
+ @lines[from, blame[:lines_in_hunk]] || [],
19
+ blame[:final_start_line_number])
18
20
  end
19
21
  end
20
22
  end
@@ -95,6 +95,8 @@ module Gitlab
95
95
 
96
96
  if raw_commit.is_a?(Hash)
97
97
  init_from_hash(raw_commit)
98
+ elsif raw_commit.is_a?(Rugged::Commit)
99
+ init_from_rugged(raw_commit)
98
100
  else
99
101
  init_from_grit(raw_commit)
100
102
  end
@@ -225,6 +227,19 @@ module Gitlab
225
227
  end
226
228
  end
227
229
 
230
+ def init_from_rugged(commit)
231
+ @raw_commit = commit
232
+ @id = commit.oid
233
+ @message = commit.message
234
+ @authored_date = commit.author[:time]
235
+ @committed_date = commit.committer[:time]
236
+ @author_name = commit.author[:name]
237
+ @author_email = commit.author[:email]
238
+ @committer_name = commit.committer[:name]
239
+ @committer_email = commit.committer[:email]
240
+ @parent_ids = commit.parents.map(&:oid)
241
+ end
242
+
228
243
  def serialize_keys
229
244
  SERIALIZE_KEYS
230
245
  end
@@ -24,6 +24,8 @@ module Gitlab
24
24
  target.oid
25
25
  elsif target.respond_to?(:name)
26
26
  target.name
27
+ elsif target.is_a? String
28
+ target
27
29
  else
28
30
  nil
29
31
  end
@@ -1,7 +1,7 @@
1
- # Gitlab::Git::Commit is a wrapper around native Grit::Repository object
1
+ # Gitlab::Git::Repository is a wrapper around native Grit::Repository object
2
2
  # We dont want to use grit objects inside app/
3
3
  # It helps us easily migrate to rugged in future
4
- require_relative 'encoding_herlper'
4
+ require_relative 'encoding_helper'
5
5
  require 'tempfile'
6
6
 
7
7
  module Gitlab
@@ -72,7 +72,15 @@ module Gitlab
72
72
  rugged.refs.select do |ref|
73
73
  ref.name =~ /\Arefs\/tags/
74
74
  end.map do |rugged_ref|
75
- Tag.new(rugged_ref.name, rugged_ref.target)
75
+ target = rugged_ref.target
76
+ message = nil
77
+ if rugged_ref.target.is_a?(Rugged::Tag::Annotation) &&
78
+ rugged_ref.target.target.is_a?(Rugged::Commit)
79
+ unless rugged_ref.target.target.message == rugged_ref.target.message
80
+ message = rugged_ref.target.message.chomp
81
+ end
82
+ end
83
+ Tag.new(rugged_ref.name, target, message)
76
84
  end.sort_by(&:name)
77
85
  end
78
86
 
@@ -1,6 +1,12 @@
1
1
  module Gitlab
2
2
  module Git
3
3
  class Tag < Ref
4
+ attr_reader :message
5
+
6
+ def initialize(name, target, message = nil)
7
+ super(name, target)
8
+ @message = message
9
+ end
4
10
  end
5
11
  end
6
12
  end
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.2.2
4
+ version: 6.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitriy Zaporozhets
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-05 00:00:00.000000000 Z
11
+ date: 2014-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gitlab-linguist
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.21.2
61
+ version: 0.21.0
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.2
68
+ version: 0.21.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: charlock_holmes
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -95,7 +95,7 @@ files:
95
95
  - lib/gitlab_git/commit.rb
96
96
  - lib/gitlab_git/compare.rb
97
97
  - lib/gitlab_git/diff.rb
98
- - lib/gitlab_git/encoding_herlper.rb
98
+ - lib/gitlab_git/encoding_helper.rb
99
99
  - lib/gitlab_git/git_stats.rb
100
100
  - lib/gitlab_git/log_parser.rb
101
101
  - lib/gitlab_git/popen.rb