rjgit 5.6.1.0 → 5.9.0.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/Gemfile +1 -1
- data/README.md +1 -0
- data/lib/actor.rb +10 -3
- data/lib/java/jars/org.eclipse.jgit-5.9.0.202009080501-r.jar +0 -0
- data/lib/java/jars/org.eclipse.jgit.ssh.jsch-5.8.0.202006091008-r.jar +0 -0
- data/lib/rjgit.rb +57 -0
- data/lib/version.rb +1 -1
- metadata +6 -5
- data/lib/java/jars/org.eclipse.jgit-5.6.1.202002131546-r.jar +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b28d35d4c9ea97c5a4ea28b0a62b7374daea6a7a0fd906cfbefbcb986ac37aa
|
4
|
+
data.tar.gz: dceb29a1d1e1d20f93a43c71b08ba02d7f23d1f2c8dd92c43a8bf810594dba19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3ab922915d8f98e59757c853277f96273871c867d3f7eda3e2bec4f3d65fb6ec142fdab92fd9df60df3a7ffb6c010482d98ad2c9ac0b3b511a14cd469a5e2fc
|
7
|
+
data.tar.gz: c1ac638be7e459f8ab20364ec89c75e6da40d9fa81cd184c7c28f3aaa898c8953b2c62f7f63b52294d38f488ee932944ac6dd707ae74474c0e5e1d83bfa639c3
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -6,6 +6,7 @@ RJGit
|
|
6
6
|
[](https://travis-ci.org/repotag/rjgit)
|
7
7
|
[](https://coveralls.io/r/repotag/rjgit)
|
8
8
|
[](http://badge.fury.io/rb/rjgit)
|
9
|
+
[](https://dometto-cuttingedge.herokuapp.com/github/repotag/rjgit/info)
|
9
10
|
|
10
11
|
Summary
|
11
12
|
-------
|
data/lib/actor.rb
CHANGED
@@ -2,6 +2,7 @@ module RJGit
|
|
2
2
|
|
3
3
|
# PersonIdent in JGit
|
4
4
|
import 'org.eclipse.jgit.lib.PersonIdent'
|
5
|
+
import 'java.util.TimeZone'
|
5
6
|
|
6
7
|
class Actor
|
7
8
|
|
@@ -17,10 +18,11 @@ module RJGit
|
|
17
18
|
return self.new(name, email)
|
18
19
|
end
|
19
20
|
|
20
|
-
def initialize(name, email)
|
21
|
+
def initialize(name, email, time = nil)
|
21
22
|
@name = name
|
22
23
|
@email = email
|
23
|
-
@
|
24
|
+
@time = time
|
25
|
+
@person_ident = @time ? PersonIdent.new(name, email, time.to_java, TimeZone.getTimeZone(time.zone)) : PersonIdent.new(name, email)
|
24
26
|
end
|
25
27
|
|
26
28
|
# Create an Actor from a string.
|
@@ -43,7 +45,8 @@ module RJGit
|
|
43
45
|
# time - The Time the commit was authored or committed.
|
44
46
|
#
|
45
47
|
# Returns a String.
|
46
|
-
def output(time)
|
48
|
+
def output(time = nil)
|
49
|
+
time = time || self.time
|
47
50
|
offset = time.utc_offset / 60
|
48
51
|
"%s <%s> %d %+.2d%.2d" % [
|
49
52
|
@name,
|
@@ -52,6 +55,10 @@ module RJGit
|
|
52
55
|
offset / 60,
|
53
56
|
offset.abs % 60]
|
54
57
|
end
|
58
|
+
|
59
|
+
def time
|
60
|
+
Time.at(@person_ident.getWhen.getTime/1000)
|
61
|
+
end
|
55
62
|
|
56
63
|
end
|
57
64
|
|
Binary file
|
Binary file
|
data/lib/rjgit.rb
CHANGED
@@ -27,12 +27,17 @@ module RJGit
|
|
27
27
|
|
28
28
|
module Porcelain
|
29
29
|
|
30
|
+
import 'java.io.IOException'
|
30
31
|
import 'org.eclipse.jgit.lib.Constants'
|
31
32
|
import 'org.eclipse.jgit.api.AddCommand'
|
32
33
|
import 'org.eclipse.jgit.api.CommitCommand'
|
33
34
|
import 'org.eclipse.jgit.api.BlameCommand'
|
35
|
+
import 'org.eclipse.jgit.api.errors.RefNotFoundException'
|
34
36
|
import 'org.eclipse.jgit.blame.BlameGenerator'
|
35
37
|
import 'org.eclipse.jgit.blame.BlameResult'
|
38
|
+
import 'org.eclipse.jgit.errors.IncorrectObjectTypeException'
|
39
|
+
import 'org.eclipse.jgit.errors.InvalidPatternException'
|
40
|
+
import 'org.eclipse.jgit.errors.MissingObjectException'
|
36
41
|
import 'org.eclipse.jgit.treewalk.CanonicalTreeParser'
|
37
42
|
import 'org.eclipse.jgit.diff.DiffFormatter'
|
38
43
|
|
@@ -163,6 +168,58 @@ module RJGit
|
|
163
168
|
RJGit.convert_diff_entries(diff_entries)
|
164
169
|
end
|
165
170
|
|
171
|
+
def self.describe(repository, ref, options = {})
|
172
|
+
options = {:always => false, :long => false, :tags => false, :match => []}.merge(options)
|
173
|
+
repo = RJGit.repository_type(repository)
|
174
|
+
git = RubyGit.new(repo).jgit
|
175
|
+
command = git.describe.
|
176
|
+
set_always(options[:always]).
|
177
|
+
set_long(options[:long]).
|
178
|
+
set_tags(options[:tags])
|
179
|
+
begin
|
180
|
+
command = command.set_target(ref)
|
181
|
+
rescue IncorrectObjectTypeException, IOException, MissingObjectException, RefNotFoundException
|
182
|
+
return nil
|
183
|
+
end
|
184
|
+
options[:match].each do |match|
|
185
|
+
begin
|
186
|
+
command = command.set_match(match)
|
187
|
+
rescue InvalidPatternException
|
188
|
+
return nil
|
189
|
+
end
|
190
|
+
end
|
191
|
+
command.call
|
192
|
+
end
|
193
|
+
|
194
|
+
# options:
|
195
|
+
# * ref
|
196
|
+
# * path_filter
|
197
|
+
# * case_insensitive
|
198
|
+
def self.grep(repository, query, options={})
|
199
|
+
case_insensitive = options[:case_insensitive]
|
200
|
+
repo = RJGit.repository_type(repository)
|
201
|
+
walk = RevWalk.new(repo)
|
202
|
+
ls_tree_options = {:recursive => true, :path_filter => options[:path_filter]}
|
203
|
+
|
204
|
+
query = case query
|
205
|
+
when Regexp then query
|
206
|
+
when String then Regexp.new(Regexp.escape(query))
|
207
|
+
else raise "A #{query.class} was passed to #{self}.grep(). Only Regexps and Strings are supported!"
|
208
|
+
end
|
209
|
+
|
210
|
+
query = Regexp.new(query.source, query.options | Regexp::IGNORECASE) if case_insensitive
|
211
|
+
|
212
|
+
ls_tree(repo, nil, options.fetch(:ref, 'HEAD'), ls_tree_options).each_with_object({}) do |item, result|
|
213
|
+
blob = Blob.new(repo, item[:mode], item[:path], walk.lookup_blob(ObjectId.from_string(item[:id])))
|
214
|
+
next if blob.binary?
|
215
|
+
|
216
|
+
rows = blob.data.split("\n")
|
217
|
+
data = rows.grep(query)
|
218
|
+
next if data.empty?
|
219
|
+
|
220
|
+
result[blob.path] = data
|
221
|
+
end
|
222
|
+
end
|
166
223
|
end
|
167
224
|
|
168
225
|
module Plumbing
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rjgit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.9.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maarten Engelen
|
@@ -12,14 +12,14 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2020-
|
15
|
+
date: 2020-11-02 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
requirement: !ruby/object:Gem::Requirement
|
19
19
|
requirements:
|
20
20
|
- - "~>"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '3.3'
|
23
23
|
name: mime-types
|
24
24
|
prerelease: false
|
25
25
|
type: :runtime
|
@@ -27,7 +27,7 @@ dependencies:
|
|
27
27
|
requirements:
|
28
28
|
- - "~>"
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
version: '
|
30
|
+
version: '3.3'
|
31
31
|
description: JRuby wrapper around the JGit library for manipulating git repositories
|
32
32
|
in code.
|
33
33
|
email: repotag-dev@googlegroups.com
|
@@ -49,7 +49,8 @@ files:
|
|
49
49
|
- lib/java/jars/bcpkix-jdk15on-161.jar
|
50
50
|
- lib/java/jars/bcprov-jdk15on-161.jar
|
51
51
|
- lib/java/jars/jsch-0.1.54.jar
|
52
|
-
- lib/java/jars/org.eclipse.jgit-5.
|
52
|
+
- lib/java/jars/org.eclipse.jgit-5.9.0.202009080501-r.jar
|
53
|
+
- lib/java/jars/org.eclipse.jgit.ssh.jsch-5.8.0.202006091008-r.jar
|
53
54
|
- lib/java/jars/slf4j-api-1.7.2.jar
|
54
55
|
- lib/java/jars/slf4j-simple-1.7.12.jar
|
55
56
|
- lib/repo.rb
|
Binary file
|