comparison mercurial/help/config.txt @ 27739:d6d3cf5fda6f

hooks: add HG_NODE_LAST to txnclose and changegroup hook environments Sometimes a txnclose or changegroup hook wants to iterate through all the changesets in transaction: in that situation usually the revset `$HG_NODE:` is used to select the revisions. Unfortunately this revset sometimes may contain too many changesets because we don't have the write lock while the hook runs newer changes may be added to repository in the meantime. That's why there is a need for extra variable carrying the information about the last change in the transaction.
author Mateusz Kwapich <mitrandir@fb.com>
date Tue, 05 Jan 2016 17:37:59 -0800
parents a0e783d26e81
children 6b639caa1652
comparison
equal deleted inserted replaced
27738:a0e783d26e81 27739:d6d3cf5fda6f
760 Most hooks are run with environment variables set that give useful 760 Most hooks are run with environment variables set that give useful
761 additional information. For each hook below, the environment 761 additional information. For each hook below, the environment
762 variables it is passed are listed with names of the form ``$HG_foo``. 762 variables it is passed are listed with names of the form ``$HG_foo``.
763 763
764 ``changegroup`` 764 ``changegroup``
765 Run after a changegroup has been added via push, pull or unbundle. 765 Run after a changegroup has been added via push, pull or unbundle. ID of the
766 ID of the first new changeset is in ``$HG_NODE``. URL from which 766 first new changeset is in ``$HG_NODE`` and last in ``$HG_NODE_LAST``. URL
767 changes came is in ``$HG_URL``. 767 from which changes came is in ``$HG_URL``.
768 768
769 ``commit`` 769 ``commit``
770 Run after a changeset has been created in the local repository. ID 770 Run after a changeset has been created in the local repository. ID
771 of the newly created changeset is in ``$HG_NODE``. Parent changeset 771 of the newly created changeset is in ``$HG_NODE``. Parent changeset
772 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. 772 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
844 transaction will be in ``$HG_TXNNAME`` and a unique identifier for the 844 transaction will be in ``$HG_TXNNAME`` and a unique identifier for the
845 transaction will be in ``HG_TXNID``. A non-zero status will prevent the 845 transaction will be in ``HG_TXNID``. A non-zero status will prevent the
846 transaction from being opened. 846 transaction from being opened.
847 847
848 ``pretxnclose`` 848 ``pretxnclose``
849 Run right before the transaction is actually finalized. Any 849 Run right before the transaction is actually finalized. Any repository change
850 repository change will be visible to the hook program. This lets you 850 will be visible to the hook program. This lets you validate the transaction
851 validate the transaction content or change it. Exit status 0 allows 851 content or change it. Exit status 0 allows the commit to proceed. Non-zero
852 the commit to proceed. Non-zero status will cause the transaction to 852 status will cause the transaction to be rolled back. The reason for the
853 be rolled back. The reason for the transaction opening will be in 853 transaction opening will be in ``$HG_TXNNAME`` and a unique identifier for
854 ``$HG_TXNNAME`` and a unique identifier for the transaction will be in 854 the transaction will be in ``HG_TXNID``. The rest of the available data will
855 ``HG_TXNID``. The rest of the available data will vary according the 855 vary according the transaction type. New changesets will add ``$HG_NODE`` (id
856 transaction type. New changesets will add ``$HG_NODE`` (id of the 856 of the first added changeset), ``$HG_NODE_LAST`` (id of the last added
857 first added changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables, 857 changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables, bookmarks and phases
858 bookmarks and phases changes will set ``HG_BOOKMARK_MOVED`` and 858 changes will set ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1``, etc.
859 ``HG_PHASES_MOVED`` to ``1``, etc.
860 859
861 ``txnclose`` 860 ``txnclose``
862 Run after any repository transaction has been committed. At this 861 Run after any repository transaction has been committed. At this
863 point, the transaction can no longer be rolled back. The hook will run 862 point, the transaction can no longer be rolled back. The hook will run
864 after the lock is released. See :hg:`help config.pretxnclose` docs for 863 after the lock is released. See :hg:`help config.pretxnclose` docs for
867 ``txnabort`` 866 ``txnabort``
868 Run when a transaction is aborted. See :hg:`help config.pretxnclose` 867 Run when a transaction is aborted. See :hg:`help config.pretxnclose`
869 docs for details about available variables. 868 docs for details about available variables.
870 869
871 ``pretxnchangegroup`` 870 ``pretxnchangegroup``
872 Run after a changegroup has been added via push, pull or unbundle, 871 Run after a changegroup has been added via push, pull or unbundle, but before
873 but before the transaction has been committed. Changegroup is 872 the transaction has been committed. Changegroup is visible to hook program.
874 visible to hook program. This lets you validate incoming changes 873 This lets you validate incoming changes before accepting them. Passed the ID
875 before accepting them. Passed the ID of the first new changeset in 874 of the first new changeset in ``$HG_NODE`` and last in ``$HG_NODE_LAST``.
876 ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero 875 Exit status 0 allows the transaction to commit. Non-zero status will cause
877 status will cause the transaction to be rolled back and the push, 876 the transaction to be rolled back and the push, pull or unbundle will fail.
878 pull or unbundle will fail. URL that was source of changes is in 877 URL that was source of changes is in ``$HG_URL``.
879 ``$HG_URL``.
880 878
881 ``pretxncommit`` 879 ``pretxncommit``
882 Run after a changeset has been created but the transaction not yet 880 Run after a changeset has been created but the transaction not yet
883 committed. Changeset is visible to hook program. This lets you 881 committed. Changeset is visible to hook program. This lets you
884 validate commit message and changes. Exit status 0 allows the 882 validate commit message and changes. Exit status 0 allows the