Mercurial > public > mercurial-scm > hg-stable
diff mercurial/help/config.txt @ 24284:ff14b26fe5f4
hook: add a generic hook right before we commit a transaction
We are adding a 'txnclose' hook that will be run right before a transaction is
closed. Hooks running at that time will have access to the full transaction
content through both 'hookargs' content and on-disk reading. They will be able
to abort the transaction.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Mon, 09 Mar 2015 22:50:49 -0700 |
parents | db8679812f84 |
children | 9fbda55c68d7 |
line wrap: on
line diff
--- a/mercurial/help/config.txt Mon Mar 09 22:43:36 2015 -0700 +++ b/mercurial/help/config.txt Mon Mar 09 22:50:49 2015 -0700 @@ -813,15 +813,23 @@ transaction will be in ``$HG_TXNNAME``. A non-zero status will prevent the transaction from being opened. +``pretxnclose`` + Run right before the transaction is actually finalized. Any + repository change will be visible to the hook program. This lets you + validate the transaction content or change it. Exit status 0 allows + the commit to proceed. Non-zero status will cause the transaction to + be rolled back. The reason for the transaction opening will be in + ``$HG_TXNNAME``. The rest of the available data will vary according + the transaction type. New changesets will add + ``$HG_NODE`` (id of the first added changeset), ``$HG_URL`` and + ``$HG_SOURCE`` variables, bookmarks and phases changes will set + ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1``, etc. + ``txnclose`` Run after any repository transaction has been commited. At this point, the transaction can no longer be rolled back. The hook will run - after the lock is released. The reason for the transaction will - be in ``$HG_TXNNAME``. The rest of the available data will vary - according the event that happened during the transaction. New changesets - will add ``$HG_NODE`` (id of the first added changeset), ``$HG_URL`` - and ``$HG_SOURCE`` variables, bookmarks and phases changes will set - ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1``, etc. + after the lock is released. see ``pretxnclose`` docs for details about + available variables. ``pretxnchangegroup`` Run after a changegroup has been added via push, pull or unbundle,