git-conflict-blame 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3ba336c946c4cfd3a24b327810946ca95f230a19
4
- data.tar.gz: 004e24d928ccda8fa28619570adb9b94efc6e33c
3
+ metadata.gz: 2aaa7463d1d1619c7f781cc98030ad29f1f453b9
4
+ data.tar.gz: 9c25a3bcd048ec63bc4cbf16536810d8ec90eaa1
5
5
  SHA512:
6
- metadata.gz: 42e753b8727d85da20f2b82f06066e60b9ff3449279685e7f33e9f51a2ae390dcdd314cf25442627a7ca9c9c3c73c5989cb92e89763dbbb211b06af28989fed8
7
- data.tar.gz: ea9af7d55fd4bfee8594e080cae3d4c90c84b0f4b5fbc6500f849f44ff448e3dd582c12c1cd30e5252e13f854b4c90e7892e1ad8d11220582d4867873d46ab0d
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 this (if you are on a Debian-based OS):
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
- 1 files in conflict found!
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,"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"}]]}}
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
- "count": 1,
101
+ "file_count": 1,
102
+ "total_count": 1,
98
103
  "data": {
99
104
  "app.rb": [
100
105
  [
@@ -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 = 'https://github.com/eterry1388/git-conflict-blame'
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)/} ) }
@@ -1,3 +1,3 @@
1
1
  class GitConflictBlame
2
- VERSION = '0.3.1'
2
+ VERSION = '0.4.0'
3
3
  end
@@ -26,20 +26,29 @@ class GitConflictBlame
26
26
 
27
27
  # Actually performs the conflict blame
28
28
  def run!
29
- Dir.chdir( @repo.workdir )
30
- raise GitError, 'No conflicts found' unless conflicts?
31
- log "#{conflicts.count} files in conflict found!".red
32
- log "Parsing files to find out who is to blame..."
33
- data = find_conflict_blames
34
- if @json
35
- json_data = {
36
- exception: false,
37
- count: conflicts.count,
38
- data: data
39
- }
40
- output_json( json_data )
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
- display_results( data )
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 [Hash]
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.3.1
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-15 00:00:00.000000000 Z
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: https://github.com/eterry1388/git-conflict-blame
116
+ homepage: http://eterry1388.github.io/git-conflict-blame
117
117
  licenses:
118
118
  - MIT
119
119
  metadata: {}