[Commented On] D9426: copies-rust: hide most of the comparison details inside a closure

baymax (Baymax, Your Personal Patch-care Companion) phabricator at mercurial-scm.org
Mon Dec 14 12:06:28 UTC 2020


baymax added a comment.
baymax updated this revision to Diff 24237.


  ✅ refresh by Heptapod after a successful CI run (🐙 💚)

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D9426?vs=24213&id=24237

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D9426/new/

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

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
@@ -502,6 +502,15 @@
     changes: &ChangedFiles,
     oracle: &mut AncestorOracle<A>,
 ) -> TimeStampedPathCopies {
+    // This closure exist as temporary help while multiple developper are
+    // actively working on this code. Feel free to re-inline it once this
+    // code is more settled.
+    let mut cmp_value =
+        |dest: &HgPathBuf,
+         src_minor: &TimeStampedPathCopy,
+         src_major: &TimeStampedPathCopy| {
+            compare_value(changes, oracle, dest, src_minor, src_major)
+        };
     if minor.is_empty() {
         major
     } else if major.is_empty() {
@@ -538,9 +547,7 @@
                 DiffItem::Update { old, new } => {
                     let (dest, src_major) = new;
                     let (_, src_minor) = old;
-                    match compare_value(
-                        changes, oracle, dest, src_minor, src_major,
-                    ) {
+                    match cmp_value(dest, src_minor, src_major) {
                         MergePick::Major => to_minor(dest, src_major),
                         MergePick::Minor => to_major(dest, src_minor),
                         // If the two entry are identical, no need to do



To: marmoute, #hg-reviewers, Alphare, pulkit
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20201214/53b88ea3/attachment-0002.html>


More information about the Mercurial-patches mailing list