git_evolution 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile.lock +63 -65
- data/README.md +117 -10
- data/git_evolution.gemspec +2 -2
- data/lib/git_evolution/version.rb +1 -1
- data/pkg/git_evolution-0.2.0.gem +0 -0
- data/spec/git_evolution/option_handler_spec.rb +1 -1
- metadata +13 -15
- data/pkg/git_evolution-0.1.1.gem +0 -0
- data/pkg/git_evolution-0.1.2.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e0bd6b1c75dbdcdb797f06ede7c13d1d29773e45a5d58d6da9a37d517923bd21
|
4
|
+
data.tar.gz: 46c9a69248d5a54e6c0b64a65ef0b5b2e663bf1820331006b09e6734233c5e0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f861946d477729dfd2728da7ca9559c8c87fef3ee6095e4125d36c8b6ba393337e22febb438d51479bc00a49f3d98c86a77b0bb2af63dd7c362334b9b4b113bd
|
7
|
+
data.tar.gz: c3e894fc42ca0e4060fdc7560ffa1a341575ed7a8c52e3281653f41dd5d7cb7dce61f02f622719d667946a5389a57b57d75007c7c6e38438ed9697fb2ea4ad8f
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
git_evolution (0.
|
5
|
-
bundler (~>
|
4
|
+
git_evolution (0.2.0)
|
5
|
+
bundler (~> 2.0)
|
6
6
|
chronic (~> 0.10.0)
|
7
7
|
rake (~> 10.0)
|
8
8
|
rugged (~> 0.21.0)
|
@@ -10,75 +10,70 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
ast (2.
|
14
|
-
|
15
|
-
parser (>= 2.2.0.pre.3, < 3.0)
|
16
|
-
byebug (3.5.1)
|
17
|
-
columnize (~> 0.8)
|
18
|
-
debugger-linecache (~> 1.2)
|
19
|
-
slop (~> 3.6)
|
13
|
+
ast (2.4.0)
|
14
|
+
byebug (11.0.1)
|
20
15
|
chronic (0.10.2)
|
21
|
-
coderay (1.1.
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
method_source (0.
|
33
|
-
mime-types (
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
16
|
+
coderay (1.1.2)
|
17
|
+
coveralls (0.7.2)
|
18
|
+
multi_json (~> 1.3)
|
19
|
+
rest-client (= 1.6.7)
|
20
|
+
simplecov (>= 0.7)
|
21
|
+
term-ansicolor (= 1.2.2)
|
22
|
+
thor (= 0.18.1)
|
23
|
+
diff-lcs (1.3)
|
24
|
+
docile (1.3.2)
|
25
|
+
jaro_winkler (1.5.4)
|
26
|
+
json (2.2.0)
|
27
|
+
method_source (0.9.2)
|
28
|
+
mime-types (3.3)
|
29
|
+
mime-types-data (~> 3.2015)
|
30
|
+
mime-types-data (3.2019.1009)
|
31
|
+
multi_json (1.14.1)
|
32
|
+
parallel (1.18.0)
|
33
|
+
parser (2.6.5.0)
|
34
|
+
ast (~> 2.4.0)
|
35
|
+
pry (0.12.2)
|
40
36
|
coderay (~> 1.1.0)
|
41
|
-
method_source (~> 0.
|
42
|
-
|
43
|
-
|
44
|
-
byebug (~> 3.4)
|
37
|
+
method_source (~> 0.9.0)
|
38
|
+
pry-byebug (3.7.0)
|
39
|
+
byebug (~> 11.0)
|
45
40
|
pry (~> 0.10)
|
46
|
-
rainbow (
|
47
|
-
rake (10.
|
48
|
-
rest-client (1.7
|
49
|
-
mime-types (>= 1.16
|
50
|
-
|
51
|
-
|
52
|
-
rspec-
|
53
|
-
rspec-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
rspec-expectations (3.2.0)
|
41
|
+
rainbow (3.0.0)
|
42
|
+
rake (10.5.0)
|
43
|
+
rest-client (1.6.7)
|
44
|
+
mime-types (>= 1.16)
|
45
|
+
rspec (3.9.0)
|
46
|
+
rspec-core (~> 3.9.0)
|
47
|
+
rspec-expectations (~> 3.9.0)
|
48
|
+
rspec-mocks (~> 3.9.0)
|
49
|
+
rspec-core (3.9.0)
|
50
|
+
rspec-support (~> 3.9.0)
|
51
|
+
rspec-expectations (3.9.0)
|
58
52
|
diff-lcs (>= 1.2.0, < 2.0)
|
59
|
-
rspec-support (~> 3.
|
60
|
-
rspec-mocks (3.
|
53
|
+
rspec-support (~> 3.9.0)
|
54
|
+
rspec-mocks (3.9.0)
|
61
55
|
diff-lcs (>= 1.2.0, < 2.0)
|
62
|
-
rspec-support (~> 3.
|
63
|
-
rspec-support (3.
|
64
|
-
rubocop (0.
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
rainbow (>=
|
69
|
-
ruby-progressbar (~> 1.
|
70
|
-
|
56
|
+
rspec-support (~> 3.9.0)
|
57
|
+
rspec-support (3.9.0)
|
58
|
+
rubocop (0.76.0)
|
59
|
+
jaro_winkler (~> 1.5.1)
|
60
|
+
parallel (~> 1.10)
|
61
|
+
parser (>= 2.6)
|
62
|
+
rainbow (>= 2.2.2, < 4.0)
|
63
|
+
ruby-progressbar (~> 1.7)
|
64
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
65
|
+
ruby-progressbar (1.10.1)
|
71
66
|
rugged (0.21.4)
|
72
|
-
simplecov (0.
|
73
|
-
docile (~> 1.1
|
74
|
-
|
75
|
-
simplecov-html (~> 0.
|
76
|
-
simplecov-html (0.
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
67
|
+
simplecov (0.17.1)
|
68
|
+
docile (~> 1.1)
|
69
|
+
json (>= 1.8, < 3)
|
70
|
+
simplecov-html (~> 0.10.0)
|
71
|
+
simplecov-html (0.10.2)
|
72
|
+
term-ansicolor (1.2.2)
|
73
|
+
tins (~> 0.8)
|
74
|
+
thor (0.18.1)
|
75
|
+
tins (0.13.2)
|
76
|
+
unicode-display_width (1.6.0)
|
82
77
|
|
83
78
|
PLATFORMS
|
84
79
|
ruby
|
@@ -90,3 +85,6 @@ DEPENDENCIES
|
|
90
85
|
rspec
|
91
86
|
rubocop
|
92
87
|
simplecov
|
88
|
+
|
89
|
+
BUNDLED WITH
|
90
|
+
2.0.2
|
data/README.md
CHANGED
@@ -4,27 +4,134 @@
|
|
4
4
|
[![Coverage Status](https://coveralls.io/repos/kevinjalbert/git_evolution/badge.svg)](https://coveralls.io/r/kevinjalbert/git_evolution)
|
5
5
|
[![Code Climate](https://codeclimate.com/github/kevinjalbert/git_evolution/badges/gpa.svg)](https://codeclimate.com/github/kevinjalbert/git_evolution)
|
6
6
|
|
7
|
-
|
7
|
+
Have you ever curious how a specific line or group of lines got to that point? If those lines are captured in a git repository then the history is there. Being able to identify the _evolution_ of said lines to their current state can be tricky and cumbersome. `GitEvolution` aims to solve this problem and provide a quick, and informative approach to understanding the evolution of changes in a git repository.
|
8
|
+
|
9
|
+
This is incredibly useful when dealing with source lines in a software project as the commit messages often contain nuggets of information on decisions for change.
|
8
10
|
|
9
11
|
## Installation
|
10
12
|
|
11
|
-
|
13
|
+
`gem install git_evolution`
|
14
|
+
|
15
|
+
## Usage
|
12
16
|
|
13
|
-
|
14
|
-
gem 'git_evolution'
|
17
|
+
Command-line interface `--help`
|
15
18
|
```
|
19
|
+
$ git_evolution --help
|
16
20
|
|
17
|
-
|
21
|
+
Usage: git_evolution [options] <file>
|
22
|
+
-r, --range N:N The specified range of lines to consider within the file (optional)
|
23
|
+
-s, --since STRING Consider the commits which are more recent than the specified time (optional)
|
24
|
+
```
|
18
25
|
|
19
|
-
|
26
|
+
## Example Scenario
|
20
27
|
|
21
|
-
|
28
|
+
If we were interesting in the source code evolution that lead to [rails's Array#forty_two](https://github.com/rails/rails/blob/7ba3a48/activesupport/lib/active_support/core_ext/array/access.rb#L70-L75):
|
22
29
|
|
23
|
-
|
30
|
+
```
|
31
|
+
$ git_evolution --range 70:75 ./rails/activesupport/lib/active_support/core_ext/array/access.rb
|
24
32
|
|
25
|
-
|
33
|
+
Commits:
|
34
|
+
utenmiki <utenmiki@gmail.com> (Thu Oct 31 23:20:15 2013 +0900) - 3f79d8423078f0671c8aa505ae199608d451663d
|
35
|
+
Add Rdoc document for Array#forty_two
|
36
|
+
|
37
|
+
Jeremy Kemper <jeremy@bitsweat.net> (Sat Mar 21 03:26:09 2009 -0700) - 83fd1ae122cf1ee4ea2c52e0bd963462163516ca
|
38
|
+
Convert array extension modules to class reopens
|
39
|
+
|
40
|
+
David Heinemeier Hansson <david@loudthinking.com> (Fri Nov 21 09:06:46 2008 +0100) - e50530ca3ab5db53ebc74314c54b62b91b932389
|
41
|
+
Reduced the number of literal aliases to the range that has actually seen personal use. With the massive savings in overhead, I was able to fit Array#forty_two
|
42
|
+
|
43
|
+
Pratik Naik <pratiknaik@gmail.com> (Sun Oct 5 22:16:26 2008 +0100) - a2932784bb71e72a78c32819ebd7ed2bed551e3e
|
44
|
+
Merge docrails
|
45
|
+
|
46
|
+
Pratik Naik <pratiknaik@gmail.com> (Mon Jul 28 12:26:59 2008 +0100) - 6e754551254a8cc64e034163f5d0dc155b450388
|
47
|
+
Merge docrails changes
|
48
|
+
|
49
|
+
David Heinemeier Hansson <david@loudthinking.com> (Tue Jun 17 13:37:57 2008 -0500) - 22af62cf486721ee2e45bb720c42ac2f4121faf4
|
50
|
+
Added Array#second through Array#tenth as aliases for Array#[1] through Array#[9] [DHH]
|
51
|
+
|
52
|
+
David Heinemeier Hansson <david@loudthinking.com> (Tue Nov 27 19:42:30 2007 +0000) - 4d177ae0d6d9f60c4000f45fb6f6df27317afbff
|
53
|
+
Added Array#from and Array#to that behaves just from String#from and String#to [DHH]
|
54
|
+
|
55
|
+
--------------------------------------------------------------------------------
|
56
|
+
|
57
|
+
Ownership (Commits):
|
58
|
+
David Heinemeier Hansson <david@loudthinking.com> - 3/7 (42.86%)
|
59
|
+
Pratik Naik <pratiknaik@gmail.com> - 2/7 (28.57%)
|
60
|
+
Jeremy Kemper <jeremy@bitsweat.net> - 1/7 (14.29%)
|
61
|
+
utenmiki <utenmiki@gmail.com> - 1/7 (14.29%)
|
62
|
+
|
63
|
+
Ownership (Changes):
|
64
|
+
David Heinemeier Hansson <david@loudthinking.com> - 53/84 (63.1%)
|
65
|
+
Pratik Naik <pratiknaik@gmail.com> - 20/84 (23.81%)
|
66
|
+
Jeremy Kemper <jeremy@bitsweat.net> - 9/84 (10.71%)
|
67
|
+
utenmiki <utenmiki@gmail.com> - 2/84 (2.38%)
|
68
|
+
```
|
69
|
+
|
70
|
+
`GitEvolution` provides a succinct output of the commits which contains any changes which lead to the current state. Its quick to see that [e50530ca3ab5db53ebc74314c54b62b91b932389](https://github.com/rails/rails/commit/e50530ca3ab5db53ebc74314c54b62b91b932389) was the introduction point for `Array#forty_two`.
|
71
|
+
|
72
|
+
In addition we have some _ownership_ information with respect to commits and changes. The ownership information can be used to identify _who_ to follow up with for additional context. In time new metrics and analysis could be attached to the output (i.e., factoring in time for ownership, types of changes, identifying file modifications such as movement or renames, etc...)
|
73
|
+
|
74
|
+
## The Other (Hard) Way
|
75
|
+
|
76
|
+
If we were to identify the commit which introduced `Array#forty_two` we have two main options `git blame` and `git log`:
|
77
|
+
|
78
|
+
### Using `git blame`
|
79
|
+
I highly advise against this approach as it involves a lot of manual work. You essentially use `git blame` to identify the previous commit which effects a line of concern within the area you are looking in.
|
80
|
+
|
81
|
+
```
|
82
|
+
$ git blame --follow ./activesupport/lib/active_support/core_ext/array/access.rb
|
83
|
+
|
84
|
+
...
|
85
|
+
83fd1ae1 (Jeremy Kemper 2009-03-21 03:26:09 -0700 70) # Equal to <tt>self[41]</tt>. Also known as accessing "the reddit".
|
86
|
+
3f79d842 (utenmiki 2013-10-31 23:20:15 +0900 71) #
|
87
|
+
3f79d842 (utenmiki 2013-10-31 23:20:15 +0900 72) # (1..42).to_a.forty_two # => 42
|
88
|
+
83fd1ae1 (Jeremy Kemper 2009-03-21 03:26:09 -0700 73) def forty_two
|
89
|
+
83fd1ae1 (Jeremy Kemper 2009-03-21 03:26:09 -0700 74) self[41]
|
90
|
+
4d177ae0 (David Heinemeier Hansson 2007-11-27 19:42:30 +0000 75) end
|
91
|
+
...
|
92
|
+
```
|
93
|
+
|
94
|
+
You can then use a similar command to blame the parent git revision at that point.
|
95
|
+
|
96
|
+
```
|
97
|
+
$ git blame --follow 83fd1ae1^ -- ./activesupport/lib/active_support/core_ext/array/access.rb
|
98
|
+
|
99
|
+
...
|
100
|
+
e50530ca (David Heinemeier Hansson 2008-11-21 09:06:46 +0100 46) # Equal to <tt>self[41]</tt>. Also known as accessing "the reddit".
|
101
|
+
e50530ca (David Heinemeier Hansson 2008-11-21 09:06:46 +0100 47) def forty_two
|
102
|
+
e50530ca (David Heinemeier Hansson 2008-11-21 09:06:46 +0100 48) self[41]
|
103
|
+
22af62cf (David Heinemeier Hansson 2008-06-17 13:37:57 -0500 49) end
|
104
|
+
...
|
105
|
+
```
|
106
|
+
|
107
|
+
All the while you occasionally want to inspect the commit in more detail using `git show <commit-sha>`. Eventually you will end up where you want to be.
|
108
|
+
|
109
|
+
```
|
110
|
+
$ git show e50530ca
|
111
|
+
|
112
|
+
commit e50530ca3ab5db53ebc74314c54b62b91b932389
|
113
|
+
Author: David Heinemeier Hansson <david@loudthinking.com>
|
114
|
+
Date: Fri Nov 21 09:06:46 2008 +0100
|
115
|
+
|
116
|
+
Reduced the number of literal aliases to the range that has actually seen personal use. With the massive savings in overhead, I was able to fit Array#forty_two
|
117
|
+
```
|
118
|
+
|
119
|
+
### Using `git log`
|
120
|
+
The following `git log` command presents the entire file history (26 commits):
|
121
|
+
|
122
|
+
```
|
123
|
+
$ git log --follow ./activesupport/lib/active_support/core_ext/array/access.rb
|
124
|
+
```
|
125
|
+
|
126
|
+
This works, but it is a lot more information to sift through.
|
127
|
+
|
128
|
+
A better approach (which is what `GitEvolution` uses under the hood) presents the file history for only the concerned portion (7 commits):
|
129
|
+
|
130
|
+
```
|
131
|
+
$ git log -L70,75:./activesupport/lib/active_support/core_ext/array/access.rb --follow ./activesupport/lib/active_support/core_ext/array/access.rb
|
132
|
+
```
|
26
133
|
|
27
|
-
|
134
|
+
The output isn't succinct, nor does it have ownership information. The command is also more verbose.
|
28
135
|
|
29
136
|
## Contributing
|
30
137
|
|
data/git_evolution.gemspec
CHANGED
@@ -18,10 +18,10 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables = Dir['bin/*'].map { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_dependency 'bundler', '~>
|
21
|
+
spec.add_dependency 'bundler', '~> 2.0'
|
22
22
|
spec.add_dependency 'rake', '~> 10.0'
|
23
23
|
spec.add_dependency 'rugged', '~> 0.21.0'
|
24
24
|
spec.add_dependency 'chronic', '~> 0.10.0'
|
25
25
|
|
26
|
-
spec.required_ruby_version = '~> 2.
|
26
|
+
spec.required_ruby_version = '~> 2.5'
|
27
27
|
end
|
Binary file
|
@@ -49,7 +49,7 @@ RSpec.describe GitEvolution::OptionHandler do
|
|
49
49
|
let(:range) { '10.20' }
|
50
50
|
|
51
51
|
it 'raises exception' do
|
52
|
-
expect { described_class.parse_range(range) }.to raise_error
|
52
|
+
expect { described_class.parse_range(range) }.to raise_error(GitEvolution::InvalidRangeFormatError)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_evolution
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Jalbert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -92,8 +92,7 @@ files:
|
|
92
92
|
- lib/git_evolution/report_presenter.rb
|
93
93
|
- lib/git_evolution/repository.rb
|
94
94
|
- lib/git_evolution/version.rb
|
95
|
-
- pkg/git_evolution-0.
|
96
|
-
- pkg/git_evolution-0.1.2.gem
|
95
|
+
- pkg/git_evolution-0.2.0.gem
|
97
96
|
- spec/fixtures/raw_commit.txt
|
98
97
|
- spec/fixtures/raw_commit_with_no_body.txt
|
99
98
|
- spec/fixtures/raw_commit_with_no_diff.txt
|
@@ -115,26 +114,25 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
115
114
|
requirements:
|
116
115
|
- - "~>"
|
117
116
|
- !ruby/object:Gem::Version
|
118
|
-
version: '2.
|
117
|
+
version: '2.5'
|
119
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
119
|
requirements:
|
121
120
|
- - ">="
|
122
121
|
- !ruby/object:Gem::Version
|
123
122
|
version: '0'
|
124
123
|
requirements: []
|
125
|
-
|
126
|
-
rubygems_version: 2.4.6
|
124
|
+
rubygems_version: 3.0.1
|
127
125
|
signing_key:
|
128
126
|
specification_version: 4
|
129
127
|
summary: Gem that provides the ability to determine the evolution of code within a
|
130
128
|
git repository
|
131
129
|
test_files:
|
132
|
-
- spec/fixtures/raw_commit.txt
|
133
|
-
- spec/fixtures/raw_commit_with_no_body.txt
|
134
|
-
- spec/fixtures/raw_commit_with_no_diff.txt
|
135
|
-
- spec/git_evolution/commit_spec.rb
|
136
|
-
- spec/git_evolution/option_handler_spec.rb
|
137
|
-
- spec/git_evolution/repository_spec.rb
|
138
130
|
- spec/spec_helper.rb
|
139
131
|
- spec/support/coverage.rb
|
140
132
|
- spec/support/repository_helper.rb
|
133
|
+
- spec/fixtures/raw_commit.txt
|
134
|
+
- spec/fixtures/raw_commit_with_no_diff.txt
|
135
|
+
- spec/fixtures/raw_commit_with_no_body.txt
|
136
|
+
- spec/git_evolution/repository_spec.rb
|
137
|
+
- spec/git_evolution/option_handler_spec.rb
|
138
|
+
- spec/git_evolution/commit_spec.rb
|
data/pkg/git_evolution-0.1.1.gem
DELETED
Binary file
|
data/pkg/git_evolution-0.1.2.gem
DELETED
Binary file
|