This is an archive of the discontinued Mercurial Phabricator instance.

hooklib: fix detection of successors for changeset_obsoleted
ClosedPublic

Authored by joerg.sonnenberger on May 21 2020, 1:07 PM.

Details

Summary

Provide a hook for obsutil.getobsolete to be used with either a
transaction or the changes item of the transaction, since hooks only
have access to the latter. Use that to find the correct list of
revisions with obsmarkers, even new ones, and then filter out revisions
with known successors.

Move the processing from pretxnclose to txnclose as the transaction
access itself is no longer necessary. This is more in line with notify
and ensures that sanity checks can abort the transaction first.

Diff Detail

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

Event Timeline

Adding @marmoute as he knows this topic the best.

pulkit added inline comments.Jul 7 2020, 2:25 PM
mercurial/obsutil.py
491

This should be converted into some if-else with error messages probably. This is some amazing assert which should be avoided.

mercurial/obsutil.py
491

It is exactly the condition from the comment? It's a sanity check for the API contract from my perspective, nothing more.

pulkit added inline comments.Jul 10 2020, 5:59 AM
mercurial/obsutil.py
491

It's better to raise ProgrammingError in such cases.

pulkit accepted this revision.Jul 11 2020, 4:18 AM
This revision is now accepted and ready to land.Jul 11 2020, 4:18 AM