This is an archive of the discontinued Mercurial Phabricator instance.

rewriteutil: add utility to check whether empty successors should be skipped
ClosedPublic

Authored by mjacob on Jul 14 2020, 11:32 AM.

Diff Detail

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

Event Timeline

mjacob created this revision.Jul 14 2020, 11:32 AM
martinvonz added inline comments.Jul 14 2020, 12:15 PM
mercurial/rewriteutil.py
65–72

I think we usually treat bad config as no config, i.e. use the default ("skip" in this case). You may want to check if I seem to be right about that.

mjacob added inline comments.Jul 14 2020, 12:26 PM
mercurial/rewriteutil.py
65–72

I found cases where an error was raised if an invalid value was used, e.g. https://phab.mercurial-scm.org/diffusion/HG/browse/default/mercurial/merge.py$605

I think that errors should never pass silently. I might sent patches (after the next release) to make it possible to enumerate all legal values in configitems and raise an error if another value was specified.

Alphare accepted this revision.Jul 15 2020, 11:26 AM
Alphare added a subscriber: Alphare.
Alphare added inline comments.
mercurial/rewriteutil.py
65–72

I also feel like this "bad config is no config" has only bitten me and never been a feature, I vote for the ConfigError.

martinvonz added inline comments.
mercurial/rewriteutil.py
65–72

I also feel like this "bad config is no config" has only bitten me and never been a feature

I agree. I was trying to think what the reason for ignoring bad config might be. I tried to think if backward- or forward-compatibility would explain it, but I can't think of a scenario where it makes sense to allow bad config. @durin42, do you know why we've mostly allowed bad config?

pulkit accepted this revision.Jul 17 2020, 2:35 PM
This revision is now accepted and ready to land.Jul 17 2020, 2:35 PM
mjacob closed this revision.Jul 17 2020, 2:36 PM