[Commented On] D9646: copies-rust: get the parents' copies earlier

baymax (Baymax, Your Personal Patch-care Companion) phabricator at mercurial-scm.org
Tue Jan 5 09:07:48 UTC 2021


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


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

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D9646?vs=24496&id=24580

BRANCH
  default

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

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

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
@@ -397,59 +397,60 @@
         // the individual copies information the curent revision.  Creating a
         // new TimeStampedPath for each `rev` → `children` vertex.
         let mut copies: Option<InternalPathCopies> = None;
-        if p1 != NULL_REVISION {
-            // Retrieve data computed in a previous iteration
-            let parent_copies = get_and_clean_parent_copies(
+        // Retrieve data computed in a previous iteration
+        let p1_copies = match p1 {
+            NULL_REVISION => None,
+            _ => get_and_clean_parent_copies(
                 &mut all_copies,
                 &mut children_count,
                 p1,
-            );
-            if let Some(parent_copies) = parent_copies {
-                // combine it with data for that revision
-                let vertex_copies = add_from_changes(
-                    &mut path_map,
-                    &parent_copies,
-                    &changes,
-                    Parent::FirstParent,
-                    rev,
-                );
-                // keep that data around for potential later combination
-                copies = Some(vertex_copies);
-            }
-        }
-        if p2 != NULL_REVISION {
-            // Retrieve data computed in a previous iteration
-            let parent_copies = get_and_clean_parent_copies(
+            ), // will be None if the vertex is not to be traversed
+        };
+        let p2_copies = match p2 {
+            NULL_REVISION => None,
+            _ => get_and_clean_parent_copies(
                 &mut all_copies,
                 &mut children_count,
                 p2,
+            ), // will be None if the vertex is not to be traversed
+        };
+        if let Some(parent_copies) = p1_copies {
+            // combine it with data for that revision
+            let vertex_copies = add_from_changes(
+                &mut path_map,
+                &parent_copies,
+                &changes,
+                Parent::FirstParent,
+                rev,
             );
-            if let Some(parent_copies) = parent_copies {
-                // combine it with data for that revision
-                let vertex_copies = add_from_changes(
-                    &mut path_map,
-                    &parent_copies,
-                    &changes,
-                    Parent::SecondParent,
-                    rev,
-                );
+            // keep that data around for potential later combination
+            copies = Some(vertex_copies);
+        }
+        if let Some(parent_copies) = p2_copies {
+            // combine it with data for that revision
+            let vertex_copies = add_from_changes(
+                &mut path_map,
+                &parent_copies,
+                &changes,
+                Parent::SecondParent,
+                rev,
+            );
 
-                copies = match copies {
-                    None => Some(vertex_copies),
-                    // Merge has two parents needs to combines their copy
-                    // information.
-                    //
-                    // If we got data from both parents, We need to combine
-                    // them.
-                    Some(copies) => Some(merge_copies_dict(
-                        &path_map,
-                        rev,
-                        vertex_copies,
-                        copies,
-                        &changes,
-                    )),
-                };
-            }
+            copies = match copies {
+                None => Some(vertex_copies),
+                // Merge has two parents needs to combines their copy
+                // information.
+                //
+                // If we got data from both parents, We need to combine
+                // them.
+                Some(copies) => Some(merge_copies_dict(
+                    &path_map,
+                    rev,
+                    vertex_copies,
+                    copies,
+                    &changes,
+                )),
+            };
         }
         match copies {
             Some(copies) => {



To: marmoute, #hg-reviewers, pulkit
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20210105/58106444/attachment-0001.html>


More information about the Mercurial-patches mailing list