svn_command_helper 0.4.0 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 49f39ad55dc5cb31c499dc1421d4051a5b8ff3c6
4
- data.tar.gz: 4153d0ca030e1738fa05c35785e59cfb371b018a
3
+ metadata.gz: c76b5ad4dad201a7824cd3ceaa6b16fb717d866b
4
+ data.tar.gz: b888a7a706cf64ad30f796042b3de0c63bd0a365
5
5
  SHA512:
6
- metadata.gz: f71b08b8338bd8866a86159901c864e40cdd3fea8253be102fe53e42fa5802363e4ce088aa1bba1478c68afb33a90d80515b844d5e87801c66d9e7c9a5429138
7
- data.tar.gz: 47fa6ab5c989c8b56ba9ab74b1e1cb3da6acb3bddc28f15345687b74b82db75d178d7398ce52e247467e50bc68d3785acf4e3ef70730b32622371d1cfe248739
6
+ metadata.gz: c378bcb135924e360faf210fccf1dcd3c5260755ad01c0eb83edd62f7be1238e258952a50eb451dce981b6acb2f8432fa1e34694c4fd314fa105239ba8a777ad
7
+ data.tar.gz: e29ad93b6ddda05d0bbfde866806016d65d8250d1b07432cc89ab9759399c9ddbda506707c0c8938368a62e7e16043612cd31599ef39dae2265fe6e948407f1a
@@ -1,4 +1,4 @@
1
1
  module SvnCommandHelper
2
2
  # version
3
- VERSION = "0.4.0"
3
+ VERSION = "0.5.0"
4
4
  end
@@ -136,6 +136,47 @@ module SvnCommandHelper
136
136
  end
137
137
  end
138
138
 
139
+ # svn merge -r start_rev:end_rev from_uri to_path
140
+ # @param [Integer] start_rev start revision
141
+ # @param [Integer] end_rev end revision
142
+ # @param [String] from_uri from uri
143
+ # @param [String] to_path to local path
144
+ def merge1(start_rev, end_rev, from_uri, to_path = ".")
145
+ safe_merge "svn merge -r #{start_rev}:#{end_rev} #{from_uri} #{to_path}"
146
+ end
147
+
148
+ # merge after dry-run conflict check
149
+ # @param [String] command svn merge full command
150
+ def safe_merge(command)
151
+ dry_run = cap("#{command} --dry-run")
152
+ if dry_run.each_line.any? {|line| line.start_with?("C")}
153
+ raise "[ERROR] merge_branch_to_trunk: `#{command}` has conflict!\n#{dry_run}"
154
+ else
155
+ sys command
156
+ end
157
+ end
158
+
159
+ # svn merge branch to trunk with detecting revision range
160
+ # @param [String] from_uri from uri
161
+ # @param [String] to_path to local path
162
+ def merge_branch_to_trunk(from_uri, to_path = ".")
163
+ start_rev = copied_revision(from_uri)
164
+ end_rev = revision(from_uri)
165
+ merge1(start_rev, end_rev, from_uri, to_path)
166
+ end
167
+
168
+ # reverse merge single revision
169
+ # @param [Integer] start_rev start revision
170
+ # @param [Integer] end_rev end revision (if no end_rev then "-c start_rev")
171
+ # @param [String] path local path
172
+ def reverse_merge(start_rev, end_rev = nil, path = ".")
173
+ if end_rev
174
+ safe_merge "svn merge -r #{end_rev}:#{start_rev} #{path}"
175
+ else
176
+ safe_merge "svn merge -c #{start_rev} #{path}"
177
+ end
178
+ end
179
+
139
180
  # svn info -> yaml parse
140
181
  # @param [path string like] path target path
141
182
  # @return [Hash<String, String>] svn info contents
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: svn_command_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Narazaka