rjgit 0.3.8 → 0.3.9
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/commit.rb +29 -3
- data/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85c0a3a90f26f105a97cc8c2e8c1635102f5ea47
|
4
|
+
data.tar.gz: 653c8baf0fc37d38abbdd142247419a91e1def7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37fcd607f511dfe10409215b850b07c035771a9fa5067a2af45669d0c7e199388c403d954aae10493c116c6150cadf31a9bed0f5dd2c1153f91ca28f5dc649d8
|
7
|
+
data.tar.gz: cb431171a963dd00b98fc25b05890c29db6d2dfd0fed90a06618af8af216826f328ef86c3903e3985a6b1d6500f270afa501293b22b01db56e48c1cecf121707
|
data/lib/commit.rb
CHANGED
@@ -2,6 +2,8 @@ module RJGit
|
|
2
2
|
|
3
3
|
import 'org.eclipse.jgit.revwalk.RevWalk'
|
4
4
|
import 'org.eclipse.jgit.revwalk.RevCommit'
|
5
|
+
import 'org.eclipse.jgit.diff.DiffFormatter'
|
6
|
+
import 'org.eclipse.jgit.util.io.DisabledOutputStream'
|
5
7
|
|
6
8
|
class Commit
|
7
9
|
|
@@ -38,7 +40,32 @@ module RJGit
|
|
38
40
|
def parents
|
39
41
|
@parents ||= @jcommit.get_parents.map {|parent| Commit.new(@jrepo, parent)}
|
40
42
|
end
|
41
|
-
|
43
|
+
|
44
|
+
def stats
|
45
|
+
df = DiffFormatter.new(DisabledOutputStream::INSTANCE)
|
46
|
+
df.set_repository(@jrepo)
|
47
|
+
df.set_context(0)
|
48
|
+
entries = df.scan(@jcommit.get_parents[0], @jcommit)
|
49
|
+
results = {}
|
50
|
+
total_del = 0
|
51
|
+
total_ins = 0
|
52
|
+
entries.each do |entry|
|
53
|
+
file = df.toFileHeader(entry)
|
54
|
+
del = 0
|
55
|
+
ins = 0
|
56
|
+
file.getHunks.each do |hunk|
|
57
|
+
hunk.toEditList.each do |edit|
|
58
|
+
del += edit.getEndA - edit.getBeginA
|
59
|
+
ins += edit.getEndB - edit.getBeginB
|
60
|
+
end
|
61
|
+
end
|
62
|
+
total_del += del
|
63
|
+
total_ins += ins
|
64
|
+
results[file.getNewPath] = [ins, del, ins + del]
|
65
|
+
end
|
66
|
+
return total_ins, total_del, results
|
67
|
+
end
|
68
|
+
|
42
69
|
# Pass an empty array for parents if the commit should have no parents
|
43
70
|
def self.new_with_tree(repository, tree, message, actor, parents = nil)
|
44
71
|
repository = RJGit.repository_type(repository)
|
@@ -76,7 +103,6 @@ module RJGit
|
|
76
103
|
|
77
104
|
def self.diff(repo, a, b = nil, paths = [], options = {})
|
78
105
|
end
|
79
|
-
|
80
|
-
|
106
|
+
|
81
107
|
end
|
82
108
|
end
|
data/lib/version.rb
CHANGED