Show More
@@ -503,31 +503,14 b' fn add_from_changes(' | |||||
503 | for action in changes.iter_actions(parent) { |
|
503 | for action in changes.iter_actions(parent) { | |
504 | match action { |
|
504 | match action { | |
505 | Action::Copied(path_dest, path_source) => { |
|
505 | Action::Copied(path_dest, path_source) => { | |
506 | let dest = path_map.tokenize(path_dest); |
|
506 | add_one_copy( | |
507 | let source = path_map.tokenize(path_source); |
|
507 | current_rev, | |
508 |
|
|
508 | &mut path_map, | |
509 | if let Some(v) = base_copies.get(&source) { |
|
509 | &mut copies, | |
510 |
|
|
510 | &base_copies, | |
511 | Some(path) => Some((*(path)).to_owned()), |
|
511 | path_dest, | |
512 |
|
|
512 | path_source, | |
513 |
|
|
513 | ); | |
514 | } else { |
|
|||
515 | entry = Some(source.to_owned()); |
|
|||
516 | } |
|
|||
517 | // Each new entry is introduced by the children, we |
|
|||
518 | // record this information as we will need it to take |
|
|||
519 | // the right decision when merging conflicting copy |
|
|||
520 | // information. See merge_copies_dict for details. |
|
|||
521 | match copies.entry(dest) { |
|
|||
522 | Entry::Vacant(slot) => { |
|
|||
523 | let ttpc = CopySource::new(current_rev, entry); |
|
|||
524 | slot.insert(ttpc); |
|
|||
525 | } |
|
|||
526 | Entry::Occupied(mut slot) => { |
|
|||
527 | let ttpc = slot.get_mut(); |
|
|||
528 | ttpc.overwrite(current_rev, entry); |
|
|||
529 | } |
|
|||
530 | } |
|
|||
531 | } |
|
514 | } | |
532 | Action::Removed(deleted_path) => { |
|
515 | Action::Removed(deleted_path) => { | |
533 | // We must drop copy information for removed file. |
|
516 | // We must drop copy information for removed file. | |
@@ -545,6 +528,44 b' fn add_from_changes(' | |||||
545 | copies |
|
528 | copies | |
546 | } |
|
529 | } | |
547 |
|
530 | |||
|
531 | // insert one new copy information in an InternalPathCopies | |||
|
532 | // | |||
|
533 | // This deal with chaining and overwrite. | |||
|
534 | fn add_one_copy( | |||
|
535 | current_rev: Revision, | |||
|
536 | path_map: &mut TwoWayPathMap, | |||
|
537 | copies: &mut InternalPathCopies, | |||
|
538 | base_copies: &InternalPathCopies, | |||
|
539 | path_dest: &HgPath, | |||
|
540 | path_source: &HgPath, | |||
|
541 | ) { | |||
|
542 | let dest = path_map.tokenize(path_dest); | |||
|
543 | let source = path_map.tokenize(path_source); | |||
|
544 | let entry; | |||
|
545 | if let Some(v) = base_copies.get(&source) { | |||
|
546 | entry = match &v.path { | |||
|
547 | Some(path) => Some((*(path)).to_owned()), | |||
|
548 | None => Some(source.to_owned()), | |||
|
549 | } | |||
|
550 | } else { | |||
|
551 | entry = Some(source.to_owned()); | |||
|
552 | } | |||
|
553 | // Each new entry is introduced by the children, we | |||
|
554 | // record this information as we will need it to take | |||
|
555 | // the right decision when merging conflicting copy | |||
|
556 | // information. See merge_copies_dict for details. | |||
|
557 | match copies.entry(dest) { | |||
|
558 | Entry::Vacant(slot) => { | |||
|
559 | let ttpc = CopySource::new(current_rev, entry); | |||
|
560 | slot.insert(ttpc); | |||
|
561 | } | |||
|
562 | Entry::Occupied(mut slot) => { | |||
|
563 | let ttpc = slot.get_mut(); | |||
|
564 | ttpc.overwrite(current_rev, entry); | |||
|
565 | } | |||
|
566 | } | |||
|
567 | } | |||
|
568 | ||||
548 | /// merge two copies-mapping together, minor and major |
|
569 | /// merge two copies-mapping together, minor and major | |
549 | /// |
|
570 | /// | |
550 | /// In case of conflict, value from "major" will be picked, unless in some |
|
571 | /// In case of conflict, value from "major" will be picked, unless in some |
General Comments 0
You need to be logged in to leave comments.
Login now