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 +4 -4
- data/lib/svn_command_helper/version.rb +1 -1
- data/lib/svn_command_helper.rb +41 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c76b5ad4dad201a7824cd3ceaa6b16fb717d866b
|
4
|
+
data.tar.gz: b888a7a706cf64ad30f796042b3de0c63bd0a365
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c378bcb135924e360faf210fccf1dcd3c5260755ad01c0eb83edd62f7be1238e258952a50eb451dce981b6acb2f8432fa1e34694c4fd314fa105239ba8a777ad
|
7
|
+
data.tar.gz: e29ad93b6ddda05d0bbfde866806016d65d8250d1b07432cc89ab9759399c9ddbda506707c0c8938368a62e7e16043612cd31599ef39dae2265fe6e948407f1a
|
data/lib/svn_command_helper.rb
CHANGED
@@ -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
|