svn_command_helper 1.1.0 → 1.2.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: 5a84fa200fd38076ba2001eae98357c7fdc7c4f3
4
- data.tar.gz: c7492259bd925af2e146716d44c1453c93c2e94b
3
+ metadata.gz: 2ed319daca7d4f6456d4adedafb1f8b8ea01fd85
4
+ data.tar.gz: 685413932344a4a488fcf3054ec98942fc3157a9
5
5
  SHA512:
6
- metadata.gz: cc3dfc80506eda2eeff7733003a1b505c493272255e92c42b7d60c6f15df8bcab8d109748999dc6c0c7c57724cb7f0a71eba33a11e88e25499ee7cbcb1b69611
7
- data.tar.gz: 40a8b8e8c9d11972cc2f53fa2c959e4e6c95c703039165b480653976e25a5a26f8f7f9177eae2b6cbbac2ca5f94a224d01a495f9025082b74a665ebe9f1d86ac
6
+ metadata.gz: 738a56bbb2526afc473bb3f6d5f1b0b9c07b1d9c5394db8e763a8e9b5b6c8abb36f6159b2225b171dab4c5544372b5530a8a8d3d0bff4f30f35fb4aa0849ba6a
7
+ data.tar.gz: ecaed0d02d0e3f097ee315c5fa4b68548addcf8d5f73657fe7be604e3ce15c72f6db2251a8551e001eddf1d6f035b03664b0b4cca67d20b3697d14ec254045bd
@@ -165,20 +165,48 @@ module SvnCommandHelper
165
165
  # @param [String] from_uri from uri
166
166
  # @param [String] to_path to local path
167
167
  def merge1(start_rev, end_rev, from_uri, to_path = ".")
168
- safe_merge "svn merge -r #{start_rev}:#{end_rev} #{from_uri} #{to_path}"
168
+ safe_merge merge1_command(start_rev, end_rev, from_uri, to_path)
169
+ end
170
+
171
+ # svn merge -r start_rev:end_rev from_uri to_path --dry-run
172
+ # @param [Integer] start_rev start revision
173
+ # @param [Integer] end_rev end revision
174
+ # @param [String] from_uri from uri
175
+ # @param [String] to_path to local path
176
+ def merge1_dry_run(start_rev, end_rev, from_uri, to_path = ".")
177
+ merge_dry_run merge1_command(start_rev, end_rev, from_uri, to_path)
178
+ end
179
+
180
+ # "svn merge -r start_rev:end_rev from_uri to_path"
181
+ # @param [Integer] start_rev start revision
182
+ # @param [Integer] end_rev end revision
183
+ # @param [String] from_uri from uri
184
+ # @param [String] to_path to local path
185
+ # @param [Boolean] dry_run --dry-run
186
+ def merge1_command(start_rev, end_rev, from_uri, to_path = ".", dry_run: false)
187
+ "svn merge -r #{start_rev}:#{end_rev} #{from_uri} #{to_path} #{dry_run ? "--dry-run" : ""}"
169
188
  end
170
189
 
171
190
  # merge after dry-run conflict check
172
191
  # @param [String] command svn merge full command
173
192
  def safe_merge(command)
174
- dry_run = cap("#{command} --dry-run")
175
- if dry_run.each_line.any? {|line| line.start_with?("C")}
176
- raise "[ERROR] merge_branch_to_trunk: `#{command}` has conflict!\n#{dry_run}"
193
+ dry_run = merge_dry_run(command)
194
+ if dry_run.any? {|entry| entry.status.include?("C")}
195
+ dry_run_str = dry_run.map {|entry| "#{entry.status} #{entry.path}"}.join("\n")
196
+ raise "[ERROR] merge_branch_to_trunk: `#{command}` has conflict!\n#{dry_run_str}"
177
197
  else
178
198
  sys command
179
199
  end
180
200
  end
181
201
 
202
+ # merge dry-run conflict check result
203
+ # @param [String] command svn merge full command
204
+ def merge_dry_run(command)
205
+ cap("#{command} --dry-run")
206
+ .each_line.map(&:chomp).reject {|line| line.start_with?('-')}
207
+ .map {|line| OpenStruct.new({status: line[0...4], path: line[5..-1]})}
208
+ end
209
+
182
210
  # svn merge branch to trunk with detecting revision range
183
211
  # @param [String] from_uri from uri
184
212
  # @param [String] to_path to local path
@@ -1,4 +1,4 @@
1
1
  module SvnCommandHelper
2
2
  # version
3
- VERSION = "1.1.0"
3
+ VERSION = "1.2.0"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: svn_command_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Narazaka
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-22 00:00:00.000000000 Z
11
+ date: 2016-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: system_command_helper