This is an archive of the discontinued Mercurial Phabricator instance.

copies: introduce the hg-cpython wrapper for `combine_changeset_copies`
ClosedPublic

Authored by marmoute on Nov 12 2020, 10:16 AM.

Details

Summary

This patch focus on the hg-cpython part of this work. Bridging the python code
with the new rust code in hg-core. The next patch will actually plug this in
the python code.

The rust code use multiple Python callback, python related error within this
callback are not expected unless they are a programming error or a data
corruption. In addition, these callback will slowly be replaced by native Rust
code. For these reasons, we use will deal with unexpected error within this
callback using rust Panic and let the rust-cpython layer deal with raising a
Python exception.

The code dealing with the ChangedFile instance is repeating itself a lot. I did
not factor these duplication out because that whole code will get replaced by
entirely different one in a handful of changesets.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

marmoute created this revision.Nov 12 2020, 10:16 AM
Alphare requested changes to this revision.Nov 13 2020, 6:21 AM
Alphare added a subscriber: Alphare.
Alphare added inline comments.
rust/hg-cpython/src/copy_tracing.rs
45

Please use multi-line string literals and/or intermediate variables for long messages.

let a = "this is \
        "multi-line";
62

second item*

72

I understand that there is usually a lot of boilerplate involved in hg-cpython, but this is worth refactoring into two functions: one for getting parent copies and one for getting a set.

This revision now requires changes to proceed.Nov 13 2020, 6:21 AM
marmoute added inline comments.Nov 13 2020, 5:39 PM
rust/hg-cpython/src/copy_tracing.rs
72

I got tempted to do so, but eventually did not do it, since that code get replaced in a handful of changeset. I'll update the commit message to point that out.

marmoute edited the summary of this revision. (Show Details)Nov 13 2020, 7:05 PM
marmoute updated this revision to Diff 23493.
Alphare accepted this revision.Nov 16 2020, 6:12 AM
pulkit accepted this revision.Nov 28 2020, 4:42 AM
This revision is now accepted and ready to land.Nov 28 2020, 4:42 AM