git-heatmap 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/Screenshot.png +0 -0
- data/lib/git/heatmap/commits.rb +30 -12
- data/lib/git/heatmap/templates/series.rb +7 -6
- data/lib/git/heatmap/templates/series/main.css +4 -0
- data/lib/git/heatmap/templates/series/template.trenni +2 -2
- data/lib/git/heatmap/version.rb +23 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8764bb0188dcd5f4b9b153940a3a5e074447b418e6de705a95638a013fb8845
|
4
|
+
data.tar.gz: 56679e70910bc167fa99c505b48b27247c77c4bb129d2b5d388b3f5ed0ee5250
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bfcdb43d912ee98518ed270dbea47f99ffeca4f68d7c70d403cdd0610ab5d402f594a139ddb1f0149832b8b1022bafe012530f13ad5b4d6a2b7330d210b5348
|
7
|
+
data.tar.gz: 5d60ca821d0554f96ff065b9285b0f22d5cd6f048e263aec189e8225efc20ffa52d171122f4cf468d5d18d5eecaeee29d22c70154654a7bc91b93b52593d56bc
|
data/README.md
CHANGED
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
Visualise git history over time.
|
4
4
|
|
5
|
-
|
5
|
+
![A screenshot of the visualisation](Screenshot.png)
|
6
|
+
|
7
|
+
[![Build Status](https://secure.travis-ci.org/ioquatix/git-heatmap.svg)](http://travis-ci.org/ioquatix/git-heatmap)
|
6
8
|
|
7
9
|
## Installation
|
8
10
|
|
data/Screenshot.png
ADDED
Binary file
|
data/lib/git/heatmap/commits.rb
CHANGED
@@ -33,6 +33,10 @@ module Git
|
|
33
33
|
@latest_commit_at = nil
|
34
34
|
|
35
35
|
@maximum = 0
|
36
|
+
|
37
|
+
@additions = Hash.new{|h,k| h[k] = 0}
|
38
|
+
@deletions = Hash.new{|h,k| h[k] = 0}
|
39
|
+
@churn = Hash.new{|h,k| h[k] = 0}
|
36
40
|
end
|
37
41
|
|
38
42
|
attr :commits
|
@@ -41,25 +45,38 @@ module Git
|
|
41
45
|
attr :earliest_commit_at
|
42
46
|
attr :latest_commit_at
|
43
47
|
|
48
|
+
attr :additions
|
49
|
+
attr :deletions
|
50
|
+
attr :churn
|
51
|
+
|
44
52
|
def size
|
45
53
|
@commits.size
|
46
54
|
end
|
47
55
|
|
48
56
|
attr :maximum
|
49
57
|
|
50
|
-
def
|
51
|
-
return if @commits.include?(commit.oid)
|
52
|
-
|
53
|
-
@commits[commit.oid] = commit
|
54
|
-
|
58
|
+
def add(commit, patch)
|
55
59
|
author = commit.author
|
56
60
|
time = author[:time]
|
57
61
|
key = @filter.key(time)
|
58
|
-
commits = (@periods[key] ||= [])
|
59
|
-
commits << commit
|
60
62
|
|
61
|
-
|
62
|
-
@
|
63
|
+
unless @commits.include?(commit.oid)
|
64
|
+
@commits[commit.oid] = commit
|
65
|
+
|
66
|
+
commits = (@periods[key] ||= [])
|
67
|
+
commits << commit
|
68
|
+
end
|
69
|
+
|
70
|
+
@additions[key] += patch.additions
|
71
|
+
@deletions[key] += patch.deletions
|
72
|
+
|
73
|
+
churn = patch.additions + patch.deletions.abs
|
74
|
+
@churn[key] += churn
|
75
|
+
|
76
|
+
total_churn = @churn[key]
|
77
|
+
|
78
|
+
if total_churn > @maximum
|
79
|
+
@maximum = total_churn
|
63
80
|
end
|
64
81
|
|
65
82
|
if @earliest_commit_at.nil? or time < @earliest_commit_at
|
@@ -114,9 +131,10 @@ module Git
|
|
114
131
|
|
115
132
|
if parent = commit.parents.first
|
116
133
|
# Documentation seems to imply this shouldn't be needed.
|
117
|
-
diff =
|
134
|
+
diff = parent.diff(commit.tree)
|
118
135
|
else
|
119
|
-
|
136
|
+
empty_tree = Rugged::Tree.empty(commit.tree.repo)
|
137
|
+
diff = empty_tree.diff(commit.tree)
|
120
138
|
end
|
121
139
|
|
122
140
|
author = commit.author
|
@@ -140,7 +158,7 @@ module Git
|
|
140
158
|
parts.pop # Remove file name
|
141
159
|
root = parts[0...@depth]
|
142
160
|
|
143
|
-
@directories[root]
|
161
|
+
@directories[root].add(commit, patch)
|
144
162
|
end
|
145
163
|
end
|
146
164
|
|
@@ -40,12 +40,13 @@ module Git
|
|
40
40
|
attr :commits
|
41
41
|
attr :title
|
42
42
|
|
43
|
-
def ramp(
|
44
|
-
|
45
|
-
|
46
|
-
#
|
47
|
-
# return
|
48
|
-
|
43
|
+
def ramp(i, max = commits.maximum)
|
44
|
+
x = i.to_f / max
|
45
|
+
|
46
|
+
# Smoothstep:
|
47
|
+
# return (3*x*x - 2*x*x*x)
|
48
|
+
|
49
|
+
return Math::sqrt(x)
|
49
50
|
end
|
50
51
|
|
51
52
|
def interpolate(t, x, y)
|
@@ -27,9 +27,9 @@
|
|
27
27
|
<li class="stats">
|
28
28
|
<?r commits.each_period do |period| ?>
|
29
29
|
<?r if period_commits = aggregate.periods[period]
|
30
|
-
size =
|
30
|
+
size = aggregate.churn[period]
|
31
31
|
?>
|
32
|
-
<a class="temperature box" style="background-color: #{background_color(size)}" title="#{period_commits.collect(&:oid).join(', ')}">#{size}</a>
|
32
|
+
<a class="temperature box" style="background-color: #{background_color(size)}" title="+#{aggregate.additions[period]}/-#{aggregate.deletions[period]} #{period_commits.collect(&:oid).join(', ')}">#{size}</a>
|
33
33
|
<?r else ?>
|
34
34
|
<div class="box"></div>
|
35
35
|
<?r end ?>
|
data/lib/git/heatmap/version.rb
CHANGED
@@ -1,5 +1,25 @@
|
|
1
|
+
# Copyright, 2019, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
# THE SOFTWARE.
|
20
|
+
|
1
21
|
module Git
|
2
|
-
|
3
|
-
|
4
|
-
|
22
|
+
module Heatmap
|
23
|
+
VERSION = "0.2.1"
|
24
|
+
end
|
5
25
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-heatmap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -122,6 +122,7 @@ files:
|
|
122
122
|
- Gemfile
|
123
123
|
- README.md
|
124
124
|
- Rakefile
|
125
|
+
- Screenshot.png
|
125
126
|
- bin/git-heatmap
|
126
127
|
- git-heatmap.gemspec
|
127
128
|
- lib/git/heatmap.rb
|
@@ -152,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
153
|
- !ruby/object:Gem::Version
|
153
154
|
version: '0'
|
154
155
|
requirements: []
|
155
|
-
rubygems_version: 3.0.
|
156
|
+
rubygems_version: 3.0.3
|
156
157
|
signing_key:
|
157
158
|
specification_version: 4
|
158
159
|
summary: Generate heatmap style visualisations based on git history.
|