Page MenuHomePhabricator

copies-rust: refactor the "deletion" case
Needs ReviewPublic

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

Details

Reviewers
Alphare
Group Reviewers
hg-reviewers
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.Mon, Dec 21, 5:28 PM
marmoute updated this revision to Diff 24490.Tue, Dec 22, 9:12 PM
baymax updated this revision to Diff 24501.Tue, Dec 22, 9:46 PM

✅ refresh by Heptapod after a successful CI run (🐙 💚)

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

✅ refresh by Heptapod after a successful CI run (🐙 💚)

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

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

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

<suspiciously looking at map(…)>

How would that work ?

Alphare added inline comments.Fri, Jan 8, 10:03 AM
rust/hg-core/src/copy_tracing.rs
514
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.Fri, Jan 8, 10:42 AM
rust/hg-core/src/copy_tracing.rs
514

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

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

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.Fri, Jan 8, 10:43 AM
baymax updated this revision to Diff 24676.Fri, Jan 8, 6:16 PM

✅ refresh by Heptapod after a successful CI run (🐙 💚)