svn_command_helper 1.1.0 → 1.2.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/lib/svn_command_helper.rb +32 -4
- data/lib/svn_command_helper/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ed319daca7d4f6456d4adedafb1f8b8ea01fd85
|
4
|
+
data.tar.gz: 685413932344a4a488fcf3054ec98942fc3157a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 738a56bbb2526afc473bb3f6d5f1b0b9c07b1d9c5394db8e763a8e9b5b6c8abb36f6159b2225b171dab4c5544372b5530a8a8d3d0bff4f30f35fb4aa0849ba6a
|
7
|
+
data.tar.gz: ecaed0d02d0e3f097ee315c5fa4b68548addcf8d5f73657fe7be604e3ce15c72f6db2251a8551e001eddf1d6f035b03664b0b4cca67d20b3697d14ec254045bd
|
data/lib/svn_command_helper.rb
CHANGED
@@ -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
|
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 =
|
175
|
-
if dry_run.
|
176
|
-
|
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
|
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.
|
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-
|
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
|