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

login
register
mail settings
Submitter phabricator
Date Dec. 2, 2020, 4:03 p.m.
Message ID <differential-rev-PHID-DREV-4z4uwjxei5zr6ijmb7nv-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47778/
State Superseded
Headers show

Comments

phabricator - Dec. 2, 2020, 4:03 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9496

AFFECTED FILES
  rust/hg-core/src/copy_tracing.rs

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

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
@@ -244,7 +244,7 @@ 
     }
 
     /// 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 {
             false
         } else if anc == desc {
@@ -696,7 +696,7 @@ 
         if src_major.rev == src_minor.rev {
             // If the two entry are identical, they are both valid
             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
         } else {
             MergePick::Major
@@ -722,7 +722,7 @@ 
             // from each side might conflict.  The major side will
             // win such conflict.
             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
             // side, it should be kept.
             MergePick::Minor
@@ -730,7 +730,7 @@ 
             // without any special case, the "major" value win
             // other the "minor" one.
             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",
             // any different value should
             // overwrite