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

copies-rust: get the parents' copies earlier

This remove some conditional nesting and prepare for future work were we will
unify the handling of copies from p1 and p2.

Differential Revision: https://phab.mercurial-scm.org/D9646
parent ab140755dea9
No related merge requests found
......@@ -397,9 +397,10 @@
// 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,
......@@ -403,23 +404,11 @@
&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,
......@@ -423,4 +412,14 @@
&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,
);
......@@ -426,11 +425,14 @@
);
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,
);
......@@ -436,20 +438,19 @@
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) => {
......
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