|
@@
-861,31
+861,31
b' Example ``.hg/hgrc``::'
|
|
861
|
|
|
861
|
|
|
862
|
Most hooks are run with environment variables set that give useful
|
|
862
|
Most hooks are run with environment variables set that give useful
|
|
863
|
additional information. For each hook below, the environment variables
|
|
863
|
additional information. For each hook below, the environment variables
|
|
864
|
it is passed are listed with names of the form ``$HG_foo``. The
|
|
864
|
it is passed are listed with names in the form ``$HG_foo``. The
|
|
865
|
``$HG_HOOKTYPE`` and ``$HG_HOOKNAME`` variables are set for all hooks.
|
|
865
|
``$HG_HOOKTYPE`` and ``$HG_HOOKNAME`` variables are set for all hooks.
|
|
866
|
their respectively contains the type of hook which triggered the run and
|
|
866
|
They contain the type of hook which triggered the run and the full name
|
|
867
|
the full name of the hooks in the config. In the example about this will
|
|
867
|
of the hook in the config, respectively. In the example above, this will
|
|
868
|
be ``$HG_HOOKTYPE=incoming`` and ``$HG_HOOKNAME=incoming.email``.
|
|
868
|
be ``$HG_HOOKTYPE=incoming`` and ``$HG_HOOKNAME=incoming.email``.
|
|
869
|
|
|
869
|
|
|
870
|
``changegroup``
|
|
870
|
``changegroup``
|
|
871
|
Run after a changegroup has been added via push, pull or unbundle. ID of the
|
|
871
|
Run after a changegroup has been added via push, pull or unbundle. The ID of
|
|
872
|
first new changeset is in ``$HG_NODE`` and last in ``$HG_NODE_LAST``. URL
|
|
872
|
the first new changeset is in ``$HG_NODE`` and last is in ``$HG_NODE_LAST``.
|
|
873
|
from which changes came is in ``$HG_URL``.
|
|
873
|
The URL from which changes came is in ``$HG_URL``.
|
|
874
|
|
|
874
|
|
|
875
|
``commit``
|
|
875
|
``commit``
|
|
876
|
Run after a changeset has been created in the local repository. ID
|
|
876
|
Run after a changeset has been created in the local repository. The ID
|
|
877
|
of the newly created changeset is in ``$HG_NODE``. Parent changeset
|
|
877
|
of the newly created changeset is in ``$HG_NODE``. Parent changeset
|
|
878
|
IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
|
|
878
|
IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
|
|
879
|
|
|
879
|
|
|
880
|
``incoming``
|
|
880
|
``incoming``
|
|
881
|
Run after a changeset has been pulled, pushed, or unbundled into
|
|
881
|
Run after a changeset has been pulled, pushed, or unbundled into
|
|
882
|
the local repository. The ID of the newly arrived changeset is in
|
|
882
|
the local repository. The ID of the newly arrived changeset is in
|
|
883
|
``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``.
|
|
883
|
``$HG_NODE``. The URL that was source of the changes is in ``$HG_URL``.
|
|
884
|
|
|
884
|
|
|
885
|
``outgoing``
|
|
885
|
``outgoing``
|
|
886
|
Run after sending changes from local repository to another. ID of
|
|
886
|
Run after sending changes from the local repository to another. The ID of
|
|
887
|
first changeset sent is in ``$HG_NODE``. Source of operation is in
|
|
887
|
first changeset sent is in ``$HG_NODE``. The source of operation is in
|
|
888
|
``$HG_SOURCE``; Also see :hg:`help config.hooks.preoutgoing` hook.
|
|
888
|
``$HG_SOURCE``. Also see :hg:`help config.hooks.preoutgoing`.
|
|
889
|
|
|
889
|
|
|
890
|
``post-<command>``
|
|
890
|
``post-<command>``
|
|
891
|
Run after successful invocations of the associated command. The
|
|
891
|
Run after successful invocations of the associated command. The
|
|
@@
-917,93
+917,94
b' be ``$HG_HOOKTYPE=incoming`` and ``$HG_H'
|
|
917
|
|
|
917
|
|
|
918
|
``prechangegroup``
|
|
918
|
``prechangegroup``
|
|
919
|
Run before a changegroup is added via push, pull or unbundle. Exit
|
|
919
|
Run before a changegroup is added via push, pull or unbundle. Exit
|
|
920
|
status 0 allows the changegroup to proceed. Non-zero status will
|
|
920
|
status 0 allows the changegroup to proceed. A non-zero status will
|
|
921
|
cause the push, pull or unbundle to fail. URL from which changes
|
|
921
|
cause the push, pull or unbundle to fail. The URL from which changes
|
|
922
|
will come is in ``$HG_URL``.
|
|
922
|
will come is in ``$HG_URL``.
|
|
923
|
|
|
923
|
|
|
924
|
``precommit``
|
|
924
|
``precommit``
|
|
925
|
Run before starting a local commit. Exit status 0 allows the
|
|
925
|
Run before starting a local commit. Exit status 0 allows the
|
|
926
|
commit to proceed. Non-zero status will cause the commit to fail.
|
|
926
|
commit to proceed. A non-zero status will cause the commit to fail.
|
|
927
|
Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
|
|
927
|
Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
|
|
928
|
|
|
928
|
|
|
929
|
``prelistkeys``
|
|
929
|
``prelistkeys``
|
|
930
|
Run before listing pushkeys (like bookmarks) in the
|
|
930
|
Run before listing pushkeys (like bookmarks) in the
|
|
931
|
repository. Non-zero status will cause failure. The key namespace is
|
|
931
|
repository. A non-zero status will cause failure. The key namespace is
|
|
932
|
in ``$HG_NAMESPACE``.
|
|
932
|
in ``$HG_NAMESPACE``.
|
|
933
|
|
|
933
|
|
|
934
|
``preoutgoing``
|
|
934
|
``preoutgoing``
|
|
935
|
Run before collecting changes to send from the local repository to
|
|
935
|
Run before collecting changes to send from the local repository to
|
|
936
|
another. Non-zero status will cause failure. This lets you prevent
|
|
936
|
another. A non-zero status will cause failure. This lets you prevent
|
|
937
|
pull over HTTP or SSH. Also prevents against local pull, push
|
|
937
|
pull over HTTP or SSH. It can also prevent propagating commits (via
|
|
938
|
(outbound) or bundle commands, but not effective, since you can
|
|
938
|
local pull, push (outbound) or bundle commands), but not completely,
|
|
939
|
just copy files instead then. Source of operation is in
|
|
939
|
since you can just copy files instead. The source of operation is in
|
|
940
|
``$HG_SOURCE``. If "serve", operation is happening on behalf of remote
|
|
940
|
``$HG_SOURCE``. If "serve", the operation is happening on behalf of a remote
|
|
941
|
SSH or HTTP repository. If "push", "pull" or "bundle", operation
|
|
941
|
SSH or HTTP repository. If "push", "pull" or "bundle", the operation
|
|
942
|
is happening on behalf of repository on same system.
|
|
942
|
is happening on behalf of a repository on same system.
|
|
943
|
|
|
943
|
|
|
944
|
``prepushkey``
|
|
944
|
``prepushkey``
|
|
945
|
Run before a pushkey (like a bookmark) is added to the
|
|
945
|
Run before a pushkey (like a bookmark) is added to the
|
|
946
|
repository. Non-zero status will cause the key to be rejected. The
|
|
946
|
repository. A non-zero status will cause the key to be rejected. The
|
|
947
|
key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
|
|
947
|
key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
|
|
948
|
the old value (if any) is in ``$HG_OLD``, and the new value is in
|
|
948
|
the old value (if any) is in ``$HG_OLD``, and the new value is in
|
|
949
|
``$HG_NEW``.
|
|
949
|
``$HG_NEW``.
|
|
950
|
|
|
950
|
|
|
951
|
``pretag``
|
|
951
|
``pretag``
|
|
952
|
Run before creating a tag. Exit status 0 allows the tag to be
|
|
952
|
Run before creating a tag. Exit status 0 allows the tag to be
|
|
953
|
created. Non-zero status will cause the tag to fail. ID of
|
|
953
|
created. A non-zero status will cause the tag to fail. The ID of the
|
|
954
|
changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is
|
|
954
|
changeset to tag is in ``$HG_NODE``. The name of tag is in ``$HG_TAG``. The
|
|
955
|
local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``.
|
|
955
|
tag is local if ``$HG_LOCAL=1``, or in the repository if ``$HG_LOCAL=0``.
|
|
956
|
|
|
956
|
|
|
957
|
``pretxnopen``
|
|
957
|
``pretxnopen``
|
|
958
|
Run before any new repository transaction is open. The reason for the
|
|
958
|
Run before any new repository transaction is open. The reason for the
|
|
959
|
transaction will be in ``$HG_TXNNAME`` and a unique identifier for the
|
|
959
|
transaction will be in ``$HG_TXNNAME``, and a unique identifier for the
|
|
960
|
transaction will be in ``HG_TXNID``. A non-zero status will prevent the
|
|
960
|
transaction will be in ``HG_TXNID``. A non-zero status will prevent the
|
|
961
|
transaction from being opened.
|
|
961
|
transaction from being opened.
|
|
962
|
|
|
962
|
|
|
963
|
``pretxnclose``
|
|
963
|
``pretxnclose``
|
|
964
|
Run right before the transaction is actually finalized. Any repository change
|
|
964
|
Run right before the transaction is actually finalized. Any repository change
|
|
965
|
will be visible to the hook program. This lets you validate the transaction
|
|
965
|
will be visible to the hook program. This lets you validate the transaction
|
|
966
|
content or change it. Exit status 0 allows the commit to proceed. Non-zero
|
|
966
|
content or change it. Exit status 0 allows the commit to proceed. A non-zero
|
|
967
|
status will cause the transaction to be rolled back. The reason for the
|
|
967
|
status will cause the transaction to be rolled back. The reason for the
|
|
968
|
transaction opening will be in ``$HG_TXNNAME`` and a unique identifier for
|
|
968
|
transaction opening will be in ``$HG_TXNNAME``, and a unique identifier for
|
|
969
|
the transaction will be in ``HG_TXNID``. The rest of the available data will
|
|
969
|
the transaction will be in ``HG_TXNID``. The rest of the available data will
|
|
970
|
vary according the transaction type. New changesets will add ``$HG_NODE`` (id
|
|
970
|
vary according the transaction type. New changesets will add ``$HG_NODE``
|
|
971
|
of the first added changeset), ``$HG_NODE_LAST`` (id of the last added
|
|
971
|
(the ID of the first added changeset), ``$HG_NODE_LAST`` (the ID of the last
|
|
972
|
changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables, bookmarks and phases
|
|
972
|
added changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables. Bookmark and
|
|
973
|
changes will set ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1``, etc.
|
|
973
|
phase changes will set ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1``
|
|
|
|
|
974
|
respectively, etc.
|
|
974
|
|
|
975
|
|
|
975
|
``txnclose``
|
|
976
|
``txnclose``
|
|
976
|
Run after any repository transaction has been committed. At this
|
|
977
|
Run after any repository transaction has been committed. At this
|
|
977
|
point, the transaction can no longer be rolled back. The hook will run
|
|
978
|
point, the transaction can no longer be rolled back. The hook will run
|
|
978
|
after the lock is released. See :hg:`help config.hooks.pretxnclose` docs for
|
|
979
|
after the lock is released. See :hg:`help config.hooks.pretxnclose` for
|
|
979
|
details about available variables.
|
|
980
|
details about available variables.
|
|
980
|
|
|
981
|
|
|
981
|
``txnabort``
|
|
982
|
``txnabort``
|
|
982
|
Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose`
|
|
983
|
Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose`
|
|
983
|
docs for details about available variables.
|
|
984
|
for details about available variables.
|
|
984
|
|
|
985
|
|
|
985
|
``pretxnchangegroup``
|
|
986
|
``pretxnchangegroup``
|
|
986
|
Run after a changegroup has been added via push, pull or unbundle, but before
|
|
987
|
Run after a changegroup has been added via push, pull or unbundle, but before
|
|
987
|
the transaction has been committed. Changegroup is visible to hook program.
|
|
988
|
the transaction has been committed. The changegroup is visible to the hook
|
|
988
|
This lets you validate incoming changes before accepting them. Passed the ID
|
|
989
|
program. This allows validation of incoming changes before accepting them.
|
|
989
|
of the first new changeset in ``$HG_NODE`` and last in ``$HG_NODE_LAST``.
|
|
990
|
The ID of the first new changeset is in ``$HG_NODE`` and last is in
|
|
990
|
Exit status 0 allows the transaction to commit. Non-zero status will cause
|
|
991
|
``$HG_NODE_LAST``. Exit status 0 allows the transaction to commit. A non-zero
|
|
991
|
the transaction to be rolled back and the push, pull or unbundle will fail.
|
|
992
|
status will cause the transaction to be rolled back, and the push, pull or
|
|
992
|
URL that was source of changes is in ``$HG_URL``.
|
|
993
|
unbundle will fail. The URL that was the source of changes is in ``$HG_URL``.
|
|
993
|
|
|
994
|
|
|
994
|
``pretxncommit``
|
|
995
|
``pretxncommit``
|
|
995
|
Run after a changeset has been created but the transaction not yet
|
|
996
|
Run after a changeset has been created, but before the transaction is
|
|
996
|
committed. Changeset is visible to hook program. This lets you
|
|
997
|
committed. The changeset is visible to the hook program. This allows
|
|
997
|
validate commit message and changes. Exit status 0 allows the
|
|
998
|
validation of the commit message and changes. Exit status 0 allows the
|
|
998
|
commit to proceed. Non-zero status will cause the transaction to
|
|
999
|
commit to proceed. A non-zero status will cause the transaction to
|
|
999
|
be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset
|
|
1000
|
be rolled back. The ID of the new changeset is in ``$HG_NODE``. The parent
|
|
1000
|
IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
|
|
1001
|
changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
|
|
1001
|
|
|
1002
|
|
|
1002
|
``preupdate``
|
|
1003
|
``preupdate``
|
|
1003
|
Run before updating the working directory. Exit status 0 allows
|
|
1004
|
Run before updating the working directory. Exit status 0 allows
|
|
1004
|
the update to proceed. Non-zero status will prevent the update.
|
|
1005
|
the update to proceed. A non-zero status will prevent the update.
|
|
1005
|
Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID
|
|
1006
|
The changeset ID of first new parent is in ``$HG_PARENT1``. If updating to a
|
|
1006
|
of second new parent is in ``$HG_PARENT2``.
|
|
1007
|
merge, the ID of second new parent is in ``$HG_PARENT2``.
|
|
1007
|
|
|
1008
|
|
|
1008
|
``listkeys``
|
|
1009
|
``listkeys``
|
|
1009
|
Run after listing pushkeys (like bookmarks) in the repository. The
|
|
1010
|
Run after listing pushkeys (like bookmarks) in the repository. The
|
|
@@
-1017,20
+1018,20
b' be ``$HG_HOOKTYPE=incoming`` and ``$HG_H'
|
|
1017
|
value is in ``$HG_NEW``.
|
|
1018
|
value is in ``$HG_NEW``.
|
|
1018
|
|
|
1019
|
|
|
1019
|
``tag``
|
|
1020
|
``tag``
|
|
1020
|
Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``.
|
|
1021
|
Run after a tag is created. The ID of the tagged changeset is in ``$HG_NODE``.
|
|
1021
|
Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in
|
|
1022
|
The name of tag is in ``$HG_TAG``. The tag is local if ``$HG_LOCAL=1``, or in
|
|
1022
|
repository if ``$HG_LOCAL=0``.
|
|
1023
|
the repository if ``$HG_LOCAL=0``.
|
|
1023
|
|
|
1024
|
|
|
1024
|
``update``
|
|
1025
|
``update``
|
|
1025
|
Run after updating the working directory. Changeset ID of first
|
|
1026
|
Run after updating the working directory. The changeset ID of first
|
|
1026
|
new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is
|
|
1027
|
new parent is in ``$HG_PARENT1``. If updating to a merge, the ID of second new
|
|
1027
|
in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
|
|
1028
|
parent is in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
|
|
1028
|
update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``.
|
|
1029
|
update failed (e.g. because conflicts were not resolved), ``$HG_ERROR=1``.
|
|
1029
|
|
|
1030
|
|
|
1030
|
.. note::
|
|
1031
|
.. note::
|
|
1031
|
|
|
1032
|
|
|
1032
|
It is generally better to use standard hooks rather than the
|
|
1033
|
It is generally better to use standard hooks rather than the
|
|
1033
|
generic pre- and post- command hooks as they are guaranteed to be
|
|
1034
|
generic pre- and post- command hooks, as they are guaranteed to be
|
|
1034
|
called in the appropriate contexts for influencing transactions.
|
|
1035
|
called in the appropriate contexts for influencing transactions.
|
|
1035
|
Also, hooks like "commit" will be called in all contexts that
|
|
1036
|
Also, hooks like "commit" will be called in all contexts that
|
|
1036
|
generate a commit (e.g. tag) and not just the commit command.
|
|
1037
|
generate a commit (e.g. tag) and not just the commit command.
|