git-conflict-blame 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a86c8e97cedc6efef883350c97235a1022bdcd5e
4
+ data.tar.gz: fce9caad34072ce10ccfb6fcf3409a8f3cc996f5
5
+ SHA512:
6
+ metadata.gz: 0c2046509bf36923cd590742157f28da0ee731e48cb437fc791be52aebd14a6ee88ca2ca264b6db3fb76689b33b0a57a8d68eadeb97b19d502a04a4a351e1562
7
+ data.tar.gz: aab146a0103c4eee5d0b2e49bca2e3bc89b5215a6f621a7faf2ba6b87b7bfd5afd3650a1063a678eb8fed925462928585683ba1686cd7e98088ebf038e9c271b
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in git-conflict-blame.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Eric Terry
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # Git::Conflict::Blame
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/git/conflict/blame`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'git-conflict-blame'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install git-conflict-blame
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/git-conflict-blame.
36
+
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new( :spec )
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'git-conflict-blame'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require 'irb'
14
+ IRB.start
@@ -0,0 +1,72 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # This needs a lot of work. It was VERY quickly slapped together!
4
+
5
+ require 'git'
6
+ require 'colorize'
7
+
8
+ begin
9
+ git = Git.open( '.' )
10
+ status = git.status
11
+ changed = status.changed
12
+ unmerged = changed.select { |filename, data| data.stage.to_i == 3 }
13
+ rescue Exception => e
14
+ puts 'Could not find valid GIT repo!'
15
+ exit 1
16
+ end
17
+
18
+ data = {}
19
+ unmerged.keys.each do |filename|
20
+ raw = `git blame --show-email -c --date short #{filename}`
21
+
22
+ start_indexes = []
23
+ end_indexes = []
24
+ lines = raw.split( "\n" )
25
+ lines.each do |line|
26
+ start_indexes << lines.index( line ) if line.include?( '<<<<<<<' )
27
+ end_indexes << lines.index( line ) if line.include?( '>>>>>>>' )
28
+ end
29
+
30
+ index = 0
31
+ all_lines = []
32
+ start_indexes.count.times do
33
+ start_index = start_indexes[index]
34
+ end_index = end_indexes[index]
35
+ all_lines << lines[start_index..end_index]
36
+ index += 1
37
+ end
38
+
39
+ data[filename] = all_lines
40
+ end
41
+
42
+ data.delete_if { |_, all_lines| all_lines.nil? || all_lines.empty? }
43
+
44
+ data.each do |filename, conflicts|
45
+ puts filename.green
46
+ conflicts.each do |lines|
47
+ lines.each do |line|
48
+ line_array = line.split( "\t" )
49
+
50
+ commit_id = line_array[0]
51
+ email = line_array[1].delete( "(" )[0..30]
52
+ date = line_array[2]
53
+
54
+ git_info = [commit_id, email, date]
55
+ raw_line = line_array[3..999].join( "\t" )
56
+ raw_line_array = raw_line.split( ")" )
57
+ line_number = raw_line_array.first
58
+ raw_line_string = raw_line_array[1..999].join( ")" )
59
+
60
+ formatted_git_info = "\t%-10s %-30s %-13s" % git_info
61
+ if raw_line.include?( '<<<<<<<' ) || raw_line.include?( '>>>>>>>' )
62
+ raw_line_string = raw_line_string.red
63
+ elsif raw_line.include?( '=======' )
64
+ raw_line_string = raw_line_string.yellow
65
+ else
66
+ raw_line_string = raw_line_string.light_blue
67
+ end
68
+ puts "%s [%-22s] %-s" % [formatted_git_info, line_number.bold, raw_line_string]
69
+ puts if raw_line.include?( '>>>>>>>' )
70
+ end
71
+ end
72
+ end
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path( '../lib', __FILE__ )
3
+ $LOAD_PATH.unshift( lib ) unless $LOAD_PATH.include?( lib )
4
+ require 'git-conflict-blame/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'git-conflict-blame'
8
+ spec.version = GitConflictBlame::VERSION
9
+ spec.authors = ['Eric Terry']
10
+ spec.email = ['eterry1388@aol.com']
11
+
12
+ spec.summary = 'Git Conflict Blame'
13
+ spec.description = 'Git command that shows the blame on the lines that are in conflict'
14
+ spec.homepage = 'https://github.com/eterry1388/git-conflict-blame'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split( "\x0" ).reject { |f| f.match( %r{^(test|spec|features)/} ) }
18
+ spec.executables = spec.files.grep( %r{^bin/} ) { |f| File.basename( f ) }
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.10'
22
+ spec.add_development_dependency 'rake', '~> 10.0'
23
+ spec.add_development_dependency 'rspec'
24
+
25
+ spec.add_dependency 'git'
26
+ spec.add_dependency 'colorize'
27
+ end
@@ -0,0 +1,3 @@
1
+ module GitConflictBlame
2
+ VERSION = '0.1.0'
3
+ end
@@ -0,0 +1,4 @@
1
+ require 'git-conflict-blame/version'
2
+
3
+ module GitConflictBlame
4
+ end
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: git-conflict-blame
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Eric Terry
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-10-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: git
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: colorize
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Git command that shows the blame on the lines that are in conflict
84
+ email:
85
+ - eterry1388@aol.com
86
+ executables:
87
+ - console
88
+ - git-conflict-blame
89
+ - setup
90
+ extensions: []
91
+ extra_rdoc_files: []
92
+ files:
93
+ - ".gitignore"
94
+ - ".rspec"
95
+ - Gemfile
96
+ - LICENSE.txt
97
+ - README.md
98
+ - Rakefile
99
+ - bin/console
100
+ - bin/git-conflict-blame
101
+ - bin/setup
102
+ - git-conflict-blame.gemspec
103
+ - lib/git-conflict-blame.rb
104
+ - lib/git-conflict-blame/version.rb
105
+ homepage: https://github.com/eterry1388/git-conflict-blame
106
+ licenses:
107
+ - MIT
108
+ metadata: {}
109
+ post_install_message:
110
+ rdoc_options: []
111
+ require_paths:
112
+ - lib
113
+ required_ruby_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ requirements: []
124
+ rubyforge_project:
125
+ rubygems_version: 2.4.8
126
+ signing_key:
127
+ specification_version: 4
128
+ summary: Git Conflict Blame
129
+ test_files: []