This is an archive of the discontinued Mercurial Phabricator instance.

copies-rust: refactor the "deletion" case
ClosedPublic

Authored by marmoute on Dec 21 2020, 5:28 PM.

Details

Summary

We rearrange the code to single out the case where information need to be
overwritten on both side of the merge. This open the way to better dealing with
this case.

Diff Detail

Repository
rHG Mercurial
Branch
default
Lint
No Linters Available
Unit
No Unit Test Coverage

Event Timeline

marmoute created this revision.Dec 21 2020, 5:28 PM
marmoute updated this revision to Diff 24490.Dec 22 2020, 9:12 PM
baymax updated this revision to Diff 24501.Dec 22 2020, 9:46 PM

βœ… refresh by Heptapod after a successful CI run (πŸ™ πŸ’š)

baymax updated this revision to Diff 24585.Jan 5 2021, 4:07 AM

βœ… refresh by Heptapod after a successful CI run (πŸ™ πŸ’š)

Alphare requested changes to this revision.Jan 8 2021, 8:52 AM
Alphare added a subscriber: Alphare.
Alphare added inline comments.
rust/hg-core/src/copy_tracing.rs
521

This would be better as p1_copies.map(...)

This revision now requires changes to proceed.Jan 8 2021, 8:52 AM
marmoute added inline comments.Jan 8 2021, 9:45 AM
rust/hg-core/src/copy_tracing.rs
521

<suspiciously looking at map(…)>

How would that work ?

Alphare added inline comments.Jan 8 2021, 10:03 AM
rust/hg-core/src/copy_tracing.rs
521
let p1_entry = p1_copies.as_mut().map(
    |copies| match copies.entry(deleted) {
        Entry::Occupied(e) => Some(e),
        Entry::Vacant(_) => None,
    }
);

You need as_mut() as well.

marmoute added inline comments.Jan 8 2021, 10:42 AM
rust/hg-core/src/copy_tracing.rs
521

This would create Option of Option, so I';ll keep the current code.

Alphare accepted this revision.Jan 8 2021, 10:43 AM
Alphare added inline comments.
rust/hg-core/src/copy_tracing.rs
521

Yeah, I meant Option::and, but it seems like the compiler is not able to infer the closure types. So let's keep it that way.

This revision now requires review to proceed.Jan 8 2021, 10:43 AM
baymax updated this revision to Diff 24676.Jan 8 2021, 6:16 PM

βœ… refresh by Heptapod after a successful CI run (πŸ™ πŸ’š)

baymax updated this revision to Diff 25696.Feb 22 2021, 9:14 AM

βœ… refresh by Heptapod after a successful CI run (πŸ™ πŸ’š)

baymax updated this revision to Diff 25755.Feb 22 2021, 11:21 AM

βœ… refresh by Heptapod after a successful CI run (πŸ™ πŸ’š)

baymax updated this revision to Diff 25794.Feb 22 2021, 5:12 PM

βœ… refresh by Heptapod after a successful CI run (πŸ™ πŸ’š)

This revision was not accepted when it landed; it landed in state Needs Review.
This revision was automatically updated to reflect the committed changes.