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

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Mar 24 18:40:43 CDT 2015



On 03/14/2015 10:42 AM, Gregory Szorc wrote:
> On Tue, Mar 10, 2015 at 9:15 AM, Pierre-Yves David
> <pierre-yves.david at ens-lyon.org <mailto: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.

Such hook would probably makes a lot of sense. But in that case we 
probably need to pass some kind of transaction identifier in such hook 
to lets hook call to relate to each other.

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list