[PATCH 1 of 4 RFC] hook: have a generic hook for transaction opening

Gregory Szorc gregory.szorc at gmail.com
Sat Mar 14 12:42:06 CDT 2015


On Tue, Mar 10, 2015 at 9:15 AM, Pierre-Yves David <
pierre-yves.david at ens-lyon.org> wrote:

>
> I've no sample usecase for txnopen, but it is very cheap to add and I
> guess some extension//baroque setup will be very happy to have some
> official way to control//record transaction opening.
>

Assuming all repository mutations occur inside transactions, a "transaction
opening" hook would be a great place to put a "the repo is
closed/read-only" hook, no? Today, you have to hook multiple places:
changegroup and pushkey. I would welcome a single hook.


> We could also move it a bit further to right after the transaction have
> been openened (or add a new hooks for that). So that its easy to add data
> in the transaction after it is open.
>
> Maybe we should have a hook for aborted transaction too. But yet again
> I've no specific usecase in mind.
>

Mozilla's pushlog extension uses a SQLite database to record the who, what,
and when of a push from the server's perspective. We currently do an
internal "hook" of transaction abort so we can roll back the SQL
transaction. While our code is an extension and not using hooks, presumably
an out-of-process hook could want similar behavior. Although, I concede
it's likely of marginal utility.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20150314/0ae74bc9/attachment.html>


More information about the Mercurial-devel mailing list