Page MenuHomePhabricator

chgserver: catch RepoError while loading configuration
ClosedPublic

Authored by pulkit on Nov 30 2020, 4:42 AM.

Details

Summary

Recent share safe work introduced functionality to read share source config file
on dispatch. This can result in RepoError while reading config file as the
shared source might not be present.

test-share.t#safe was failing with chg earlier because of this.

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

pulkit created this revision.Nov 30 2020, 4:42 AM
marmoute accepted this revision.Nov 30 2020, 4:48 AM
marmoute added a subscriber: marmoute.

Looks okay. Alternatively, you could have a try: except Exception: with a re-raise. But the current code is "good enough" and we need these tests green.

mharbison72 added inline comments.
mercurial/chgserver.py
513

Does the error need stringutil.forcebytestr()? I see it in some places but not others, and am not sure the difference. Maybe hg errors don't need it but python exceptions do?

515

Needs bytes? (I can fix in flight, I just wanted to confirm).

pulkit updated this revision to Diff 23927.Dec 2 2020, 2:43 AM
pulkit marked 2 inline comments as done.Dec 2 2020, 2:44 AM
pulkit added inline comments.
mercurial/chgserver.py
513

My understanding is hg expections don't need it in general but RepoError can contain path in local encoding (IIUC). Hence added stringutil.forvebytestr().

marmoute accepted this revision.Dec 2 2020, 3:05 AM
mharbison72 accepted this revision.Dec 2 2020, 9:55 AM
This revision is now accepted and ready to land.Dec 2 2020, 9:55 AM
pulkit marked an inline comment as done.Dec 2 2020, 9:58 AM
This revision was automatically updated to reflect the committed changes.