This is an archive of the discontinued Mercurial Phabricator instance.

rewriteutil: check for divergence

Authored by martinvonz on Apr 27 2021, 6:53 PM.



This code is adapted from the code in the evolve extension. It seems
to be equivalent as far as the evolve extension's test suite can tell
(the only impact when making their precheck() delegate to our
version is that error messages are less detailed).

I had to change the error message to work with "change branch of"
being inserted as the action.

Diff Detail

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

Event Timeline

martinvonz created this revision.Apr 27 2021, 6:53 PM
martinvonz edited the summary of this revision. (Show Details)Apr 27 2021, 7:03 PM
pulkit added a subscriber: pulkit.Apr 28 2021, 6:23 AM
pulkit added inline comments.

s/of of/ of

pulkit accepted this revision.Apr 28 2021, 6:23 AM
This revision is now accepted and ready to land.Apr 28 2021, 6:23 AM
martinvonz added inline comments.Apr 28 2021, 11:43 AM

Good catch. The bug was actually already there: we sometimes would say "cannot change branch of while merging". It's a consequence of the simplistic way we produce these messages. We simply insert something that should be a verb into a sentence. I assume that's also not great for i18n. I suppose we could change the "verb" from "change branch of" to "branch-change", so it becomes these:

"cannot branch-change the null revision"
"cannot branch-change while merging"
"cannot branch-change public changesets"
"cannot branch-change changeset with children"
"branch-change of 3938acfb5c0f creates content-divergence with 7c1991464886'"

But it's probably better to change the messages to fit better. In
"cannot change branch of the null revision"
"cannot change branch of changeset while merging" (added "changeset")
"cannot change branch of public changesets"
"cannot change branch of changeset with children"
"cannot change branch of 3938acfb5c0f, as that creates content-divergence with 7c1991464886'"

I'll do the latter.

This revision was automatically updated to reflect the committed changes.