Show More
@@ -203,54 +203,59 b' fn merge_copies_dict(' | |||||
203 | for (dest, src_major) in major { |
|
203 | for (dest, src_major) in major { | |
204 | let overwrite; |
|
204 | let overwrite; | |
205 | if let Some(src_minor) = minor.get(&dest) { |
|
205 | if let Some(src_minor) = minor.get(&dest) { | |
206 | if src_major.path == src_minor.path { |
|
206 | { | |
207 | // we have the same value, but from other source; |
|
207 | if src_major.path == src_minor.path { | |
208 | if src_major.rev == src_minor.rev { |
|
208 | // we have the same value, no need to battle; | |
209 | // If the two entry are identical, no need to do anything |
|
209 | if src_major.rev == src_minor.rev { | |
|
210 | // If the two entry are identical, no need to do | |||
|
211 | // anything | |||
|
212 | overwrite = false; | |||
|
213 | } else if is_ancestor(src_major.rev, src_minor.rev) { | |||
|
214 | overwrite = false; | |||
|
215 | } else { | |||
|
216 | overwrite = true; | |||
|
217 | } | |||
|
218 | } else if src_major.rev == src_minor.rev { | |||
|
219 | // We cannot get copy information for both p1 and p2 in the | |||
|
220 | // same rev. So this is the same value. | |||
|
221 | overwrite = false; | |||
|
222 | } else if src_major.path.is_none() | |||
|
223 | && changes.salvaged.contains(&dest) | |||
|
224 | { | |||
|
225 | // If the file is "deleted" in the major side but was | |||
|
226 | // salvaged by the merge, we keep the minor side alive | |||
210 | overwrite = false; |
|
227 | overwrite = false; | |
|
228 | } else if src_minor.path.is_none() | |||
|
229 | && changes.salvaged.contains(&dest) | |||
|
230 | { | |||
|
231 | // If the file is "deleted" in the minor side but was | |||
|
232 | // salvaged by the merge, unconditionnaly preserve the | |||
|
233 | // major side. | |||
|
234 | overwrite = true; | |||
|
235 | } else if changes.merged.contains(&dest) { | |||
|
236 | // If the file was actively merged, copy information from | |||
|
237 | // each side might conflict. The major side will win such | |||
|
238 | // conflict. | |||
|
239 | overwrite = true; | |||
211 | } else if is_ancestor(src_major.rev, src_minor.rev) { |
|
240 | } else if is_ancestor(src_major.rev, src_minor.rev) { | |
|
241 | // If the minor side is strictly newer than the major side, | |||
|
242 | // it should be kept. | |||
212 | overwrite = false; |
|
243 | overwrite = false; | |
|
244 | } else if src_major.path.is_some() { | |||
|
245 | // without any special case, the "major" value win other | |||
|
246 | // the "minor" one. | |||
|
247 | overwrite = true; | |||
|
248 | } else if is_ancestor(src_minor.rev, src_major.rev) { | |||
|
249 | // the "major" rev is a direct ancestors of "minor", any | |||
|
250 | // different value should overwrite | |||
|
251 | overwrite = true; | |||
213 | } else { |
|
252 | } else { | |
214 | overwrite = true; |
|
253 | // major version is None (so the file was deleted on that | |
|
254 | // branch) and that branch is independant (neither minor | |||
|
255 | // nor major is an ancestors of the other one.) We preserve | |||
|
256 | // the new information about the new file. | |||
|
257 | overwrite = false; | |||
215 | } |
|
258 | } | |
216 | } else if src_major.rev == src_minor.rev { |
|
|||
217 | // We cannot get copy information for both p1 and p2 in the |
|
|||
218 | // same rev. So this is the same value. |
|
|||
219 | overwrite = false; |
|
|||
220 | } else if src_major.path.is_none() |
|
|||
221 | && changes.salvaged.contains(&dest) |
|
|||
222 | { |
|
|||
223 | // If the file is "deleted" in the major side but was salvaged |
|
|||
224 | // by the merge, we keep the minor side alive |
|
|||
225 | overwrite = false; |
|
|||
226 | } else if src_minor.path.is_none() |
|
|||
227 | && changes.salvaged.contains(&dest) |
|
|||
228 | { |
|
|||
229 | // If the file is "deleted" in the minor side but was salvaged |
|
|||
230 | // by the merge, unconditionnaly preserve the major side. |
|
|||
231 | overwrite = true; |
|
|||
232 | } else if changes.merged.contains(&dest) { |
|
|||
233 | // If the file was actively merged, copy information from each |
|
|||
234 | // side might conflict. The major side will win such conflict. |
|
|||
235 | overwrite = true; |
|
|||
236 | } else if is_ancestor(src_major.rev, src_minor.rev) { |
|
|||
237 | // If the minor side is strictly newer than the major side, it |
|
|||
238 | // should be kept. |
|
|||
239 | overwrite = false; |
|
|||
240 | } else if src_major.path.is_some() { |
|
|||
241 | // without any special case, the "major" value win other the |
|
|||
242 | // "minor" one. |
|
|||
243 | overwrite = true; |
|
|||
244 | } else if is_ancestor(src_minor.rev, src_major.rev) { |
|
|||
245 | // the "major" rev is a direct ancestors of "minor", any |
|
|||
246 | // different value should overwrite |
|
|||
247 | overwrite = true; |
|
|||
248 | } else { |
|
|||
249 | // major version is None (so the file was deleted on that |
|
|||
250 | // branch) annd that branch is independant (neither minor nor |
|
|||
251 | // major is an ancestors of the other one.) We preserve the new |
|
|||
252 | // information about the new file. |
|
|||
253 | overwrite = false; |
|
|||
254 | } |
|
259 | } | |
255 | } else { |
|
260 | } else { | |
256 | // minor had no value |
|
261 | // minor had no value |
General Comments 0
You need to be logged in to leave comments.
Login now