Skip to content
Snippets Groups Projects
Commit ae94cd32 authored by Pierre-Yves David's avatar Pierre-Yves David :octopus:
Browse files

copies-rust: rename Oracle.is_ancestor to Oracle.is_overwrite

The core information that we want here is about "does information from revision
X overwrite information in Y". To do so, we check is X is an ancestors of Y, but
this is an implementation details, they could be other ways. We update the
naming to clarify this (and align more with wording used in upcoming changesets.

For people curious about other ways: for example we could record the overwrite
graph as it happens and reuse that to check if X overwrite Y, without having to
do potential expensive `is_ancestor` call on the revision graph.
parent 07f60491
No related branches found
No related tags found
No related merge requests found
...@@ -244,7 +244,7 @@ ...@@ -244,7 +244,7 @@
} }
/// returns `true` if `anc` is an ancestors of `desc`, `false` otherwise /// returns `true` if `anc` is an ancestors of `desc`, `false` otherwise
fn is_ancestor(&mut self, anc: Revision, desc: Revision) -> bool { fn is_overwrite(&mut self, anc: Revision, desc: Revision) -> bool {
if anc > desc { if anc > desc {
false false
} else if anc == desc { } else if anc == desc {
...@@ -696,7 +696,7 @@ ...@@ -696,7 +696,7 @@
if src_major.rev == src_minor.rev { if src_major.rev == src_minor.rev {
// If the two entry are identical, they are both valid // If the two entry are identical, they are both valid
MergePick::Any MergePick::Any
} else if oracle.is_ancestor(src_major.rev, src_minor.rev) { } else if oracle.is_overwrite(src_major.rev, src_minor.rev) {
MergePick::Minor MergePick::Minor
} else { } else {
MergePick::Major MergePick::Major
...@@ -722,7 +722,7 @@ ...@@ -722,7 +722,7 @@
// from each side might conflict. The major side will // from each side might conflict. The major side will
// win such conflict. // win such conflict.
MergePick::Major MergePick::Major
} else if oracle.is_ancestor(src_major.rev, src_minor.rev) { } else if oracle.is_overwrite(src_major.rev, src_minor.rev) {
// If the minor side is strictly newer than the major // If the minor side is strictly newer than the major
// side, it should be kept. // side, it should be kept.
MergePick::Minor MergePick::Minor
...@@ -730,7 +730,7 @@ ...@@ -730,7 +730,7 @@
// without any special case, the "major" value win // without any special case, the "major" value win
// other the "minor" one. // other the "minor" one.
MergePick::Major MergePick::Major
} else if oracle.is_ancestor(src_minor.rev, src_major.rev) { } else if oracle.is_overwrite(src_minor.rev, src_major.rev) {
// the "major" rev is a direct ancestors of "minor", // the "major" rev is a direct ancestors of "minor",
// any different value should // any different value should
// overwrite // overwrite
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment