[Updated] [+- ] D9654: copies-rust: make more use of the new comparison property
marmoute (Pierre-Yves David)
phabricator at mercurial-scm.org
Wed Dec 23 02:12:35 UTC 2020
marmoute updated this revision to Diff 24493.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D9654?vs=24478&id=24493
BRANCH
default
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D9654/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D9654
AFFECTED FILES
rust/hg-core/src/copy_tracing.rs
CHANGE DETAILS
diff --git a/rust/hg-core/src/copy_tracing.rs b/rust/hg-core/src/copy_tracing.rs
--- a/rust/hg-core/src/copy_tracing.rs
+++ b/rust/hg-core/src/copy_tracing.rs
@@ -854,49 +854,31 @@
src_minor: &CopySource,
src_major: &CopySource,
) -> (MergePick, bool) {
- if src_major.rev == current_merge {
- if src_minor.rev == current_merge {
- if src_major.path.is_none() {
- // We cannot get different copy information for both p1 and p2
- // from the same revision. Unless this was a
- // deletion.
- //
- // However the deletion might come over different data on each
- // branch.
- let need_over = src_major.overwritten != src_minor.overwritten;
- (MergePick::Any, need_over)
- } else {
- unreachable!();
- }
- } else {
- // The last value comes the current merge, this value -will- win
- // eventually.
- (MergePick::Major, true)
- }
+ if src_major == src_minor {
+ (MergePick::Any, false)
+ } else if src_major.rev == current_merge {
+ // minor is different according to per minor == major check earlier
+ debug_assert!(src_minor.rev != current_merge);
+
+ // The last value comes the current merge, this value -will- win
+ // eventually.
+ (MergePick::Major, true)
} else if src_minor.rev == current_merge {
// The last value comes the current merge, this value -will- win
// eventually.
(MergePick::Minor, true)
} else if src_major.path == src_minor.path {
+ debug_assert!(src_major.rev != src_major.rev);
// we have the same value, but from other source;
- if src_major.rev == src_minor.rev {
- // If the two entry are identical, they are both valid
- debug_assert!(src_minor.overwritten == src_minor.overwritten);
- (MergePick::Any, false)
- } else if src_major.is_overwritten_by(src_minor) {
+ if src_major.is_overwritten_by(src_minor) {
(MergePick::Minor, false)
} else if src_minor.is_overwritten_by(src_major) {
(MergePick::Major, false)
} else {
(MergePick::Any, true)
}
- } else if src_major.rev == src_minor.rev {
- // We cannot get copy information for both p1 and p2 in the
- // same rev. So this is the same value.
- unreachable!(
- "conflicting information from p1 and p2 in the same revision"
- );
} else {
+ debug_assert!(src_major.rev != src_major.rev);
let dest_path = path_map.untokenize(*dest);
let action = changes.get_merge_case(dest_path);
if src_minor.path.is_some()
To: marmoute, #hg-reviewers
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20201223/60118822/attachment-0002.html>
More information about the Mercurial-patches
mailing list