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 +4 -4
- data/VERSION +1 -1
- data/lib/gitlab_git.rb +1 -1
- data/lib/gitlab_git/blame.rb +10 -8
- data/lib/gitlab_git/commit.rb +15 -0
- data/lib/gitlab_git/{encoding_herlper.rb → encoding_helper.rb} +0 -0
- data/lib/gitlab_git/ref.rb +2 -0
- data/lib/gitlab_git/repository.rb +11 -3
- data/lib/gitlab_git/tag.rb +6 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f512e6aa7aeac3ab0fd43175bc3d53e50f510776
|
4
|
+
data.tar.gz: 4949e60987b1dbe296a97d0a041a09091cd1cf44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b4d0e7beb1942463241b37cee1e02c719a0a8cbfca5f5d5a1920d91b47ab4f2be781dd0f33e33ff312b31154162cc3219e465375ee6c56fa0242b5b32980eaf
|
7
|
+
data.tar.gz: a370d903817cfc3f8893741ddd042cee6d74482cfcfaed36d35e257223bf7efa846104c2fd5da75a84da2a737140b482debed0b79a4f76a34eb44f1339d44a08
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
6.
|
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
|
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"
|
data/lib/gitlab_git/blame.rb
CHANGED
@@ -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
|
-
@
|
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
|
-
|
13
|
+
@blame.each do |blame|
|
14
|
+
from = blame[:final_start_line_number] - 1
|
15
|
+
commit = @repo.lookup(blame[:final_commit_id])
|
12
16
|
|
13
|
-
|
14
|
-
|
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
|
data/lib/gitlab_git/commit.rb
CHANGED
@@ -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
|
File without changes
|
data/lib/gitlab_git/ref.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
# Gitlab::Git::
|
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 '
|
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
|
-
|
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
|
|
data/lib/gitlab_git/tag.rb
CHANGED
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.
|
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:
|
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.
|
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.
|
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/
|
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
|