Mercurial > hg
comparison rust/hg-core/src/copy_tracing.rs @ 45974:10bb0856bb9f
copies-rust: pre-indent some code to clarify the next patch
The next patch will need this new indentation, having it done explicitly
beforehand makes that next patch clearer.
Differential Revision: https://phab.mercurial-scm.org/D9305
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 30 Oct 2020 19:06:12 +0100 |
parents | ed0e1339e4a8 |
children | 2367937982ba |
comparison
equal
deleted
inserted
replaced
45973:ed0e1339e4a8 | 45974:10bb0856bb9f |
---|---|
319 } | 319 } |
320 } else if src_major.rev == src_minor.rev { | 320 } else if src_major.rev == src_minor.rev { |
321 // We cannot get copy information for both p1 and p2 in the | 321 // We cannot get copy information for both p1 and p2 in the |
322 // same rev. So this is the same value. | 322 // same rev. So this is the same value. |
323 unreachable!(); | 323 unreachable!(); |
324 } else if src_major.path.is_none() | |
325 && changes.salvaged.contains(dest) | |
326 { | |
327 // If the file is "deleted" in the major side but was | |
328 // salvaged by the merge, we keep the minor side alive | |
329 pick_minor(); | |
330 } else if src_minor.path.is_none() | |
331 && changes.salvaged.contains(dest) | |
332 { | |
333 // If the file is "deleted" in the minor side but was | |
334 // salvaged by the merge, unconditionnaly preserve the | |
335 // major side. | |
336 pick_major(); | |
337 } else if changes.merged.contains(dest) { | |
338 // If the file was actively merged, copy information from | |
339 // each side might conflict. The major side will win such | |
340 // conflict. | |
341 pick_major(); | |
342 } else if oracle.is_ancestor(src_major.rev, src_minor.rev) { | |
343 // If the minor side is strictly newer than the major side, | |
344 // it should be kept. | |
345 pick_minor(); | |
346 } else if src_major.path.is_some() { | |
347 // without any special case, the "major" value win other | |
348 // the "minor" one. | |
349 pick_major(); | |
350 } else if oracle.is_ancestor(src_minor.rev, src_major.rev) { | |
351 // the "major" rev is a direct ancestors of "minor", any | |
352 // different value should overwrite | |
353 pick_major(); | |
354 } else { | 324 } else { |
355 // major version is None (so the file was deleted on that | 325 if src_major.path.is_none() |
356 // branch) and that branch is independant (neither minor | 326 && changes.salvaged.contains(dest) |
357 // nor major is an ancestors of the other one.) We preserve | 327 { |
358 // the new information about the new file. | 328 // If the file is "deleted" in the major side but was |
359 pick_minor(); | 329 // salvaged by the merge, we keep the minor side alive |
330 pick_minor(); | |
331 } else if src_minor.path.is_none() | |
332 && changes.salvaged.contains(dest) | |
333 { | |
334 // If the file is "deleted" in the minor side but was | |
335 // salvaged by the merge, unconditionnaly preserve the | |
336 // major side. | |
337 pick_major(); | |
338 } else if changes.merged.contains(dest) { | |
339 // If the file was actively merged, copy information | |
340 // from each side might conflict. The major side will | |
341 // win such conflict. | |
342 pick_major(); | |
343 } else if oracle.is_ancestor(src_major.rev, src_minor.rev) | |
344 { | |
345 // If the minor side is strictly newer than the major | |
346 // side, it should be kept. | |
347 pick_minor(); | |
348 } else if src_major.path.is_some() { | |
349 // without any special case, the "major" value win | |
350 // other the "minor" one. | |
351 pick_major(); | |
352 } else if oracle.is_ancestor(src_minor.rev, src_major.rev) | |
353 { | |
354 // the "major" rev is a direct ancestors of "minor", | |
355 // any different value should | |
356 // overwrite | |
357 pick_major(); | |
358 } else { | |
359 // major version is None (so the file was deleted on | |
360 // that branch) and that branch is independant (neither | |
361 // minor nor major is an ancestors of the other one.) | |
362 // We preserve the new | |
363 // information about the new file. | |
364 pick_minor(); | |
365 } | |
360 } | 366 } |
361 } | 367 } |
362 }; | 368 }; |
363 } | 369 } |
364 | 370 |