Page MenuHomePhabricator

hgext: start building a library for simple hooks
Needs ReviewPublic

Authored by joerg.sonnenberger on Sep 7 2019, 8:50 AM.

Details

Reviewers
baymax
Group Reviewers
hg-reviewers
Summary

Many workflows depend on hooks to enforce certain policies, e.g. to
prevent forced pushes. The Mercurial Guide includes some cases and
Google can help finding others, but it can save users a lot of time
if hg itself has a couple of examples for further customization.

Diff Detail

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

Event Timeline

pulkit added a subscriber: pulkit.Sep 7 2019, 12:20 PM

Thanks a lot for putting efforts here. I am +1 on this. I haven't looked at the code though, will try to review if no one else beats me to it.

I think we should go a step further and have some built-in hooks in Mercurial itself, like we do extensions. A good first implementation would be to define those hooks somewhere where they can be imported, add tests like they are standalone hooks. As a follow-up (read: slightly more work), we can define a new config syntax for using these hooks. e.g. builtin:reject_new_heads.

What do others think?

I like where this is going, but I wonder if these specific hooks can be written without being in-process Python hooks. Reason being that Python hooks use the unstable internals of hg and are semi-discouraged if they're avoidable.

Thoughts?

If you do stick with in-process for this, I definitely want a test included so we don't regress our own examples. ;)

I like where this is going, but I wonder if these specific hooks can be written without being in-process Python hooks. Reason being that Python hooks use the unstable internals of hg and are semi-discouraged if they're avoidable.

This is exactly why I think the Python hooks should be part of the modules shipped as part of the core distribution :)

baymax requested changes to this revision.Fri, Jan 24, 12:32 PM

There seems to have been no activities on this Diff for the past 3 Months.

By policy, we are automatically moving it out of the need-review state.

Please, move it back to need-review without hesitation if this diff should still be discussed.

:baymax:need-review-idle:

This revision now requires changes to proceed.Fri, Jan 24, 12:32 PM
joerg.sonnenberger retitled this revision from contrib: start building a library for simple hooks to hgext: start building a library for simple hooks.Sun, Feb 16, 12:03 AM
joerg.sonnenberger updated this revision to Diff 20249.