Page MenuHomePhabricator

url_util: introduce a `try_path` function
ClosedPublic

Authored by marmoute on Apr 15 2021, 4:52 AM.

Details

Summary

That function… try a build a path, returning None on failure. This helps us to simplify various part of the existing code.

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.Apr 15 2021, 4:52 AM
marmoute updated this revision to Diff 26946.Apr 15 2021, 10:39 AM
baymax updated this revision to Diff 27006.Apr 17 2021, 7:39 PM

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

Alphare added inline comments.
mercurial/utils/urlutil.py
454

s/are/as/

622

This adds a lookup, why remove the initial KeyError handling?

marmoute added inline comments.Apr 20 2021, 10:51 AM
mercurial/utils/urlutil.py
622

This make the flow clearer, and I don't expect it to be a performance issue. We could also use get, but againt, I don't expect a real difference here.

Alphare accepted this revision.Apr 21 2021, 4:14 AM
Alphare added inline comments.
mercurial/utils/urlutil.py
622

I'm not convinced this is that much clearer, but it's fine.

This revision is now accepted and ready to land.Apr 21 2021, 4:14 AM
baymax updated this revision to Diff 27216.Apr 29 2021, 1:56 PM

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

pulkit accepted this revision.Apr 30 2021, 5:50 AM
baymax updated this revision to Diff 27225.Apr 30 2021, 7:58 AM

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

This revision was automatically updated to reflect the committed changes.