With this change, we can ensure every (dest, rev) points to the same value,
making a lots of comparison simpler.
Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
With this change, we can ensure every (dest, rev) points to the same value,
making a lots of comparison simpler.
| No Linters Available |
| No Unit Test Coverage |
| Path | Packages | |||
|---|---|---|---|---|
| M | rust/hg-core/src/copy_tracing.rs (19 lines) |
| Commit | Parents | Author | Summary | Date |
|---|---|---|---|---|
| b503d3baef3e | 2c2fef91d912 | Pierre-Yves David | Dec 16 2020, 5:06 AM |
| /// | /// | ||||
| /// Use this when recording copy information from parent โ child edges | /// Use this when recording copy information from parent โ child edges | ||||
| fn mark_delete(&mut self, rev: Revision) { | fn mark_delete(&mut self, rev: Revision) { | ||||
| self.overwritten.insert(self.rev); | self.overwritten.insert(self.rev); | ||||
| self.rev = rev; | self.rev = rev; | ||||
| self.path = None; | self.path = None; | ||||
| } | } | ||||
| /// Mark pre-existing copy information as "dropped" by a file deletion | |||||
| /// | |||||
| /// Use this when recording copy information from parent โ child edges | |||||
| fn mark_delete_with_pair(&mut self, rev: Revision, other: &Self) { | |||||
| self.overwritten.insert(self.rev); | |||||
| if other.rev != rev { | |||||
| self.overwritten.insert(other.rev); | |||||
| } | |||||
| self.overwritten.extend(other.overwritten.iter().copied()); | |||||
| self.rev = rev; | |||||
| self.path = None; | |||||
| } | |||||
| fn is_overwritten_by(&self, other: &Self) -> bool { | fn is_overwritten_by(&self, other: &Self) -> bool { | ||||
| other.overwritten.contains(&self.rev) | other.overwritten.contains(&self.rev) | ||||
| } | } | ||||
| } | } | ||||
| /// maps CopyDestination to Copy Source (+ a "timestamp" for the operation) | /// maps CopyDestination to Copy Source (+ a "timestamp" for the operation) | ||||
| type InternalPathCopies = OrdMap<PathToken, CopySource>; | type InternalPathCopies = OrdMap<PathToken, CopySource>; | ||||
| (None, None) => (), | (None, None) => (), | ||||
| (Some(mut e), None) => { | (Some(mut e), None) => { | ||||
| e.get_mut().mark_delete(current_rev) | e.get_mut().mark_delete(current_rev) | ||||
| } | } | ||||
| (None, Some(mut e)) => { | (None, Some(mut e)) => { | ||||
| e.get_mut().mark_delete(current_rev) | e.get_mut().mark_delete(current_rev) | ||||
| } | } | ||||
| (Some(mut e1), Some(mut e2)) => { | (Some(mut e1), Some(mut e2)) => { | ||||
| e1.get_mut().mark_delete(current_rev); | let cs1 = e1.get_mut(); | ||||
| e2.get_mut().mark_delete(current_rev); | let cs2 = e2.get(); | ||||
| cs1.mark_delete_with_pair(current_rev, &cs2); | |||||
| e2.insert(cs1.clone()); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| (p1_copies, p2_copies) | (p1_copies, p2_copies) | ||||
| } | } | ||||