git-conflict-blame 0.3.1 → 0.4.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/README.md +9 -4
- data/git-conflict-blame.gemspec +1 -1
- data/lib/git-conflict-blame/version.rb +1 -1
- data/lib/git-conflict-blame.rb +26 -15
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2aaa7463d1d1619c7f781cc98030ad29f1f453b9
|
4
|
+
data.tar.gz: 9c25a3bcd048ec63bc4cbf16536810d8ec90eaa1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34d30c89566c7fd850656ebd56ae2e1467ba5f73447965f4005f663ad73b7a4b787c520ada3c2ae8564e3b9f506a18a776ac1f1a981e176a4dd4ec59b41f3ab5
|
7
|
+
data.tar.gz: 86cd0b99d0068c7039aad752f002f03a00bf1f433864849b3c83248ed47674ee9bf7c72fa38348838873382e23ba2f05d08380e0fe4a960d54daac3339ac8f7e
|
data/README.md
CHANGED
@@ -27,10 +27,12 @@ libraries and/or headers. Check the mkmf.log file for more details. You may
|
|
27
27
|
need configuration options.
|
28
28
|
```
|
29
29
|
|
30
|
-
Try running
|
30
|
+
Try running one of these (depending on your OS):
|
31
31
|
|
32
32
|
```bash
|
33
33
|
sudo apt-get install cmake
|
34
|
+
yum install cmake
|
35
|
+
brew install cmake
|
34
36
|
```
|
35
37
|
|
36
38
|
## Usage
|
@@ -49,8 +51,10 @@ git conflict-blame
|
|
49
51
|
#### To see this:
|
50
52
|
|
51
53
|
```
|
52
|
-
|
54
|
+
2 files are in conflict
|
53
55
|
Parsing files to find out who is to blame...
|
56
|
+
2 total conflicts found!
|
57
|
+
|
54
58
|
app.rb
|
55
59
|
00000000 not.committed.yet 2015-10-15 [7 ] <<<<<<< HEAD
|
56
60
|
ad3e1b25 bob.fred@example.com 2015-10-15 [8 ] output = add( 5, 6
|
@@ -78,7 +82,7 @@ git conflict-blame --json
|
|
78
82
|
#### To see this:
|
79
83
|
|
80
84
|
```json
|
81
|
-
{"exception":false,"
|
85
|
+
{"exception":false,"file_count":1,"total_count":1,"data":{"app.rb":[[{"commit_id":"00000000","email":"not.committed.yet","date":"2015-10-15","line_number":7,"line_content":"<<<<<<< HEAD"},{"commit_id":"ad3e1b25","email":"bob.fred@example.com","date":"2015-10-15","line_number":8,"line_content":"output = add( 5, 6 "},{"commit_id":"ad3e1b25","email":"bob.fred@example.com","date":"2015-10-15","line_number":9,"line_content":"puts output"},{"commit_id":"00000000","email":"not.committed.yet","date":"2015-10-15","line_number":10,"line_content":"======="},{"commit_id":"b8fb28f1","email":"bob.fred@example.com","date":"2015-10-15","line_number":11,"line_content":"puts add( 5, 6 "},{"commit_id":"00000000","email":"not.committed.yet","date":"2015-10-15","line_number":12,"line_content":">>>>>>> master"}]]}}
|
82
86
|
```
|
83
87
|
|
84
88
|
### To output pretty machine-readable data
|
@@ -94,7 +98,8 @@ git conflict-blame --json --pretty
|
|
94
98
|
```json
|
95
99
|
{
|
96
100
|
"exception": false,
|
97
|
-
"
|
101
|
+
"file_count": 1,
|
102
|
+
"total_count": 1,
|
98
103
|
"data": {
|
99
104
|
"app.rb": [
|
100
105
|
[
|
data/git-conflict-blame.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
|
12
12
|
spec.summary = 'Git Conflict Blame'
|
13
13
|
spec.description = 'Git command that shows the blame on the lines that are in conflict'
|
14
|
-
spec.homepage = '
|
14
|
+
spec.homepage = 'http://eterry1388.github.io/git-conflict-blame'
|
15
15
|
spec.license = 'MIT'
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split( "\x0" ).reject { |f| f.match( %r{^(test|spec|features)/} ) }
|
data/lib/git-conflict-blame.rb
CHANGED
@@ -26,20 +26,29 @@ class GitConflictBlame
|
|
26
26
|
|
27
27
|
# Actually performs the conflict blame
|
28
28
|
def run!
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
29
|
+
if conflicts?
|
30
|
+
Dir.chdir( @repo.workdir )
|
31
|
+
log "#{conflicts.count} files are in conflict".red
|
32
|
+
log "Parsing files to find out who is to blame..."
|
33
|
+
data, total_conflicts = find_conflict_blames
|
34
|
+
if total_conflicts == 0
|
35
|
+
log "All conflicts appear to be resolved".green
|
36
|
+
else
|
37
|
+
log "#{total_conflicts} total conflicts found!\n".red
|
38
|
+
end
|
39
|
+
if @json
|
40
|
+
json_data = {
|
41
|
+
exception: false,
|
42
|
+
file_count: conflicts.count,
|
43
|
+
total_count: total_conflicts,
|
44
|
+
data: data
|
45
|
+
}
|
46
|
+
output_json( json_data )
|
47
|
+
else
|
48
|
+
display_results( data )
|
49
|
+
end
|
41
50
|
else
|
42
|
-
|
51
|
+
log 'No conflicts found'.green
|
43
52
|
end
|
44
53
|
rescue GitError => e
|
45
54
|
log_error( e )
|
@@ -128,9 +137,10 @@ class GitConflictBlame
|
|
128
137
|
|
129
138
|
# Parses through the conflicted files and finds the blame on each line
|
130
139
|
#
|
131
|
-
# @return [
|
140
|
+
# @return [Array] [data_hash, conflict_count]
|
132
141
|
def find_conflict_blames
|
133
142
|
data = {}
|
143
|
+
total_conflicts = 0
|
134
144
|
conflicts.each do |conflict|
|
135
145
|
raw = raw_blame( conflict )
|
136
146
|
start_indexes = []
|
@@ -150,10 +160,11 @@ class GitConflictBlame
|
|
150
160
|
all_line_sets << parse_lines( line_set )
|
151
161
|
index += 1
|
152
162
|
end
|
163
|
+
total_conflicts += start_indexes.count
|
153
164
|
data[conflict] = all_line_sets
|
154
165
|
end
|
155
166
|
data.delete_if { |_, all_line_sets| all_line_sets.nil? || all_line_sets.empty? }
|
156
|
-
data
|
167
|
+
[data, total_conflicts]
|
157
168
|
end
|
158
169
|
|
159
170
|
# Iterates through a line set and parses them
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-conflict-blame
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Terry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -113,7 +113,7 @@ files:
|
|
113
113
|
- lib/git-conflict-blame.rb
|
114
114
|
- lib/git-conflict-blame/exceptions.rb
|
115
115
|
- lib/git-conflict-blame/version.rb
|
116
|
-
homepage:
|
116
|
+
homepage: http://eterry1388.github.io/git-conflict-blame
|
117
117
|
licenses:
|
118
118
|
- MIT
|
119
119
|
metadata: {}
|