##// END OF EJS Templates
copies-rust: pre-introduce a PathToken type and use it where applicable...
marmoute -
r46745:818502d2 default
parent child Browse files
Show More
@@ -11,17 +11,19 b' use std::convert::TryInto;'
11
11
12 pub type PathCopies = HashMap<HgPathBuf, HgPathBuf>;
12 pub type PathCopies = HashMap<HgPathBuf, HgPathBuf>;
13
13
14 type PathToken = HgPathBuf;
15
14 #[derive(Clone, Debug, PartialEq)]
16 #[derive(Clone, Debug, PartialEq)]
15 struct TimeStampedPathCopy {
17 struct TimeStampedPathCopy {
16 /// revision at which the copy information was added
18 /// revision at which the copy information was added
17 rev: Revision,
19 rev: Revision,
18 /// the copy source, (Set to None in case of deletion of the associated
20 /// the copy source, (Set to None in case of deletion of the associated
19 /// key)
21 /// key)
20 path: Option<HgPathBuf>,
22 path: Option<PathToken>,
21 }
23 }
22
24
23 /// maps CopyDestination to Copy Source (+ a "timestamp" for the operation)
25 /// maps CopyDestination to Copy Source (+ a "timestamp" for the operation)
24 type TimeStampedPathCopies = OrdMap<HgPathBuf, TimeStampedPathCopy>;
26 type TimeStampedPathCopies = OrdMap<PathToken, TimeStampedPathCopy>;
25
27
26 /// hold parent 1, parent 2 and relevant files actions.
28 /// hold parent 1, parent 2 and relevant files actions.
27 pub type RevInfo<'a> = (Revision, Revision, ChangedFiles<'a>);
29 pub type RevInfo<'a> = (Revision, Revision, ChangedFiles<'a>);
@@ -467,7 +469,7 b' fn merge_copies_dict<A: Fn(Revision, Rev'
467 // actively working on this code. Feel free to re-inline it once this
469 // actively working on this code. Feel free to re-inline it once this
468 // code is more settled.
470 // code is more settled.
469 let mut cmp_value =
471 let mut cmp_value =
470 |dest: &HgPathBuf,
472 |dest: &PathToken,
471 src_minor: &TimeStampedPathCopy,
473 src_minor: &TimeStampedPathCopy,
472 src_major: &TimeStampedPathCopy| {
474 src_major: &TimeStampedPathCopy| {
473 compare_value(changes, oracle, dest, src_minor, src_major)
475 compare_value(changes, oracle, dest, src_minor, src_major)
@@ -525,10 +527,10 b' fn merge_copies_dict<A: Fn(Revision, Rev'
525 let mut override_minor = Vec::new();
527 let mut override_minor = Vec::new();
526 let mut override_major = Vec::new();
528 let mut override_major = Vec::new();
527
529
528 let mut to_major = |k: &HgPathBuf, v: &TimeStampedPathCopy| {
530 let mut to_major = |k: &PathToken, v: &TimeStampedPathCopy| {
529 override_major.push((k.clone(), v.clone()))
531 override_major.push((k.clone(), v.clone()))
530 };
532 };
531 let mut to_minor = |k: &HgPathBuf, v: &TimeStampedPathCopy| {
533 let mut to_minor = |k: &PathToken, v: &TimeStampedPathCopy| {
532 override_minor.push((k.clone(), v.clone()))
534 override_minor.push((k.clone(), v.clone()))
533 };
535 };
534
536
@@ -602,7 +604,7 b' enum MergePick {'
602 fn compare_value<A: Fn(Revision, Revision) -> bool>(
604 fn compare_value<A: Fn(Revision, Revision) -> bool>(
603 changes: &ChangedFiles,
605 changes: &ChangedFiles,
604 oracle: &mut AncestorOracle<A>,
606 oracle: &mut AncestorOracle<A>,
605 dest: &HgPathBuf,
607 dest: &PathToken,
606 src_minor: &TimeStampedPathCopy,
608 src_minor: &TimeStampedPathCopy,
607 src_major: &TimeStampedPathCopy,
609 src_major: &TimeStampedPathCopy,
608 ) -> MergePick {
610 ) -> MergePick {
General Comments 0
You need to be logged in to leave comments. Login now