comparison ja/hook.tex @ 780:2a93b1d35990

finished hook.tex
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Sun, 03 May 2009 17:10:09 +0900
parents 69923723e7f9
children 8a3041e6f3cb
comparison
equal deleted inserted replaced
779:69923723e7f9 780:2a93b1d35990
1718 1718
1719 %\subsubsection{Testing and troubleshooting} 1719 %\subsubsection{Testing and troubleshooting}
1720 \subsubsection{$B%F%9%H$HLdBj2r7h(B} 1720 \subsubsection{$B%F%9%H$HLdBj2r7h(B}
1721 1721
1722 %Do not forget that by default, the \hgext{notify} extension \emph{will 1722 %Do not forget that by default, the \hgext{notify} extension \emph{will
1723
1724 % not send any mail} until you explicitly configure it to do so, by 1723 % not send any mail} until you explicitly configure it to do so, by
1725 %setting \rcitem{notify}{test} to \texttt{false}. Until you do that, 1724 %setting \rcitem{notify}{test} to \texttt{false}. Until you do that,
1726 %it simply prints the message it \emph{would} send. 1725 %it simply prints the message it \emph{would} send.
1727 1726
1728 $B%G%U%)%k%H$G$O(B\hgext{notify}$B%(%/%9%F%s%7%g%s$O(B\emph{$B%a!<%k$rAw?.$7$J$$(B}$B$3(B 1727 $B%G%U%)%k%H$G$O(B\hgext{notify}$B%(%/%9%F%s%7%g%s$O(B\emph{$B%a!<%k$rAw?.$7$J$$(B}$B$3(B
1802 $BNs$+$i%P%$%J%j$KJQ49$9$k$K$O(B\pymodfunc{mercurial.node}{bin}$B4X?t$rMQ$$$k!%(B 1801 $BNs$+$i%P%$%J%j$KJQ49$9$k$K$O(B\pymodfunc{mercurial.node}{bin}$B4X?t$rMQ$$$k!%(B
1803 1802
1804 %\subsection{External hook execution} 1803 %\subsection{External hook execution}
1805 \subsection{$B%U%C%/$N30It<B9T(B} 1804 \subsection{$B%U%C%/$N30It<B9T(B}
1806 1805
1807 An external hook is passed to the shell of the user running Mercurial. 1806 %An external hook is passed to the shell of the user running Mercurial.
1808 Features of that shell, such as variable substitution and command 1807 %Features of that shell, such as variable substitution and command
1809 redirection, are available. The hook is run in the root directory of 1808 %redirection, are available. The hook is run in the root directory of
1810 the repository (unlike in-process hooks, which are run in the same 1809 %the repository (unlike in-process hooks, which are run in the same
1811 directory that Mercurial was run in). 1810 %directory that Mercurial was run in).
1812 1811
1813 Hook parameters are passed to the hook as environment variables. Each 1812 $B30It%U%C%/$O(BMercurial$B$r<B9T$7$F$$$k%7%'%k$G<B9T$5$l$k!%JQ?t$NCV49$d%3%^%s(B
1814 environment variable's name is converted in upper case and prefixed 1813 $B%I$N%j%@%$%l%/%H$J$I$N%7%'%k$N5!G=$,MxMQ$G$-$k!%30It%U%C%/$O!$(BMercurial$B$N(B
1815 with the string ``\texttt{HG\_}''. For example, if the name of a 1814 $B<B9T$HF1$8%G%#%l%/%H%jFb$G<B9T$5$l$k%W%m%;%9Fb%U%C%/$H$O0[$J$j!$%j%]%8%H(B
1816 parameter is ``\texttt{node}'', the name of the environment variable 1815 $B%j$N%k!<%H%G%#%l%/%H%j$G<B9T$5$l$k!%(B
1817 representing that parameter will be ``\texttt{HG\_NODE}''. 1816
1818 1817 %Hook parameters are passed to the hook as environment variables. Each
1819 A boolean parameter is represented as the string ``\texttt{1}'' for 1818 %environment variable's name is converted in upper case and prefixed
1820 ``true'', ``\texttt{0}'' for ``false''. If an environment variable is 1819 %with the string ``\texttt{HG\_}''. For example, if the name of a
1821 named \envar{HG\_NODE}, \envar{HG\_PARENT1} or \envar{HG\_PARENT2}, it 1820 %parameter is ``\texttt{node}'', the name of the environment variable
1822 contains a changeset ID represented as a hexadecimal string. The 1821 %representing that parameter will be ``\texttt{HG\_NODE}''.
1823 empty string is used to represent ``null changeset ID'' instead of a 1822
1824 string of zeroes. If an environment variable is named 1823 $B%U%C%/%Q%i%a!<%?$O%U%C%/$K4D6-JS%9%H$7$FEO$5$l$k!%3F!9$N4D6-JQ?tL>$OBgJ8(B
1825 \envar{HG\_URL}, it will contain the URL of a remote repository, if 1824 $B;z$KJQ49$5$l!$@\F,<-(B``\texttt{HG\_}''$B$,IU$1$i$l$k!%Nc$($P(B
1826 that can be determined. 1825 ``\texttt{node}''$B$H$$$&%Q%i%a!<%?$,;H$o$l$?$H$9$k$H!$$3$N%Q%i%a!<%?$rI=(B
1827 1826 $B$94D6-JQ?tL>$O(B``\texttt{HG\_NODE}''$B$H$J$k!%(B
1828 If a hook exits with a status of zero, it is considered to have 1827
1829 succeeded. If it exits with a non-zero status, it is considered to 1828 %A boolean parameter is represented as the string ``\texttt{1}'' for
1830 have failed. 1829 %``true'', ``\texttt{0}'' for ``false''. If an environment variable is
1830 %named \envar{HG\_NODE}, \envar{HG\_PARENT1} or \envar{HG\_PARENT2}, it
1831 %contains a changeset ID represented as a hexadecimal string. The
1832 %empty string is used to represent ``null changeset ID'' instead of a
1833 %string of zeroes. If an environment variable is named
1834 %\envar{HG\_URL}, it will contain the URL of a remote repository, if
1835 %that can be determined.
1836
1837 $B%V!<%kCM%Q%i%a!<%?$K$D$$$F$O!$??$,(B``\texttt{1}''$B!$56$,(B``\texttt{0}''$B$HI=(B
1838 $B8=$5$l$k!%(B\envar{HG\_NODE}$B!$(B\envar{HG\_PARENT1}$B!$(B\envar{HG\_PARENT2}$B$H$$(B
1839 $B$&4D6-JQ?t$,Dj5A$5$l$F$$$k$H$-!$$3$l$i$O(B16$B?J?t$NJ8;zNs$GI=$5$l$?%A%'%s%8(B
1840 $B%;%C%H(BID$B$r4^$`!%(B``$B%L%k%A%'%s%8%;%C%H(BID''$B$rI=8=$9$k$?$a$K%<%m$G$J$/6u$NJ8(B
1841 $B;zNs$,MQ$$$i$l$k!%4D6-JQ?t$,(B\envar{HG\_URL}$B$G$"$k$H$-!$%j%b!<%H%j%]%8%H%j(B
1842 $B$,FCDj$G$-$l$P!$$=$N(BURL$B$,F~$k!%(B
1843
1844 %If a hook exits with a status of zero, it is considered to have
1845 %succeeded. If it exits with a non-zero status, it is considered to
1846 %have failed.
1847
1848 $B%U%C%/$,%9%F!<%?%9(B0$B$G=*N;$7$?>l9g$O@.8y$H8+$J$5$l$k!%(B0$B0J30$N%9%F!<%?%9$G(B
1849 $B=*N;$7$?>l9g$O<B9T$,<:GT$7$?$H8+$J$5$l$k!%(B
1831 1850
1832 %\subsection{Finding out where changesets come from} 1851 %\subsection{Finding out where changesets come from}
1833 \subsection{$B%A%'%s%8%;%C%H$N=P=h$rD4$Y$k(B} 1852 \subsection{$B%A%'%s%8%;%C%H$N%=!<%9$rD4$Y$k(B}
1834 1853
1835 A hook that involves the transfer of changesets between a local 1854 %A hook that involves the transfer of changesets between a local
1836 repository and another may be able to find out information about the 1855 %repository and another may be able to find out information about the
1837 ``far side''. Mercurial knows \emph{how} changes are being 1856 %``far side''. Mercurial knows \emph{how} changes are being
1838 transferred, and in many cases \emph{where} they are being transferred 1857 %transferred, and in many cases \emph{where} they are being transferred
1839 to or from. 1858 %to or from.
1859
1860 $B%m!<%+%k$J%j%]%8%H%j!&B>$N%j%]%8%H%j4V$N%A%'%s%8%;%C%H$NE>Aw$K4XO"$7$?%U%C(B
1861 $B%/$O!$1s3VCO$N>pJs$rF@$k$3$H$,$G$-$k!%(BMercurial$B$O(B\emph{$B$I$N$h$&$K(B}$BJQ99$,(B
1862 $BE>Aw$5$l$k$+!$$^$?B?$/$N>l9g(B\emph{$B$I$3$X(B}$B!$$"$k$$$O(B\emph{$B$I$3$+$i(B}$BE>Aw$5(B
1863 $B$l$k$N$+$bCN$k$3$H$,$G$-$k!%(B
1840 1864
1841 %\subsubsection{Sources of changesets} 1865 %\subsubsection{Sources of changesets}
1842 \subsubsection{$B%A%'%s%8%;%C%H$N=P=h(B} 1866 \subsubsection{$B%A%'%s%8%;%C%H$N%=!<%9(B}
1843 \label{sec:hook:sources} 1867 \label{sec:hook:sources}
1844 1868
1845 Mercurial will tell a hook what means are, or were, used to transfer 1869 %Mercurial will tell a hook what means are, or were, used to transfer
1846 changesets between repositories. This is provided by Mercurial in a 1870 %changesets between repositories. This is provided by Mercurial in a
1847 Python parameter named \texttt{source}, or an environment variable named 1871 %Python parameter named \texttt{source}, or an environment variable named
1848 \envar{HG\_SOURCE}. 1872 %\envar{HG\_SOURCE}.
1873
1874 Mercurial$B$O%U%C%/$K%A%'%s%8%;%C%H$NFbMF!$%j%]%8%H%j4V$NE>AwJ}K!$J$I$rDLCN(B
1875 $B$9$k!%(B Mercurial$B$ODLCN$N$?$a$K(B\texttt{source}$B$H$$$&(BPython$B%Q%i%a!<%?$^$?$O(B
1876 \envar{HG\_SOURCE}$B$H$$$&4D6-JQ?t$rMQ$$$k!%(B
1877
1878 %\begin{itemize}
1879 %\item[\texttt{serve}] Changesets are transferred to or from a remote
1880 % repository over http or ssh.
1881 %\item[\texttt{pull}] Changesets are being transferred via a pull from
1882 % one repository into another.
1883 %\item[\texttt{push}] Changesets are being transferred via a push from
1884 % one repository into another.
1885 %\item[\texttt{bundle}] Changesets are being transferred to or from a
1886 % bundle.
1887 %\end{itemize}
1849 1888
1850 \begin{itemize} 1889 \begin{itemize}
1851 \item[\texttt{serve}] Changesets are transferred to or from a remote 1890 \item[\texttt{serve}] $B%A%'%s%8%;%C%H$O%j%b!<%H%j%]%8%H%j$+$i(Bhttp$B$^$?$O(B
1852 repository over http or ssh. 1891 ssh$B$GE>Aw$5$l$?!%(B
1853 \item[\texttt{pull}] Changesets are being transferred via a pull from 1892 \item[\texttt{pull}] $B%A%'%s%8%;%C%H$O(B2$B$D$N%j%]%8%H%j4V$r(Bpull$B$K$h$C$FE>Aw(B
1854 one repository into another. 1893 $B$5$l$?!%(B
1855 \item[\texttt{push}] Changesets are being transferred via a push from 1894 \item[\texttt{push}] $B%A%'%s%8%;%C%H$O(B2$B$D$N%j%]%8%H%j4V$r(Bpush$B$K$h$C$FE>Aw(B
1856 one repository into another. 1895 $B$5$l$?!%(B
1857 \item[\texttt{bundle}] Changesets are being transferred to or from a 1896 \item[\texttt{bundle}] $B%A%'%s%8%;%C%H$O%P%s%I%k$K$h$C$FE>Aw$5$l$?!%(B
1858 bundle.
1859 \end{itemize} 1897 \end{itemize}
1860 1898
1861 %\subsubsection{Where changes are going---remote repository URLs} 1899 %\subsubsection{Where changes are going---remote repository URLs}
1862 \subsubsection{$BJQ99$N9T$-@h(B---$B%j%b!<%H%j%]%8%H%j$N(BURL} 1900 \subsubsection{$BJQ99$N9T$-@h(B---$B%j%b!<%H%j%]%8%H%j$N(BURL}
1863 \label{sec:hook:url} 1901 \label{sec:hook:url}
1864 1902
1865 When possible, Mercurial will tell a hook the location of the ``far 1903 %When possible, Mercurial will tell a hook the location of the ``far
1866 side'' of an activity that transfers changeset data between 1904 %side'' of an activity that transfers changeset data between
1867 repositories. This is provided by Mercurial in a Python parameter 1905 %repositories. This is provided by Mercurial in a Python parameter
1868 named \texttt{url}, or an environment variable named \envar{HG\_URL}. 1906 %named \texttt{url}, or an environment variable named \envar{HG\_URL}.
1869 1907
1870 This information is not always known. If a hook is invoked in a 1908 Mercurial$B$O!$2DG=$G$"$k$J$i$P%j%]%8%H%j4V$N%A%'%s%8%;%C%H%G!<%?$NE>Aw$NAj(B
1871 repository that is being served via http or ssh, Mercurial cannot tell 1909 $B<j$N>pJs$r%U%C%/$KDLCN$9$k!%(B Mercurial$B$O(B\texttt{url}$B$H$$$&(BPython$B%Q%i%a!<(B
1872 where the remote repository is, but it may know where the client is 1910 $B%?$^$?$O(B\envar{HG\_URL}$B$H$$$&4D6-JQ?t$r;H$C$FDLCN$r9T$&!%(B
1873 connecting from. In such cases, the URL will take one of the 1911
1874 following forms: 1912 %This information is not always known. If a hook is invoked in a
1913 %repository that is being served via http or ssh, Mercurial cannot tell
1914 %where the remote repository is, but it may know where the client is
1915
1916 %connecting from. In such cases, the URL will take one of the
1917 %following forms:
1918 %\begin{itemize}
1919 %\item \texttt{remote:ssh:\emph{ip-address}}---remote ssh client, at
1920 % the given IP address.
1921 %\item \texttt{remote:http:\emph{ip-address}}---remote http client, at
1922 % the given IP address. If the client is using SSL, this will be of
1923 % the form \texttt{remote:https:\emph{ip-address}}.
1924 %\item Empty---no information could be discovered about the remote
1925 % client.
1926 %\end{itemize}
1927
1928 $B$3$N>pJs$O$$$D$b4{CN$G$"$k!%(Bhttp$B$^$?$O(Bssh$B$G%5!<%S%9$5$l$F$$$k%j%]%8%H%j$+(B
1929 $B$i%U%C%/$,5/F0$5$l$?>l9g!$(BMercurial$B$O%j%b!<%H%j%]%8%H%j$,$I$3$K$"$k$N$+$r(B
1930 $BDLCN$9$k$3$H$O$G$-$J$$$,!$%/%i%$%"%s%H$,$I$3$+$i@\B3$7$F$$$k$N$+$OCN$k$3(B
1931 $B$H$,$G$-$k!%(B
1932
1933 $B$=$N>l9g!$(BURL$B$O<!$N$$$:$l$+$N7A<0$r<h$k!'(B
1875 \begin{itemize} 1934 \begin{itemize}
1876 \item \texttt{remote:ssh:\emph{ip-address}}---remote ssh client, at 1935 \item \texttt{remote:ssh:\emph{ip-address}}---$B$"$k(BIP$B%"%I%l%9>e$N%j%b!<%H(B
1877 the given IP address. 1936 ssh$B%/%i%$%"%s%H(B
1878 \item \texttt{remote:http:\emph{ip-address}}---remote http client, at 1937 \item \texttt{remote:http:\emph{ip-address}}---$B$"$k(BIP$B%"%I%l%9>e$N(Bhttp$B%/(B
1879 the given IP address. If the client is using SSL, this will be of 1938 $B%i%$%"%s%H!%$b$7%/%i%$%"%s%H$,(BSSL$B$r;HMQ$7$F$$$k>l(B
1880 the form \texttt{remote:https:\emph{ip-address}}. 1939 $B9g!$(B\texttt{remote:https:\emph{ip-address}}$B$N$h$&$J7A<0$K$J$k!%(B
1881 \item Empty---no information could be discovered about the remote 1940 \item Empty---$B%j%b!<%H%/%i%$%"%s%H$K4X$9$k>pJs$,$J$$!%(B
1882 client. 1941 \end{itemize}
1942
1943 %\begin{itemize}
1944 %\item \texttt{remote:ssh:\emph{ip-address}}---remote ssh client, at
1945 % the given IP address.
1946 %\item \texttt{remote:http:\emph{ip-address}}---remote http client, at
1947 % the given IP address. If the client is using SSL, this will be of
1948 % the form \texttt{remote:https:\emph{ip-address}}.
1949 %\item Empty---no information could be discovered about the remote
1950 % client.
1951 %\end{itemize}
1952
1953 \begin{itemize}
1954 \item \texttt{remote:ssh:\emph{ip-address}}---$BM?$($i$l$?(BIP$B%"%I%l%9$N%j%b!<(B
1955 $B%H(Bssh$B%/%i%$%"%s%H!%(B
1956 \item \texttt{remote:http:\emph{ip-address}}---$BM?$($i$l$?(BIP$B%"%I%l%9$N%j%b!<(B
1957 $B%H(Bhttp$B%/%i%$%"%s%H!%%/%i%$%"%s%H$,(BSSL$B$r;H$C$F$$$k>l9g$O(B
1958 \texttt{remote:https:\emph{ip-address}}$B$N7A<0$K$J$k!%(B
1959 \item $B6uGr(B---$B%j%b!<%H%/%i%$%"%s%H$K$D$$$F$N>pJs$OF@$i$l$J$+$C$?!%(B
1883 \end{itemize} 1960 \end{itemize}
1884 1961
1885 %\section{Hook reference} 1962 %\section{Hook reference}
1886 \section{$B%U%C%/;2>H(B} 1963 \section{$B%U%C%/;2>H(B}
1887 1964
1888 %\subsection{\hook{changegroup}---after remote changesets added} 1965 %\subsection{\hook{changegroup}---after remote changesets added}
1889 \subsection{\hook{changegroup}---$B%j%b!<%H%A%'%s%8%;%C%H$,DI2C$5$l$?8e(B} 1966 \subsection{\hook{changegroup}---$B%j%b!<%H%A%'%s%8%;%C%H$,DI2C$5$l$?8e(B}
1890 \label{sec:hook:changegroup} 1967 \label{sec:hook:changegroup}
1891 1968
1892 This hook is run after a group of pre-existing changesets has been 1969 %This hook is run after a group of pre-existing changesets has been
1893 added to the repository, for example via a \hgcmd{pull} or 1970 %added to the repository, for example via a \hgcmd{pull} or
1894 \hgcmd{unbundle}. This hook is run once per operation that added one 1971 %\hgcmd{unbundle}. This hook is run once per operation that added one
1895 or more changesets. This is in contrast to the \hook{incoming} hook, 1972 %or more changesets. This is in contrast to the \hook{incoming} hook,
1896 which is run once per changeset, regardless of whether the changesets 1973 %which is run once per changeset, regardless of whether the changesets
1897 arrive in a group. 1974 %arrive in a group.
1898 1975
1899 Some possible uses for this hook include kicking off an automated 1976 $B$3$N%U%C%/$O!$(B\hgcmd{pull}$B$^$?$O(B\hgcmd{unbundle}$B$J$I$G4{B8$N%A%'%s%8%;%C(B
1900 build or test of the added changesets, updating a bug database, or 1977 $B%H%0%k!<%W$,%j%]%8%H%j$KDI2C$5$l$?8e$K<B9T$5$l$k!%$3$N%U%C%/$O!$(B1$B$D0J>e$N(B
1901 notifying subscribers that a repository contains new changes. 1978 $B%A%'%s%8%;%C%H$rDI2C$9$k%*%Z%l!<%7%g%s$K$D$-0lEY<B9T$5$l$k!%%0%k!<%W$K4X(B
1902 1979 $B78$J$/%A%'%s%8%;%C%H(B1$B$DKh$K<B9T$5$l$k(B\hook{incoming}$B%U%C%/$H$OBP>HE*$G$"(B
1903 Parameters to this hook: 1980 $B$k!%(B
1981
1982 %Some possible uses for this hook include kicking off an automated
1983 %build or test of the added changesets, updating a bug database, or
1984 %notifying subscribers that a repository contains new changes.
1985
1986 $B$3$N%U%C%/$r;H$C$FDI2C$5$l$?%A%'%s%8%;%C%H$KBP$9$k<+F0%S%k%I$d%F%9%H$r5/(B
1987 $BF0$9$k$3$H$d!$?7$?$JJQ99$r;}$D%j%]%8%H%j$N9VFI<T$KDLCN$9$k$3$H$,$G$-$k!%(B
1988
1989 %Parameters to this hook:
1990 %\begin{itemize}
1991 %\item[\texttt{node}] A changeset ID. The changeset ID of the first
1992 % changeset in the group that was added. All changesets between this
1993 % and \index{tags!\texttt{tip}}\texttt{tip}, inclusive, were added by
1994 % a single \hgcmd{pull}, \hgcmd{push} or \hgcmd{unbundle}.
1995 %\item[\texttt{source}] A string. The source of these changes. See
1996 % section~\ref{sec:hook:sources} for details.
1997 %\item[\texttt{url}] A URL. The location of the remote repository, if
1998 % known. See section~\ref{sec:hook:url} for more information.
1999 %\end{itemize}
2000
2001 $B$3$N%U%C%/$X$N%Q%i%a!<%?!'(B
1904 \begin{itemize} 2002 \begin{itemize}
1905 \item[\texttt{node}] A changeset ID. The changeset ID of the first 2003 \item[\texttt{node}] $B%A%'%s%8%;%C%H(BID$B!%DI2C$5$l$?%0%k!<%W$N:G=i$N%A%'%s%8(B
1906 changeset in the group that was added. All changesets between this 2004 $B%;%C%H$N(BID$B!%$3$N(BID$B$r4^$_(B
1907 and \index{tags!\texttt{tip}}\texttt{tip}, inclusive, were added by 2005 \index{tags!\texttt{tip}}\texttt{tip}$B$^$G$N4V$N%A%'%s%8%;%C(B
1908 a single \hgcmd{pull}, \hgcmd{push} or \hgcmd{unbundle}. 2006 $B%HA4$F$O0l2s$N(B\hgcmd{pull}$B!$(B\hgcmd{push}$B$^$?$O(B
1909 \item[\texttt{source}] A string. The source of these changes. See 2007 \hgcmd{unbundle}$B$GDI2C$5$l$?!%(B
1910 section~\ref{sec:hook:sources} for details. 2008 \item[\texttt{source}] $BJ8;zNs!%$3$l$i$NJQ99$N%=!<%9!%>\:Y$K$D$$$F$O(B
1911 \item[\texttt{url}] A URL. The location of the remote repository, if 2009 \ref{sec:hook:sources}$B$r;2>H$N$3$H!%(B
1912 known. See section~\ref{sec:hook:url} for more information. 2010 \item[\texttt{url}] URL$B!%%j%b!<%H%j%]%8%H%j$,FCDj$G$-$k>l9g$O$=$N%"%I%l(B
2011 $B%9!%>\:Y$K$D$$$F$O(B\ref{sec:hook:url}$B$r;2>H$N$3$H!%(B
1913 \end{itemize} 2012 \end{itemize}
1914 2013
1915 See also: \hook{incoming} (section~\ref{sec:hook:incoming}), 2014 %See also: \hook{incoming} (section~\ref{sec:hook:incoming}),
1916 \hook{prechangegroup} (section~\ref{sec:hook:prechangegroup}), 2015 %\hook{prechangegroup} (section~\ref{sec:hook:prechangegroup}),
1917 \hook{pretxnchangegroup} (section~\ref{sec:hook:pretxnchangegroup}) 2016 %\hook{pretxnchangegroup} (section~\ref{sec:hook:pretxnchangegroup})
2017
2018 $B;29M!'(B\hook{incoming} (\ref{sec:hook:incoming}$B@a(B), \hook{prechangegroup}
2019 (\ref{sec:hook:prechangegroup}$B@a(B), \hook{pretxnchangegroup}
2020 (\ref{sec:hook:pretxnchangegroup}$B@a(B)
1918 2021
1919 %\subsection{\hook{commit}---after a new changeset is created} 2022 %\subsection{\hook{commit}---after a new changeset is created}
1920 \subsection{\hook{commit}---$B?7$7$$%A%'%s%8%;%C%H$,:n@.$5$l$?8e(B} 2023 \subsection{\hook{commit}---$B?7$7$$%A%'%s%8%;%C%H$,:n@.$5$l$?8e(B}
1921 \label{sec:hook:commit} 2024 \label{sec:hook:commit}
1922 2025
1923 This hook is run after a new changeset has been created. 2026 %This hook is run after a new changeset has been created.
1924 2027
1925 Parameters to this hook: 2028 $B$3$N%U%C%/$O?7$?$J%A%'%s%8%;%C%H$,:n$i$l$?8e$K8F$P$l$k!%(B
2029
2030 %Parameters to this hook:
2031 %\begin{itemize}
2032 %\item[\texttt{node}] A changeset ID. The changeset ID of the newly
2033 % committed changeset.
2034 %\item[\texttt{parent1}] A changeset ID. The changeset ID of the first
2035 % parent of the newly committed changeset.
2036 %\item[\texttt{parent2}] A changeset ID. The changeset ID of the second
2037 % parent of the newly committed changeset.
2038 %\end{itemize}
2039
2040 $B$3$N%U%C%/$X$N%Q%i%a!<%?!'(B
1926 \begin{itemize} 2041 \begin{itemize}
1927 \item[\texttt{node}] A changeset ID. The changeset ID of the newly 2042 \item[\texttt{node}] $B%A%'%s%8%;%C%H(BID$B!%?7$?$K%3%_%C%H$5$l$?%A%'%s%8%;%C(B
1928 committed changeset. 2043 $B%H$N(BID$B!%(B
1929 \item[\texttt{parent1}] A changeset ID. The changeset ID of the first 2044 \item[\texttt{parent1}] $B%A%'%s%8%;%C%H(BID$B!%?7$?$K%3%_%C%H$5$l$?%A%'%s%8%;%C(B
1930 parent of the newly committed changeset. 2045 $B%H$N(B1$B$DL\$N?F$N%A%'%s%8%;%C%H(BID.
1931 \item[\texttt{parent2}] A changeset ID. The changeset ID of the second 2046 \item[\texttt{parent2}] $B%A%'%s%8%;%C%H(BID$B!%?7$?$K%3%_%C%H$5$l$?%A%'%s%8%;%C(B
1932 parent of the newly committed changeset. 2047 $B%H$N(B2$B$DL\$N?F$N%A%'%s%8%;%C%H(BID.
1933 \end{itemize} 2048 \end{itemize}
1934 2049
1935 See also: \hook{precommit} (section~\ref{sec:hook:precommit}), 2050 %See also: \hook{precommit} (section~\ref{sec:hook:precommit}),
1936 \hook{pretxncommit} (section~\ref{sec:hook:pretxncommit}) 2051 %\hook{pretxncommit} (section~\ref{sec:hook:pretxncommit})
2052
2053 $B;29M!'(B\hook{precommit} (\ref{sec:hook:precommit}$B@a(B), \hook{pretxncommit}
2054 (\ref{sec:hook:pretxncommit}$B@a(B)
2055
1937 2056
1938 %\subsection{\hook{incoming}---after one remote changeset is added} 2057 %\subsection{\hook{incoming}---after one remote changeset is added}
1939 \subsection{\hook{incoming}---$B%j%b!<%H%A%'%s%8%;%C%H$,DI2C$5$l$?8e(B} 2058 \subsection{\hook{incoming}---$B%j%b!<%H%A%'%s%8%;%C%H$,DI2C$5$l$?8e(B}
1940 \label{sec:hook:incoming} 2059 \label{sec:hook:incoming}
1941 2060
1942 This hook is run after a pre-existing changeset has been added to the 2061 %This hook is run after a pre-existing changeset has been added to the
1943 repository, for example via a \hgcmd{push}. If a group of changesets 2062 %repository, for example via a \hgcmd{push}. If a group of changesets
1944 was added in a single operation, this hook is called once for each 2063 %was added in a single operation, this hook is called once for each
1945 added changeset. 2064 %added changeset.
1946 2065
1947 You can use this hook for the same purposes as the \hook{changegroup} 2066 $B$3$N%U%C%/$O(B\hgcmd{push}$B%3%^%s%I$J$I$G4{B8$N%A%'%s%8%;%C%H$,%j%]%8%H%j$K(B
1948 hook (section~\ref{sec:hook:changegroup}); it's simply more convenient 2067 $BDI2C$5$l$?8e$G<B9T$5$l$k!%%A%'%s%8%;%C%H$N%0%k!<%W$,0lEY$KDI2C$5$l$?>l(B
1949 sometimes to run a hook once per group of changesets, while other 2068 $B9g!$3F!9$N%A%'%s%8%;%C%H$K$D$$$F0lEY$:$D$3$N%U%C%/$,8F$S=P$5$l$k!%(B
1950 times it's handier once per changeset. 2069
1951 2070 %You can use this hook for the same purposes as the \hook{changegroup}
1952 Parameters to this hook: 2071 %hook (section~\ref{sec:hook:changegroup}); it's simply more convenient
2072 %sometimes to run a hook once per group of changesets, while other
2073 %times it's handier once per changeset.
2074
2075 $B$3$N%U%C%/$O(B\hook{changegroup}(\ref{sec:hook:changegroup}$B@a(B)$B$HF1$8L\E*$G(B
2076 $B;H$&$3$H$,$G$-$k!%0c$$$O(B\hook{changegroup}$B$,%A%'%s%8%;%C%H%0%k!<%WA4BN$K(B
2077 $BBP$7$F0lEY8F$P$l$kE@$G$"$k!%(B
2078
2079 %Parameters to this hook:
2080 %\begin{itemize}
2081 %\item[\texttt{node}] A changeset ID. The ID of the newly added
2082 % changeset.
2083 %\item[\texttt{source}] A string. The source of these changes. See
2084 % section~\ref{sec:hook:sources} for details.
2085 %\item[\texttt{url}] A URL. The location of the remote repository, if
2086 % known. See section~\ref{sec:hook:url} for more information.
2087 %\end{itemize}
2088
2089 $B$3$N%U%C%/$X$N%Q%i%a!<%?!'(B
1953 \begin{itemize} 2090 \begin{itemize}
1954 \item[\texttt{node}] A changeset ID. The ID of the newly added 2091 \item[\texttt{node}] $B%A%'%s%8%;%C%H(BID$B!%?7$?$KDI2C$5$l$k%A%'%s%8%;%C%H$N(B
1955 changeset. 2092 ID$B!%(B
1956 \item[\texttt{source}] A string. The source of these changes. See 2093 \item[\texttt{source}] $BJ8;zNs!%$3$l$i$NJQ99$N%=!<%9!%>\:Y$K$D$$$F$O(B
1957 section~\ref{sec:hook:sources} for details. 2094 \ref{sec:hook:sources}$B$r;2>H$N$3$H!%(B
1958 \item[\texttt{url}] A URL. The location of the remote repository, if 2095 \item[\texttt{url}] URL$B!%%j%b!<%H%j%]%8%H%j$,FCDj$G$-$k>l9g$K$O$=$N%"%I(B
1959 known. See section~\ref{sec:hook:url} for more information. 2096 $B%l%9!%>\:Y$K$D$$$F$O(B\ref{sec:hook:url}$B$r;2>H$N$3$H!%(B
1960 \end{itemize} 2097 \end{itemize}
1961 2098
1962 See also: \hook{changegroup} (section~\ref{sec:hook:changegroup}) \hook{prechangegroup} (section~\ref{sec:hook:prechangegroup}), \hook{pretxnchangegroup} (section~\ref{sec:hook:pretxnchangegroup}) 2099 %See also: \hook{changegroup} (section~\ref{sec:hook:changegroup}) \hook{prechangegroup} (section~\ref{sec:hook:prechangegroup}), \hook{pretxnchangegroup} (section~\ref{sec:hook:pretxnchangegroup})
2100 $B;29M!'(B\hook{changegroup} (\ref{sec:hook:changegroup}$B@a(B)
2101 \hook{prechangegroup} (\ref{sec:hook:prechangegroup}$B@a(B),
2102 \hook{pretxnchangegroup} (\ref{sec:hook:pretxnchangegroup}$B@a(B)
1963 2103
1964 %\subsection{\hook{outgoing}---after changesets are propagated} 2104 %\subsection{\hook{outgoing}---after changesets are propagated}
1965 \subsection{\hook{outgoing}---$B%A%'%s%8%;%C%H$,GH5Z$7$?8e(B} 2105 \subsection{\hook{outgoing}---$B%A%'%s%8%;%C%H$,GH5Z$7$?8e(B}
1966 \label{sec:hook:outgoing} 2106 \label{sec:hook:outgoing}
1967 2107
1968 This hook is run after a group of changesets has been propagated out 2108 %This hook is run after a group of changesets has been propagated out
1969 of this repository, for example by a \hgcmd{push} or \hgcmd{bundle} 2109 %of this repository, for example by a \hgcmd{push} or \hgcmd{bundle}
1970 command. 2110 %command.
1971 2111
1972 One possible use for this hook is to notify administrators that 2112 $B$3$N%U%C%/$O%A%'%s%8%;%C%H$N%0%k!<%W$,(B\hgcmd{push}$B$d(B\hgcmd{bundle}$B%3%^%s(B
1973 changes have been pulled. 2113 $B%I$J$I$K$h$C$F30It$KGH5Z$7$?8e$G<B9T$5$l$k!%(B
1974 2114
1975 Parameters to this hook: 2115 %One possible use for this hook is to notify administrators that
2116 %changes have been pulled.
2117
2118 $B$3$N%U%C%/$r;H$C$F4IM}<T$O(Bpull$B$5$l$?JQ99$rCN$k$3$H$,$G$-$k!%(B
2119
2120 %Parameters to this hook:
2121 %\begin{itemize}
2122 %\item[\texttt{node}] A changeset ID. The changeset ID of the first
2123 % changeset of the group that was sent.
2124 %\item[\texttt{source}] A string. The source of the of the operation
2125 % (see section~\ref{sec:hook:sources}). If a remote client pulled
2126 % changes from this repository, \texttt{source} will be
2127 % \texttt{serve}. If the client that obtained changes from this
2128 % repository was local, \texttt{source} will be \texttt{bundle},
2129 % \texttt{pull}, or \texttt{push}, depending on the operation the
2130 % client performed.
2131 %\item[\texttt{url}] A URL. The location of the remote repository, if
2132 % known. See section~\ref{sec:hook:url} for more information.
2133 %\end{itemize}
2134
2135 $B$3$N%U%C%/$X$N%Q%i%a!<%?!'(B
1976 \begin{itemize} 2136 \begin{itemize}
1977 \item[\texttt{node}] A changeset ID. The changeset ID of the first 2137 \item[\texttt{node}] $B%A%'%s%8%;%C%H(BID$B!%Aw?.$5$l$?%A%'%s%8%;%C%H%0%k!<%W(B
1978 changeset of the group that was sent. 2138 $B$N:G=i$N%A%'%s%8%;%C%H(BID.
1979 \item[\texttt{source}] A string. The source of the of the operation 2139 \item[\texttt{source}] $BJ8;zNs!%A`:n85(B(~\ref{sec:hook:sources}$B@a$r;2>H(B)$B!%(B
1980 (see section~\ref{sec:hook:sources}). If a remote client pulled 2140 $B%j%b!<%H%/%i%$%"%s%H$,JQ99$r%j%]%8%H%j$+$i(Bpull$B$9$k$H(B
1981 changes from this repository, \texttt{source} will be 2141 \texttt{source}$B$,(B\texttt{serve}$B$H$J$k!%%j%]%8%H%j$+$iJQ99$r(B
1982 \texttt{serve}. If the client that obtained changes from this 2142 $BF~<j$7$?%/%i%$%"%s%H$,%m!<%+%k$G$"$l$P!$(B\texttt{source}$B$O%/(B
1983 repository was local, \texttt{source} will be \texttt{bundle}, 2143 $B%i%$%"%s%H$N9T$C$?F0:n$K1~$8$F(B
1984 \texttt{pull}, or \texttt{push}, depending on the operation the 2144 \texttt{bundle}$B!$(B\texttt{pull}$B!$(B\texttt{push}$B$N$$$:$l$+$H$J(B
1985 client performed. 2145 $B$k!%(B
1986 \item[\texttt{url}] A URL. The location of the remote repository, if 2146 \item[\texttt{url}] URL$B!%%j%b!<%H%j%]%8%H%j$,FCDj$G$-$k>l9g$O$=$N%"%I%l%9!%(B
1987 known. See section~\ref{sec:hook:url} for more information. 2147 $B>\:Y$K$D$$$F$O(B\ref{sec:hook:url}$B@a$r;2>H$N$3$H!%(B
1988 \end{itemize} 2148 \end{itemize}
1989 2149
1990 See also: \hook{preoutgoing} (section~\ref{sec:hook:preoutgoing}) 2150
2151 %See also: \hook{preoutgoing} (section~\ref{sec:hook:preoutgoing})
2152 $B;29M!'(B \hook{preoutgoing} (\ref{sec:hook:preoutgoing}$B@a(B)
1991 2153
1992 %\subsection{\hook{prechangegroup}---before starting to add remote 2154 %\subsection{\hook{prechangegroup}---before starting to add remote
1993 %changesets} 2155 %changesets}
1994 \subsection{\hook{prechangegroup}---$B%j%b!<%H%A%'%s%8%;%C%H$,$,DI2C$5$l$k(B 2156 \subsection{\hook{prechangegroup}---$B%j%b!<%H%A%'%s%8%;%C%H$,$,DI2C$5$l$k(B
1995 $BA0(B} 2157 $BA0(B}
1996 \label{sec:hook:prechangegroup} 2158 \label{sec:hook:prechangegroup}
1997 2159
1998 This controlling hook is run before Mercurial begins to add a group of 2160 %This controlling hook is run before Mercurial begins to add a group of
1999 changesets from another repository. 2161 %changesets from another repository.
2000 2162
2001 This hook does not have any information about the changesets to be 2163 $B$3$N@)8f%U%C%/$O(BMercurial$B$,0lO"$N%A%'%s%8%;%C%H$rJL$N%j%]%8%H%j$KDI2C$9(B
2002 added, because it is run before transmission of those changesets is 2164 $B$kA0$K<B9T$5$l$k!%(B
2003 allowed to begin. If this hook fails, the changesets will not be 2165
2004 transmitted. 2166 %This hook does not have any information about the changesets to be
2005 2167 %added, because it is run before transmission of those changesets is
2006 One use for this hook is to prevent external changes from being added 2168 %allowed to begin. If this hook fails, the changesets will not be
2007 to a repository. For example, you could use this to ``freeze'' a 2169 %transmitted.
2008 server-hosted branch temporarily or permanently so that users cannot 2170
2009 push to it, while still allowing a local administrator to modify the 2171 $B$3$N%U%C%/$ODI2C$5$l$k%A%'%s%8%;%C%H$N>pJs$O2?$b;}$?$J$$!%$J$<$J$i$3$N%U%C(B
2010 repository. 2172 $B%/$O%A%'%s%8%;%C%H$NAw?.$,;O$^$kA0$K<B9T$5$l$k$+$i$@!%%U%C%/$N<B9T$,<:GT(B
2011 2173 $B$7$?>l9g$O%A%'%s%8%;%C%H$OAw?.$5$l$J$$!%(B
2012 Parameters to this hook: 2174
2175 %One use for this hook is to prevent external changes from being added
2176 %to a repository. For example, you could use this to ``freeze'' a
2177 %server-hosted branch temporarily or permanently so that users cannot
2178 %push to it, while still allowing a local administrator to modify the
2179 %repository.
2180
2181 $B$3$N%U%C%/$r;H$C$F!$30It$NJQ99$,%j%]%8%H%j$K$D$$$+$5$l$J$$$h$&$K$9$k$3$H(B
2182 $B$b$G$-$k!%Nc$($P!$$3$N%U%C%/$r%5!<%P$GDs6!$5$l$k%V%i%s%A$r0l;~E*$^$?$O1J(B
2183 $BB3E*$K(B``$BE`7k(B''$B$7!$%m!<%+%k$J4IM}<T$O%j%]%8%H%j$rJQ99$G$-$k$,!$%j%b!<%H(B
2184 $B%f!<%6$O$=$N%j%]%8%H%j$K(Bpush$B$G$-$J$$$h$&$K$G$-$k!%(B
2185
2186 %Parameters to this hook:
2187 $B$3$N%U%C%/$X$N%Q%i%a!<%?!'(B
2013 \begin{itemize} 2188 \begin{itemize}
2014 \item[\texttt{source}] A string. The source of these changes. See 2189 \item[\texttt{source}] $BJ8;zNs!%JQ99$N%=!<%9!%>\:Y$K$D$$$F$O(B
2015 section~\ref{sec:hook:sources} for details. 2190 \ref{sec:hook:sources}$B$r;2>H!%(B
2016 \item[\texttt{url}] A URL. The location of the remote repository, if 2191 \item[\texttt{url}] URL$B!%%j%b!<%H%j%]%8%H%j$,FCDj$5$l$k>l9g$O$=$N%"%I%l(B
2017 known. See section~\ref{sec:hook:url} for more information. 2192 $B%9!%>\:Y$K$D$$$F$O(B\ref{sec:hook:url}$B$r;2>H!%(B
2018 \end{itemize} 2193 \end{itemize}
2019 2194
2020 See also: \hook{changegroup} (section~\ref{sec:hook:changegroup}), 2195 %See also: \hook{changegroup} (section~\ref{sec:hook:changegroup}),
2021 \hook{incoming} (section~\ref{sec:hook:incoming}), , 2196 %\hook{incoming} (section~\ref{sec:hook:incoming}), ,
2022 \hook{pretxnchangegroup} (section~\ref{sec:hook:pretxnchangegroup}) 2197 %\hook{pretxnchangegroup} (section~\ref{sec:hook:pretxnchangegroup})
2198
2199 $B;29M!'(B \hook{changegroup} (\ref{sec:hook:changegroup}$B@a(B)$B!$(B
2200 \hook{incoming} (\ref{sec:hook:incoming}$B@a(B)$B!$(B
2201 \hook{pretxnchangegroup} (\ref{sec:hook:pretxnchangegroup}$B@a(B)
2023 2202
2024 %\subsection{\hook{precommit}---before starting to commit a changeset} 2203 %\subsection{\hook{precommit}---before starting to commit a changeset}
2025 \subsection{\hook{precommit}---$B%A%'%s%8%;%C%H$r%3%_%C%H$9$kA0(B} 2204 \subsection{\hook{precommit}---$B%A%'%s%8%;%C%H$r%3%_%C%H$9$kA0(B}
2026 \label{sec:hook:precommit} 2205 \label{sec:hook:precommit}
2027 2206
2121 2300
2122 $B$3$N@)8f%U%C%/$O%?%0$,:n@.$5$l$kA0$K<B9T$5$l$k!%%U%C%/$N<B9T$,@.8y$7$?>l(B 2301 $B$3$N@)8f%U%C%/$O%?%0$,:n@.$5$l$kA0$K<B9T$5$l$k!%%U%C%/$N<B9T$,@.8y$7$?>l(B
2123 $B9g$O%?%0$,:n@.$5$l$k!%%U%C%/$N<B9T$,<:GT$7$?>l9g$O%?%0$O:n@.$5$l$J$$!%(B 2302 $B9g$O%?%0$,:n@.$5$l$k!%%U%C%/$N<B9T$,<:GT$7$?>l9g$O%?%0$O:n@.$5$l$J$$!%(B
2124 2303
2125 %Parameters to this hook: 2304 %Parameters to this hook:
2126 $B$3$N%U%C%/$X$N%Q%i%a!<%?(B 2305 $B$3$N%U%C%/$X$N%Q%i%a!<%?!'(B
2127 %\begin{itemize} 2306 %\begin{itemize}
2128 %\item[\texttt{local}] A boolean. Whether the tag is local to this 2307 %\item[\texttt{local}] A boolean. Whether the tag is local to this
2129 % repository instance (i.e.~stored in \sfilename{.hg/localtags}) or 2308 % repository instance (i.e.~stored in \sfilename{.hg/localtags}) or
2130 % managed by Mercurial (stored in \sfilename{.hgtags}). 2309 % managed by Mercurial (stored in \sfilename{.hgtags}).
2131 %\item[\texttt{node}] A changeset ID. The ID of the changeset to be tagged. 2310 %\item[\texttt{node}] A changeset ID. The ID of the changeset to be tagged.