gitlab_git 2.1.1 → 2.2.0
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 +4 -4
- data/lib/gitlab_git/commit.rb +2 -2
- data/lib/gitlab_git/compare.rb +9 -10
- data/lib/gitlab_git/diff.rb +3 -3
- data/lib/gitlab_git/log_parser.rb +2 -2
- data/lib/gitlab_git/repository.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb3b53c4340fbb2ef002661f2da3ca9473ab4cc5
|
4
|
+
data.tar.gz: 57c1e77f61485b399d854d30465a74ffb3d88078
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30d11e36f05677cbcecd13f022b1f29dcd6ed8a6f879d4446be1128872caaca0ebf47b601d629cbbf7b89d161ae6be98ef54a492e7215842ddb34cd7ec8c2537
|
7
|
+
data.tar.gz: c6aeb4b21858ed9d599a585911c45f36a452fa2f2f63ca9ba012055bccb99f4fce576d6a9e8b71ed72f5fc301bbcfcbed30ae7ae02e4daac0b97701d64026326
|
data/lib/gitlab_git/commit.rb
CHANGED
@@ -85,8 +85,8 @@ module Gitlab
|
|
85
85
|
# Ex.
|
86
86
|
# Commit.between('29eda46b', 'master')
|
87
87
|
#
|
88
|
-
def between(repo,
|
89
|
-
repo.commits_between(
|
88
|
+
def between(repo, base, head)
|
89
|
+
repo.commits_between(base, head).map do |commit|
|
90
90
|
decorate(commit)
|
91
91
|
end
|
92
92
|
end
|
data/lib/gitlab_git/compare.rb
CHANGED
@@ -3,30 +3,29 @@ module Gitlab
|
|
3
3
|
class Compare
|
4
4
|
attr_accessor :commits, :commit, :diffs, :same
|
5
5
|
|
6
|
-
def initialize(repository, from, to)
|
6
|
+
def initialize(repository, from, to, limit = 100)
|
7
7
|
@commits, @diffs = [], []
|
8
8
|
@commit = nil
|
9
9
|
@same = false
|
10
10
|
|
11
11
|
return unless from && to
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
base = Gitlab::Git::Commit.find(repository, from.try(:strip))
|
14
|
+
head = Gitlab::Git::Commit.find(repository, to.try(:strip))
|
15
15
|
|
16
|
-
return unless
|
16
|
+
return unless base && head
|
17
17
|
|
18
|
-
if
|
18
|
+
if base.id == head.id
|
19
19
|
@same = true
|
20
20
|
return
|
21
21
|
end
|
22
22
|
|
23
|
-
@commit =
|
24
|
-
@commits =
|
25
|
-
|
26
|
-
@diffs = if @commits.size > 100
|
23
|
+
@commit = head
|
24
|
+
@commits = Gitlab::Git::Commit.between(repository, base.id, head.id)
|
25
|
+
@diffs = if @commits.size > limit
|
27
26
|
[]
|
28
27
|
else
|
29
|
-
|
28
|
+
Gitlab::Git::Diff.between(repository, head.id, base.id) rescue []
|
30
29
|
end
|
31
30
|
end
|
32
31
|
end
|
data/lib/gitlab_git/diff.rb
CHANGED
@@ -15,13 +15,13 @@ module Gitlab
|
|
15
15
|
attr_accessor :new_file, :renamed_file, :deleted_file
|
16
16
|
|
17
17
|
class << self
|
18
|
-
def between(repo,
|
18
|
+
def between(repo, head, base)
|
19
19
|
# Only show what is new in the source branch compared to the target branch, not the other way around.
|
20
20
|
# The linex below with merge_base is equivalent to diff with three dots (git diff branch1...branch2)
|
21
21
|
# From the git documentation: "git diff A...B" is equivalent to "git diff $(git-merge-base A B) B"
|
22
|
-
common_commit = repo.merge_base_commit(
|
22
|
+
common_commit = repo.merge_base_commit(head, base)
|
23
23
|
|
24
|
-
repo.diff(common_commit,
|
24
|
+
repo.diff(common_commit, head).map do |diff|
|
25
25
|
Gitlab::Git::Diff.new(diff)
|
26
26
|
end
|
27
27
|
rescue Grit::Git::GitTimeout
|
@@ -10,8 +10,8 @@ module Gitlab
|
|
10
10
|
|
11
11
|
log.each_slice(5) do |slice|
|
12
12
|
entry = {}
|
13
|
-
entry[:author_name] = slice[0]
|
14
|
-
entry[:author_email] = slice[1]
|
13
|
+
entry[:author_name] = slice[0].force_encoding('UTF-8')
|
14
|
+
entry[:author_email] = slice[1].force_encoding('UTF-8')
|
15
15
|
entry[:date] = slice[2]
|
16
16
|
|
17
17
|
if slice[4]
|
@@ -28,8 +28,8 @@ module Gitlab
|
|
28
28
|
# compatibility
|
29
29
|
alias_method :repo, :raw
|
30
30
|
|
31
|
-
def initialize(path_with_namespace, root_ref
|
32
|
-
@root_ref = root_ref ||
|
31
|
+
def initialize(path_with_namespace, root_ref)
|
32
|
+
@root_ref = root_ref || raw.head.name
|
33
33
|
@path_with_namespace = path_with_namespace
|
34
34
|
|
35
35
|
# Init grit repo object
|
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: 2.
|
4
|
+
version: 2.2.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: 2013-
|
11
|
+
date: 2013-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: github-linguist
|