annotate ja/hgext.tex @ 357:ef197f25f11e

more hgext.tex
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 02 Sep 2008 17:27:11 +0900
parents 65aec2b27f64
children 1348ce7d2d77
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
355
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
1 %\chapter{Adding functionality with extensions}
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
2 \chapter{$B3HD%$K$h$k5!G=$NDI2C(B}
223
4c9b9416cd23 Skeleton for chapter on extensions.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
3 \label{chap:hgext}
4c9b9416cd23 Skeleton for chapter on extensions.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
4
355
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
5 %While the core of Mercurial is quite complete from a functionality
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
6 %standpoint, it's deliberately shorn of fancy features. This approach
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
7 %of preserving simplicity keeps the software easy to deal with for both
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
8 %maintainers and users.
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
9
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
10 $B5!G=$N4QE@$+$i8+$k$H(BMercurial$B$O$+$J$j40Hw$7$F$$$k$,!$GI<j$J5!G=$K$D$$$F$O(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
11 $B0U?^E*$KGS=|$7$F$$$k!%(BMercurial$B$N%a%s%F%J$H%f!<%6$NAPJ}$K$H$C$FC1=c$5$rJ](B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
12 $B$D$?$a$K$3$N%"%W%m!<%A$r<h$C$F$$$k!%(B
224
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
13
355
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
14 %However, Mercurial doesn't box you in with an inflexible command set:
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
15 %you can add features to it as \emph{extensions} (sometimes known as
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
16 %\emph{plugins}). We've already discussed a few of these extensions in
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
17 %earlier chapters.
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
18
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
19 $B$7$+$7$J$,$i!$(BMercurial$B$OM;DL$NMx$+$J$$%3%^%s%I%;%C%H$rDs6!$7$F$$$k$N$G$O(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
20 $B$J$$!%(B\emph{extensions}$B!J$"$k$$$O(B\emph{plugins}$B$H8F$P$l$k$3$H$b$"$k!K$K$h$C(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
21 $B$F5!G=$rDI2C$9$k$3$H$,$G$-$k!%$3$l$i$N$$$/$D$+$K$D$$$F$O!$0JA0$N>O$G8+$F(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
22 $B$$$k!%(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
23
224
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
24 \begin{itemize}
355
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
25 %\item Section~\ref{sec:tour-merge:fetch} covers the \hgext{fetch}
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
26 % extension; this combines pulling new changes and merging them with
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
27 % local changes into a single command, \hgxcmd{fetch}{fetch}.
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
28 \item $B%;%/%7%g%s(B\ref{sec:tour-merge:fetch}$B$O(B\hgext{fetch}$B%(%/%9%F%s%7%g%s(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
29 $B$r%+%P!<$7$F$$$k!%$3$l$O?7$7$$JQ99$r(Bpull$B$7!$%m!<%+%k$JJQ99$H%^!<%8(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
30 $B$rC10l$N%3%^%s%I(B\hgxcmd{fetch}{fetch}$B$G<B9T$9$k!%(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
31 %\item In chapter~\ref{chap:hook}, we covered several extensions that
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
32 % are useful for hook-related functionality: \hgext{acl} adds access
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
33 % control lists; \hgext{bugzilla} adds integration with the Bugzilla
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
34 % bug tracking system; and \hgext{notify} sends notification emails on
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
35 % new changes.
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
36 \item \ref{chap:hook}$B$G$O!$%U%C%/$K4XO"$7$?$$$/$D$+$N3HD%$K$D$$$F07$&!%(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
37 \hgext{acl}$B$O%"%/%;%9@)8f%j%9%H$rDI2C$9$k!%(B\hgext{bugzilla}$B$O(BBugzilla$B5!G=(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
38 $B$NE}9g5!G=$rDs6!$9$k!%(B\hgext{notify}$B$O!$?7$?$JJQ99$N:]$KDLCNEE;R%a!<%k$r(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
39 $BAw$k5!G=$rDs6!$9$k!%(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
40 %\item The Mercurial Queues patch management extension is so invaluable
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
41 % that it merits two chapters and an appendix all to itself.
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
42 % Chapter~\ref{chap:mq} covers the basics;
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
43 % chapter~\ref{chap:mq-collab} discusses advanced topics; and
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
44 % appendix~\ref{chap:mqref} goes into detail on each command.
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
45 \item Mercurial Queue$B$H$$$&%Q%C%A%^%M!<%8%a%s%H3HD%$O!$Hs>o$K=EMW$J$N$G(B2
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
46 $B>O$HIUO?(B1$B>O$rHq$d$7$F@bL@$9$k!%(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
47 Chapter~\ref{chap:mq}$B$O4pK\E*$J5!G=$r@bL@$9$k!%(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
48 chapter~\ref{chap:mq-collab}$B$G$O9bEY$J5!G=$K$D$$$F@bL@$7!$(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
49 appendix~\ref{chap:mqref}$B$G$O3F%3%^%s%I$N>\:Y$r@bL@$9$k!%(B
224
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
50 \end{itemize}
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
51
355
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
52 %In this chapter, we'll cover some of the other extensions that are
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
53 %available for Mercurial, and briefly touch on some of the machinery
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
54 %you'll need to know about if you want to write an extension of your
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
55 %own.
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
56 $B$3$N>O$G$O(BMercurial$B$GMxMQ2DG=$J$=$NB>$N3HD%$K$D$$$F<h$j07$$!$$^$?<+J,$G(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
57 Mercurial$B3HD%$r=q$/;~$KLrN)$DFbIt$N5!9=$K$D$$$F$b@bL@$9$k!%(B
224
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
58 \begin{itemize}
355
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
59 %\item In section~\ref{sec:hgext:inotify}, we'll discuss the
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
60 % possibility of \emph{huge} performance improvements using the
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
61 % \hgext{inotify} extension.
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
62 \item \ref{sec:hgext:inotify}$B@a$G$O(B\hgext{inotify}$B3HD%$rMQ$$$k$3$H$GF@$i(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
63 $B$l$k(B\emph{$BBg$-$J(B}$B@-G=8~>e$K$D$$$F=R$Y$k!%(B
224
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
64 \end{itemize}
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
65
355
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
66 %\section{Improve performance with the \hgext{inotify} extension}
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
67 \section{\hgext{inotify}$B3HD%$K$h$k@-G=8~>e(B}
224
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
68 \label{sec:hgext:inotify}
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
69
355
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
70 %Are you interested in having some of the most common Mercurial
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
71 %operations run as much as a hundred times faster? Read on!
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
72 Mercurial$B$N:G$bB?MQ$5$l$k%3%^%s%I$N$$$/$D$+$,?tI4G\B.$/$J$k$3$H$K6=L#$,$"(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
73 $B$k$J$i$P$<$RFI$s$GM_$7$$!*(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
74
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
75 %Mercurial has great performance under normal circumstances. For
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
76 %example, when you run the \hgcmd{status} command, Mercurial has to
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
77 %scan almost every directory and file in your repository so that it can
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
78 %display file status. Many other Mercurial commands need to do the
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
79 %same work behind the scenes; for example, the \hgcmd{diff} command
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
80 %uses the status machinery to avoid doing an expensive comparison
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
81 %operation on files that obviously haven't changed.
224
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
82
355
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
83 $BDL>o$N>r7o2<$G(BMercurial$B$O9b$$@-G=$r;}$C$F$$$k$,!$(B \hgcmd{status}$B%3%^%s%I(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
84 $B$r<B9T$7$?;~!$(BMercurial$B$O$[$\A4$F$N%G%#%l%/%H%j$H%U%!%$%k$r%9%-%c%s$9$k$3(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
85 $B$H$K$J$k!%B>$NB?$/$N(BMercurial$B%3%^%s%I$O!$$3$N$h$&$JA`:n$r0U<1$5$;$J$$$h$&(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
86 $B$K$J$C$F$$$k!%Nc$($P(B\hgcmd{diff}$B$O%9%F!<%?%95!9=$rMQ$$$F!$L@$i$+$KJQ99$5(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
87 $B$l$F$$$J$$%U%!%$%k$NHf3S$rHr$1$F$$$k!%(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
88
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
89 %Because obtaining file status is crucial to good performance, the
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
90 %authors of Mercurial have optimised this code to within an inch of its
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
91 %life. However, there's no avoiding the fact that when you run
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
92 %\hgcmd{status}, Mercurial is going to have to perform at least one
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
93 %expensive system call for each managed file to determine whether it's
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
94 %changed since the last time Mercurial checked. For a sufficiently
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
95 %large repository, this can take a long time.
224
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
96
355
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
97 $BNI$$@-G=$rF@$k$?$a$K$O!$%U%!%$%k%9%F!<%?%9$N<hF@$,=EMW$J4X?4;v$H$J$k$?(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
98 $B$a!$(BMercurial$B$N:n<T$?$A$O$3$l$r$.$j$.$j$N$H$3$m$^$G:GE,2=$7$F$$$k!%$7$+$7(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
99 \hgcmd{status}$B%3%^%s%I$G$O$3$l$rHr$1$k<jN)$F$,$J$$!%(B Mercurial$B$O!$4IM}$7(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
100 $B$F$$$k%U%!%$%k$,:G8e$K%A%'%C%/$7$?;~$+$iJQ99$5$l$F$$$k$+D4$Y$k$?$a$K!$>/(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
101 $B$J$/$H$b0l$D$N9b2A$J%7%9%F%`%3!<%k$r$9$kI,MW$,$"$k!%$"$kDxEY0J>eBg$-$J%j(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
102 $B%]%8%H%j$G$O!$$3$NA`:n$K$OD9$$;~4V$rMW$9$k!%(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
103
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
104 %To put a number on the magnitude of this effect, I created a
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
105 %repository containing 150,000 managed files. I timed \hgcmd{status}
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
106 %as taking ten seconds to run, even when \emph{none} of those files had
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
107 %been modified.
224
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
108
355
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
109 $B$3$N1F6A$K$D$$$FD4$Y$k$?$a$K(B150,000$B$N%U%!%$%k$rMJ$9$k%j%]%8%H%j$r:n@.$7(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
110 $B$?!%(B\emph{$B$^$C$?$/(B}$BJQ99$,$J$$>l9g$G$b(B\hgcmd{status}$B%3%^%s%I$N<B9T$K$O(B10
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
111 $BIC$rMW$7$?!%(B
224
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
112
355
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
113 %Many modern operating systems contain a file notification facility.
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
114 %If a program signs up to an appropriate service, the operating system
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
115 %will notify it every time a file of interest is created, modified, or
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
116 %deleted. On Linux systems, the kernel component that does this is
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
117 %called \texttt{inotify}.
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
118
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
119 $B6aG/$N%*%Z%l!<%F%#%s%0%7%9%F%`$O!$%U%!%$%kDLCN$N5!9=$rHw$($F$$$k!%%W%m%0(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
120 $B%i%`$,E,@Z$J%5!<%S%9$KEPO?$9$k$H!$%*%Z%l!<%F%#%s%0%7%9%F%`$OBP>]$H$J$k%U%!(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
121 $B%$%k$N:n@.!$JQ99!$:o=|$r%W%m%0%i%`$KDLCN$9$k!%(B Linux$B%7%9%F%`$G$O$3$l$r9T(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
122 $B$&%+!<%M%k%3%s%]!<%M%s%H$O(B\texttt{inotify}$B$H8F$P$l$k!%(B
224
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
123
355
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
124 %Mercurial's \hgext{inotify} extension talks to the kernel's
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
125 %\texttt{inotify} component to optimise \hgcmd{status} commands. The
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
126 %extension has two components. A daemon sits in the background and
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
127 %receives notifications from the \texttt{inotify} subsystem. It also
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
128 %listens for connections from a regular Mercurial command. The
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
129 %extension modifies Mercurial's behaviour so that instead of scanning
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
130 %the filesystem, it queries the daemon. Since the daemon has perfect
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
131 %information about the state of the repository, it can respond with a
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
132 %result instantaneously, avoiding the need to scan every directory and
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
133 %file in the repository.
224
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
134
355
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
135 Mercurial$B$N(B\hgext{inotify}$B3HD%$O!$(B\hgcmd{status}$B%3%^%s%I$r:GE,2=$9$k$?$a(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
136 $B$K!$%+!<%M%k$N(B\texttt{inotify}$B%3%s%]!<%M%s%H$X%"%/%;%9$9$k!%$3$N3HD%$O(B2$B$D(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
137 $B$N%3%s%]!<%M%s%H$+$i$J$k!%(B \texttt{inotify}$B%5%V%7%9%F%`$+$iDLCN$r<u$1<h$k(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
138 $B$?$a$N%G!<%b%s$,%P%C%/%0%i%s%I$GF0:n$9$k!%$3$N%G!<%b%s$O(BMercurial$B$NB>$N%3(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
139 $B%^%s%I$+$i$N@\B3$b<u$1IU$1$k!%$3$N3HD%$O(BMercurial$B$N5sF0$rJQ99$7!$%U%!%$%k(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
140 $B%7%9%F%`$r%9%-%c%s$9$k$N$G$O$J$/!$%G!<%b%s$X$NLd$$9g$o$;$r9T$&$h$&$K$9(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
141 $B$k!%%G!<%b%s$O%j%]%8%H%j$N>uBV$r40A4$KGD0.$7$F$$$k$N$G!$D>$A$KLd$$9g$o$;(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
142 $B$KJVEz$9$k$3$H$,$G$-!$%j%]%8%H%j$N%G%#%l%/%H%j$H%U%!%$%k$N%9%-%c%s$rHr$1(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
143 $B$k$3$H$,$G$-$k!%(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
144
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
145 %Recall the ten seconds that I measured plain Mercurial as taking to
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
146 %run \hgcmd{status} on a 150,000 file repository. With the
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
147 %\hgext{inotify} extension enabled, the time dropped to 0.1~seconds, a
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
148 %factor of \emph{one hundred} faster.
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
149
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
150 $B%W%l!<%s$J(BMercurial$B$G$O(B\hgcmd{status}$B%3%^%s%I$,(B150,000$B%U%!%$%k$N%j%]%8%H(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
151 $B%j$KBP$7$F(B10$BIC$rMW$7$F$$$?$3$H$r;W$$=P$7$FM_$7$$!#(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
152 \hgext{inotify}$B3HD%$r;H$C$?>l9g!"=jMW;~4V$O(B0.1$BIC$K2<$,$j!$(B\emph{100}$BG\B.(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
153 $B$/$J$C$F$$$k$3$H$,J,$+$k!%(B
224
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
154
355
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
155 %Before we continue, please pay attention to some caveats.
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
156 $B$5$i$K?J$`A0$K!$Cm0UE@$r5s$2$k!%(B
224
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
157 \begin{itemize}
355
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
158 %\item The \hgext{inotify} extension is Linux-specific. Because it
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
159 % interfaces directly to the Linux kernel's \texttt{inotify}
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
160 % subsystem, it does not work on other operating systems.
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
161 \item \hgext{inotify}$B3HD%$O(BLinux$BFCM-$N$b$N$G$"$k!%$3$N5!G=3HD%$O(BLinux$B$N(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
162 \texttt{inotify}$B%5%V%7%9%F%`$KD>@\%"%/%;%9$9$k$?$a!$B>$N%*%Z%l!<(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
163 $B%F%#%s%0%7%9%F%`$G$OF0:n$7$J$$!%(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
164
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
165 %\item It should work on any Linux distribution that was released after
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
166 % early~2005. Older distributions are likely to have a kernel that
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
167 % lacks \texttt{inotify}, or a version of \texttt{glibc} that does not
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
168 % have the necessary interfacing support.
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
169 \item 2005$BG/=i$a0J9_$K%j%j!<%9$5$l$?$I$N$h$&$J(BLinux$B%G%#%9%H%j%S%e!<%7%g(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
170 $B%s$G$bF0:n$9$k$O$:$@$,!$8E$$%G%#%9%H%j%S%e!<%7%g%s$G$O(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
171 \texttt{inotify}$B$r7g$$$F$$$?$j!$I,MW$J%$%s%?!<%U%'!<%9%5%]!<%H$r(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
172 \texttt{glibc}$B$,Ds6!$7$F$$$J$+$C$?$j$9$k2DG=@-$,$"$k!%(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
173
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
174 %\item Not all filesystems are suitable for use with the
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
175 % \hgext{inotify} extension. Network filesystems such as NFS are a
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
176 % non-starter, for example, particularly if you're running Mercurial
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
177
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
178 % on several systems, all mounting the same network filesystem. The
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
179 % kernel's \texttt{inotify} system has no way of knowing about changes
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
180 % made on another system. Most local filesystems (e.g.~ext3, XFS,
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
181 % ReiserFS) should work fine.
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
182 \item $BA4$F$N%U%!%$%k%7%9%F%`$,(B\hgext{inotify}$B3HD%$GMxMQ2DG=$J$o$1$G$O$J(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
183 $B$$!%Nc$((B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
184 $B$P(BMercurial$B$r$$$/$D$+$N%7%9%F%`$GF0:n$5$;$F$$$k>l9g!$F10l$N%M%C%H%o!<%/%U%!(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
185 $B%$%k%7%9%F%`$r3F!9$N%7%9%F%`$G%^%&%s%H$7$F$$$k$3$H$,B?$$$,!$(B NFS$B$J$I$N%M%C(B
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
186 $B%H%o!<%/%U%!%$%k%7%9%F%`$O9MN8$5$l$F$$$J$$!%(B
224
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
187 \end{itemize}
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
188
357
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
189 %The \hgext{inotify} extension is not yet shipped with Mercurial as of
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
190 %May~2007, so it's a little more involved to set up than other
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
191 %extensions. But the performance improvement is worth it!
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
192
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
193 2007$BG/(B5$B7n$^$G$O(B\hgext{inotify}$B3HD%$O(BMercurial$B$KF1:-$5$l$F$$$J$+$C$?!%$=$N(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
194 $B$?$a!$%;%C%H%"%C%W$OB>$N3HD%$KHf$Y$F$d$dJ#;($@$,!$F@$i$l$k@-G=8~>e$O$K$O(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
195 $B$=$l$@$1$N2ACM$,$"$k!%(B
224
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
196
357
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
197 %The extension currently comes in two parts: a set of patches to the
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
198 %Mercurial source code, and a library of Python bindings to the
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
199 %\texttt{inotify} subsystem.
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
200
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
201 $B8=:_!$3HD%$O(B2$B$D$N%Q!<%H$KJ,$+$l$F$$$k!%(BMercurial$B%=!<%9%3!<%I$X$N%Q%C%A$H(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
202 \texttt{inotify}$B%5%V%7%9%F%`$X$N(BPython$B%P%$%s%G%#%s%0%i%$%V%i%j$G$"$k!%(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
203
224
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
204 \begin{note}
357
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
205 % There are \emph{two} Python \texttt{inotify} binding libraries. One
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
206 % of them is called \texttt{pyinotify}, and is packaged by some Linux
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
207 % distributions as \texttt{python-inotify}. This is \emph{not} the
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
208 % one you'll need, as it is too buggy and inefficient to be practical.
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
209
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
210 Python$B$N(B\texttt{inotify}$B%P%$%s%G%#%s%0%i%$%V%i%j$O(B\emph{2$B$D(B}$B$"$k!%(B1$B$D$O(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
211 \texttt{pyinotify}$B$G$"$j!$$$$/$D$+$N(BLinux$B%G%#%9%H%j%S%e!<%7%g%s$G$O(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
212 \texttt{python-inotify}$B$H$7$F%Q%C%1!<%82=$5$l$F$$$k!%$3$l$O%P%0$,Hs>o$KB?(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
213 $B$/!$<BMQ$9$k$K$OHs8zN(E*$G$"$j!$;H$&$Y$-$G(B\emph{$B$J$$(B}$B!%(B
224
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
214 \end{note}
357
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
215 %To get going, it's best to already have a functioning copy of
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
216 %Mercurial installed.
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
217 $B@h$X?J$`$KEv$C$F!$@5$7$/5!G=$9$k(BMercurial$B$,%$%s%9%H!<%k$5$l$F$$$k$3$H$,(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
218 $BK>$^$7$$!%(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
219
224
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
220 \begin{note}
357
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
221 % If you follow the instructions below, you'll be \emph{replacing} and
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
222 % overwriting any existing installation of Mercurial that you might
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
223 % already have, using the latest ``bleeding edge'' Mercurial code.
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
224 % Don't say you weren't warned!
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
225 $B0J2<$N;X<($K=>$C$F%$%s%9%H!<%k$7$?(BMercurial$B$r!$:G?7$N(BMercurial$B%3!<%I$G(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
226 \emph{$BCV$-49$($k(B}$B$3$H$,$G$-$k!%!J7Y9p$5$l$J$+$C$?$H$O8@$o$J$$$3$H!K(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
227
224
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
228 \end{note}
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
229 \begin{enumerate}
357
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
230 %\item Clone the Python \texttt{inotify} binding repository. Build and
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
231 % install it.
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
232 \item Python \texttt{inotify}$B%P%$%s%G%#%s%0$N%j%]%8%H%j$r%/%m!<%s$7!$%S(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
233 $B%k%I$H%$%s%9%H!<%k$r9T$&!%(B
224
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
234 \begin{codesample4}
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
235 hg clone http://hg.kublai.com/python/inotify
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
236 cd inotify
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
237 python setup.py build --force
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
238 sudo python setup.py install --skip-build
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
239 \end{codesample4}
357
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
240 %\item Clone the \dirname{crew} Mercurial repository. Clone the
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
241 % \hgext{inotify} patch repository so that Mercurial Queues will be
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
242 % able to apply patches to your cope of the \dirname{crew} repository.
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
243 \item Merecurial$B$N(B\dirname{crew}$B%j%]%8%H%j$r%/%m!<%s$9(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
244 $B$k!%(B\hgext{inotify}$B%Q%C%A%j%]%8%H%j$r%/%m!<%s$7!$(BMercurial Queues
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
245 $B$,(B\dirname{crew}$B%j%]%8%H%j$K%Q%C%A$rEv$F$i$l$k$h$&$K$9$k!%(B
224
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
246 \begin{codesample4}
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
247 hg clone http://hg.intevation.org/mercurial/crew
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
248 hg clone crew inotify
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
249 hg clone http://hg.kublai.com/mercurial/patches/inotify inotify/.hg/patches
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
250 \end{codesample4}
357
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
251 %\item Make sure that you have the Mercurial Queues extension,
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
252 % \hgext{mq}, enabled. If you've never used MQ, read
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
253 % section~\ref{sec:mq:start} to get started quickly.
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
254
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
255 \item Mercurial Queues$B3HD%!J(B\hgext{mq}$B!K$,M-8z$K$J$C$F$$$k$3$H$r3NG'$9(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
256 $B$k!%(BMQ$B$r;H$C$?$3$H$,$J$1$l$P!$(B\ref{sec:mq:start}$B$r0lFI$9$k$3$H$r$*(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
257 $B$9$9$a$9$k!%(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
258
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
259 %\item Go into the \dirname{inotify} repo, and apply all of the
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
260 % \hgext{inotify} patches using the \hgxopt{mq}{qpush}{-a} option to
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
261 % the \hgxcmd{mq}{qpush} command.
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
262 \item \dirname{inotify}$B%j%]%8%H%j$X9T$-!$(B\hgxcmd{mq}{qpush}$B%3%^%s%I$K(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
263 \hgxopt{mq}{qpush}{-a}$B%*%W%7%g%s$r;H$C$F(B\hgext{inotify}$B$N%Q%C%A$r$9(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
264 $B$Y$FE,MQ$9$k!%(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
265
224
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
266 \begin{codesample4}
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
267 cd inotify
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
268 hg qpush -a
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
269 \end{codesample4}
357
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
270 % If you get an error message from \hgxcmd{mq}{qpush}, you should not
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
271 % continue. Instead, ask for help.
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
272
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
273 \hgxcmd{mq}{qpush}$B$G%(%i!<$,5/$-$?>l9g!$@h$X?J$^$:$K=u8@$r5a$a$FM_$7$$!%(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
274
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
275 %\item Build and install the patched version of Mercurial.
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
276 \item $B%Q%C%A$rEv$F$?(BMercurial$B$r%S%k%I$7$F%$%s%9%H!<%k$9$k!%(B
224
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
277 \begin{codesample4}
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
278 python setup.py build --force
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
279 sudo python setup.py install --skip-build
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
280 \end{codesample4}
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
281 \end{enumerate}
357
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
282 %Once you've build a suitably patched version of Mercurial, all you
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
283 %need to do to enable the \hgext{inotify} extension is add an entry to
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
284 %your \hgrc.
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
285
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
286 $BE,@Z$J%Q%C%A$NEv$C$?(BMercurial$B$r%S%k%I$9$l$P!$8e$O(B\hgext{inotify}$B3HD%$rMx(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
287 $BMQ$9$k$h$&$K(B\hgrc $B$r@_Dj$9$k$@$1$G$"$k!%(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
288
224
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
289 \begin{codesample2}
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
290 [extensions]
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
291 inotify =
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
292 \end{codesample2}
357
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
293 %When the \hgext{inotify} extension is enabled, Mercurial will
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
294 %automatically and transparently start the status daemon the first time
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
295 %you run a command that needs status in a repository. It runs one
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
296 %status daemon per repository.
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
297
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
298 \hgext{inotify}$B$,M-8z$K$J$C$F$$$k$H!$(BMercurial$B$O%j%]%8%H%jFb$G%3%^%s%I$,(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
299 $B:G=i$K<B9T$5$l$?;~$K<+F0E*$+$DF)2aE*$K%9%F!<%?%9%G!<%b%s$r5/F0$9$k!%%j%](B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
300 $B%8%H%j(B1$B$D$4$H$K(B1$B$D$N%9%F!<%?%9%G!<%b%s$,5/F0$5$l$k!%(B
224
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
301
357
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
302 %The status daemon is started silently, and runs in the background. If
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
303 %you look at a list of running processes after you've enabled the
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
304 %\hgext{inotify} extension and run a few commands in different
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
305 %repositories, you'll thus see a few \texttt{hg} processes sitting
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
306 %around, waiting for updates from the kernel and queries from
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
307 %Mercurial.
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
308
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
309 $B%9%F!<%?%9%G!<%b%s$O2?$b=PNO$r9T$o$:!$%P%C%/%0%i%&%s%I$GF0:n$9(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
310 $B$k!%(B\hgext{inotify}$B3HD%$rM-8z$K$7$?8e$GJL$N%j%]%8%H%jFb$G$$$/$D$+%3%^%s%I(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
311 $B$r<B9T$7!$<B9TCf$N%W%m%;%9$N%j%9%H$r8+$k$H!$$$$/$D$+$N(B\texttt{hg}$B%W%m%;%9(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
312 $B$,%+!<%M%k$+$i$N%"%C%W%G!<%H$H(BMercurial$B$+$i$NLd$$9g$o$;$rBT$C$F$$$k$N$,(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
313 $B8+$i$l$k$@$m$&!%(B
224
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
314
357
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
315 %The first time you run a Mercurial command in a repository when you
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
316 %have the \hgext{inotify} extension enabled, it will run with about the
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
317 %same performance as a normal Mercurial command. This is because the
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
318 %status daemon needs to perform a normal status scan so that it has a
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
319 %baseline against which to apply later updates from the kernel.
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
320 %However, \emph{every} subsequent command that does any kind of status
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
321 %check should be noticeably faster on repositories of even fairly
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
322 %modest size. Better yet, the bigger your repository is, the greater a
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
323 %performance advantage you'll see. The \hgext{inotify} daemon makes
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
324 %status operations almost instantaneous on repositories of all sizes!
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
325
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
326 \hgext{inotify}$B3HD%$rM-8z$K$7!$%j%]%8%H%jFb$G(BMercurial$B%3%^%s%I$r:G=i$K<B(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
327 $B9T$7$?;~$ODL>o$N(BMercurial$B%3%^%s%I$HF1MM$N@-G=$GF0$/!%%9%F!<%?%9%G!<%b%s$O(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
328 $BDL>o$N%9%F!<%?%9%9%-%c%s$r9T$$!$%+!<%M%k$+$i99?7$NDLCN$r<u$1$k$?$a$N%Y!<(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
329 $B%9%i%$%s$r<hF@$7$F$*$+$J$1$l$P$J$i$J$$$+$i$G$"$k!%0lJ}$G!$8eB3$N%9%F!<%?(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
330 $B%9%A%'%C%/$r9T$&(B\emph{$B$9$Y$F$N(B}$B%3%^%s%I$O!$$=$3$=$3$NBg$-$5$N%j%]%8%H%j$K(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
331 $BBP$7$F$bL\$K8+$($F9bB.2=$5$l$k!%$5$i$K%j%]%8%H%j$,Bg$-$/$J$k$KO"$l$F@-G=(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
332 $B$N8~>e$OBg$-$/$J$k!%(B\hgext{inotify}$B%G!<%b%s$O!$%j%]%8%H%j$N%5%$%:$K4X$o$i(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
333 $B$:!$%9%F!<%?%9<hF@$r$[$\=V;~$K9T$&$3$H$,$G$-$k!%(B
224
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
334
357
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
335 %If you like, you can manually start a status daemon using the
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
336 %\hgxcmd{inotify}{inserve} command. This gives you slightly finer
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
337 %control over how the daemon ought to run. This command will of course
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
338 %only be available when the \hgext{inotify} extension is enabled.
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
339
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
340 \hgxcmd{inotify}{inserve}$B%3%^%s%I$r;H$C$F%9%F!<%?%9%G!<%b%s$r<jF0$G<B9T$9(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
341 $B$k$3$H$b2DG=$G$"$k!%$3$l$K$h$j!$%G!<%b%s$,$I$N$h$&$KF0:n$9$k$N$+$r$d$d:Y(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
342 $B$+$/%3%s%H%m!<%k$9$k$3$H$,$G$-$k!%EvA3$J$,$i!$$3$N%3%^%s%I$O(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
343 \hgext{inotify}$B$,M-8z$N>l9g$N$_MxMQ2DG=$G$"$k!%(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
344
224
34943a3d50d6 Start writing up extensions. Begin with inotify.
Bryan O'Sullivan <bos@serpentine.com>
parents: 223
diff changeset
345
357
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
346 %When you're using the \hgext{inotify} extension, you should notice
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
347 %\emph{no difference at all} in Mercurial's behaviour, with the sole
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
348 %exception of status-related commands running a whole lot faster than
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
349 %they used to. You should specifically expect that commands will not
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
350 %print different output; neither should they give different results.
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
351 %If either of these situations occurs, please report a bug.
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
352
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
353 \hgext{inotify}$B3HD%$r;H$C$F$$$k;~$O(BMercurial$B$N(B\emph{$BA4$/JQ2=$J$7(B}$B$H$$$&F0(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
354 $B:n$K5$IU$/$@$m$&!%%9%F!<%?%9$K4X78$9$k%3%^%s%I$O0JA0$h$j$:$C$H9bB.$K$J$C(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
355 $B$F$$$k$H$$$&0l$D$NNc30$r=|$$$F%3%^%s%I$OFCJL$N=PNO$b7k2L$b=PNO$7$J$$$3$H(B
ef197f25f11e more hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 355
diff changeset
356 $B$KN10U$5$l$?$$!%2?$+FCJL$J$3$H$,5/$-$?$i%P%0$H$7$FJs9p$7$FM_$7$$!%(B
223
4c9b9416cd23 Skeleton for chapter on extensions.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
357
355
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
358 %\section{Flexible diff support with the \hgext{extdiff} extension}
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
359 \section{\hgext{extdiff}$B3HD%$K$h$k=@Fp$J(Bdiff$B%5%]!<%H(B}
226
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
360 \label{sec:hgext:extdiff}
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
361
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
362 Mercurial's built-in \hgcmd{diff} command outputs plaintext unified
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
363 diffs.
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
364 \interaction{extdiff.diff}
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
365 If you would like to use an external tool to display modifications,
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
366 you'll want to use the \hgext{extdiff} extension. This will let you
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
367 use, for example, a graphical diff tool.
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
368
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
369 The \hgext{extdiff} extension is bundled with Mercurial, so it's easy
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
370 to set up. In the \rcsection{extensions} section of your \hgrc,
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
371 simply add a one-line entry to enable the extension.
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
372 \begin{codesample2}
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
373 [extensions]
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
374 extdiff =
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
375 \end{codesample2}
231
28ddbf9f3729 Use new \hgxcmd and \hgxopt commands in a few places.
Bryan O'Sullivan <bos@serpentine.com>
parents: 226
diff changeset
376 This introduces a command named \hgxcmd{extdiff}{extdiff}, which by
28ddbf9f3729 Use new \hgxcmd and \hgxopt commands in a few places.
Bryan O'Sullivan <bos@serpentine.com>
parents: 226
diff changeset
377 default uses your system's \command{diff} command to generate a
28ddbf9f3729 Use new \hgxcmd and \hgxopt commands in a few places.
Bryan O'Sullivan <bos@serpentine.com>
parents: 226
diff changeset
378 unified diff in the same form as the built-in \hgcmd{diff} command.
226
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
379 \interaction{extdiff.extdiff}
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
380 The result won't be exactly the same as with the built-in \hgcmd{diff}
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
381 variations, because the output of \command{diff} varies from one
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
382 system to another, even when passed the same options.
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
383
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
384 As the ``\texttt{making snapshot}'' lines of output above imply, the
231
28ddbf9f3729 Use new \hgxcmd and \hgxopt commands in a few places.
Bryan O'Sullivan <bos@serpentine.com>
parents: 226
diff changeset
385 \hgxcmd{extdiff}{extdiff} command works by creating two snapshots of
28ddbf9f3729 Use new \hgxcmd and \hgxopt commands in a few places.
Bryan O'Sullivan <bos@serpentine.com>
parents: 226
diff changeset
386 your source tree. The first snapshot is of the source revision; the
28ddbf9f3729 Use new \hgxcmd and \hgxopt commands in a few places.
Bryan O'Sullivan <bos@serpentine.com>
parents: 226
diff changeset
387 second, of the target revision or working directory. The
28ddbf9f3729 Use new \hgxcmd and \hgxopt commands in a few places.
Bryan O'Sullivan <bos@serpentine.com>
parents: 226
diff changeset
388 \hgxcmd{extdiff}{extdiff} command generates these snapshots in a
28ddbf9f3729 Use new \hgxcmd and \hgxopt commands in a few places.
Bryan O'Sullivan <bos@serpentine.com>
parents: 226
diff changeset
389 temporary directory, passes the name of each directory to an external
28ddbf9f3729 Use new \hgxcmd and \hgxopt commands in a few places.
Bryan O'Sullivan <bos@serpentine.com>
parents: 226
diff changeset
390 diff viewer, then deletes the temporary directory. For efficiency, it
28ddbf9f3729 Use new \hgxcmd and \hgxopt commands in a few places.
Bryan O'Sullivan <bos@serpentine.com>
parents: 226
diff changeset
391 only snapshots the directories and files that have changed between the
28ddbf9f3729 Use new \hgxcmd and \hgxopt commands in a few places.
Bryan O'Sullivan <bos@serpentine.com>
parents: 226
diff changeset
392 two revisions.
226
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
393
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
394 Snapshot directory names have the same base name as your repository.
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
395 If your repository path is \dirname{/quux/bar/foo}, then \dirname{foo}
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
396 will be the name of each snapshot directory. Each snapshot directory
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
397 name has its changeset ID appended, if appropriate. If a snapshot is
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
398 of revision \texttt{a631aca1083f}, the directory will be named
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
399 \dirname{foo.a631aca1083f}. A snapshot of the working directory won't
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
400 have a changeset ID appended, so it would just be \dirname{foo} in
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
401 this example. To see what this looks like in practice, look again at
231
28ddbf9f3729 Use new \hgxcmd and \hgxopt commands in a few places.
Bryan O'Sullivan <bos@serpentine.com>
parents: 226
diff changeset
402 the \hgxcmd{extdiff}{extdiff} example above. Notice that the diff has
28ddbf9f3729 Use new \hgxcmd and \hgxopt commands in a few places.
Bryan O'Sullivan <bos@serpentine.com>
parents: 226
diff changeset
403 the snapshot directory names embedded in its header.
226
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
404
231
28ddbf9f3729 Use new \hgxcmd and \hgxopt commands in a few places.
Bryan O'Sullivan <bos@serpentine.com>
parents: 226
diff changeset
405 The \hgxcmd{extdiff}{extdiff} command accepts two important options.
28ddbf9f3729 Use new \hgxcmd and \hgxopt commands in a few places.
Bryan O'Sullivan <bos@serpentine.com>
parents: 226
diff changeset
406 The \hgxopt{extdiff}{extdiff}{-p} option lets you choose a program to
28ddbf9f3729 Use new \hgxcmd and \hgxopt commands in a few places.
Bryan O'Sullivan <bos@serpentine.com>
parents: 226
diff changeset
407 view differences with, instead of \command{diff}. With the
28ddbf9f3729 Use new \hgxcmd and \hgxopt commands in a few places.
Bryan O'Sullivan <bos@serpentine.com>
parents: 226
diff changeset
408 \hgxopt{extdiff}{extdiff}{-o} option, you can change the options that
28ddbf9f3729 Use new \hgxcmd and \hgxopt commands in a few places.
Bryan O'Sullivan <bos@serpentine.com>
parents: 226
diff changeset
409 \hgxcmd{extdiff}{extdiff} passes to the program (by default, these
28ddbf9f3729 Use new \hgxcmd and \hgxopt commands in a few places.
Bryan O'Sullivan <bos@serpentine.com>
parents: 226
diff changeset
410 options are ``\texttt{-Npru}'', which only make sense if you're
28ddbf9f3729 Use new \hgxcmd and \hgxopt commands in a few places.
Bryan O'Sullivan <bos@serpentine.com>
parents: 226
diff changeset
411 running \command{diff}). In other respects, the
28ddbf9f3729 Use new \hgxcmd and \hgxopt commands in a few places.
Bryan O'Sullivan <bos@serpentine.com>
parents: 226
diff changeset
412 \hgxcmd{extdiff}{extdiff} command acts similarly to the built-in
28ddbf9f3729 Use new \hgxcmd and \hgxopt commands in a few places.
Bryan O'Sullivan <bos@serpentine.com>
parents: 226
diff changeset
413 \hgcmd{diff} command: you use the same option names, syntax, and
28ddbf9f3729 Use new \hgxcmd and \hgxopt commands in a few places.
Bryan O'Sullivan <bos@serpentine.com>
parents: 226
diff changeset
414 arguments to specify the revisions you want, the files you want, and
28ddbf9f3729 Use new \hgxcmd and \hgxopt commands in a few places.
Bryan O'Sullivan <bos@serpentine.com>
parents: 226
diff changeset
415 so on.
226
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
416
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
417 As an example, here's how to run the normal system \command{diff}
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
418 command, getting it to generate context diffs (using the
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
419 \cmdopt{diff}{-c} option) instead of unified diffs, and five lines of
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
420 context instead of the default three (passing \texttt{5} as the
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
421 argument to the \cmdopt{diff}{-C} option).
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
422 \interaction{extdiff.extdiff-ctx}
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
423
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
424 Launching a visual diff tool is just as easy. Here's how to launch
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
425 the \command{kdiff3} viewer.
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
426 \begin{codesample2}
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
427 hg extdiff -p kdiff3 -o ''
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
428 \end{codesample2}
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
429
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
430 If your diff viewing command can't deal with directories, you can
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
431 easily work around this with a little scripting. For an example of
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
432 such scripting in action with the \hgext{mq} extension and the
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
433 \command{interdiff} command, see
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
434 section~\ref{mq-collab:tips:interdiff}.
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
435
355
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
436 %\subsection{Defining command aliases}
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
437 \subsection{$B%3%^%s%I$N%(%$%j%"%9$r:n$k(B}
226
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
438
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
439 It can be cumbersome to remember the options to both the
231
28ddbf9f3729 Use new \hgxcmd and \hgxopt commands in a few places.
Bryan O'Sullivan <bos@serpentine.com>
parents: 226
diff changeset
440 \hgxcmd{extdiff}{extdiff} command and the diff viewer you want to use,
28ddbf9f3729 Use new \hgxcmd and \hgxopt commands in a few places.
Bryan O'Sullivan <bos@serpentine.com>
parents: 226
diff changeset
441 so the \hgext{extdiff} extension lets you define \emph{new} commands
28ddbf9f3729 Use new \hgxcmd and \hgxopt commands in a few places.
Bryan O'Sullivan <bos@serpentine.com>
parents: 226
diff changeset
442 that will invoke your diff viewer with exactly the right options.
226
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
443
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
444 All you need to do is edit your \hgrc, and add a section named
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
445 \rcsection{extdiff}. Inside this section, you can define multiple
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
446 commands. Here's how to add a \texttt{kdiff3} command. Once you've
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
447 defined this, you can type ``\texttt{hg kdiff3}'' and the
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
448 \hgext{extdiff} extension will run \command{kdiff3} for you.
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
449 \begin{codesample2}
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
450 [extdiff]
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
451 cmd.kdiff3 =
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
452 \end{codesample2}
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
453 If you leave the right hand side of the definition empty, as above,
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
454 the \hgext{extdiff} extension uses the name of the command you defined
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
455 as the name of the external program to run. But these names don't
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
456 have to be the same. Here, we define a command named ``\texttt{hg
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
457 wibble}'', which runs \command{kdiff3}.
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
458 \begin{codesample2}
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
459 [extdiff]
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
460 cmd.wibble = kdiff3
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
461 \end{codesample2}
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
462
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
463 You can also specify the default options that you want to invoke your
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
464 diff viewing program with. The prefix to use is ``\texttt{opts.}'',
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
465 followed by the name of the command to which the options apply. This
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
466 example defines a ``\texttt{hg vimdiff}'' command that runs the
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
467 \command{vim} editor's \texttt{DirDiff} extension.
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
468 \begin{codesample2}
355
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
469 [extdiff]
226
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
470 cmd.vimdiff = vim
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
471 opts.vimdiff = -f '+next' '+execute "DirDiff" argv(0) argv(1)'
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
472 \end{codesample2}
eef2171243e8 Document the extdiff extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 224
diff changeset
473
355
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
474 %\section{Cherrypicking changes with the \hgext{transplant} extension}
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
475 \section{\hgext{transplant}$B3HD%$rMQ$$$?%A%'%j!<%T%C%-%s%099?7(B}
232
2469608b4a08 Start writing up the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 231
diff changeset
476 \label{sec:hgext:transplant}
2469608b4a08 Start writing up the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 231
diff changeset
477
355
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
478 %Need to have a long chat with Brendan about this.
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
479 $B!J(BBrendan$B$H$h$/OC$r$9$kI,MW$,$"$k!%!K(B
232
2469608b4a08 Start writing up the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 231
diff changeset
480
355
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
481 %\section{Send changes via email with the \hgext{patchbomb} extension}
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
482 \section{\hgext{patchbomb}$B3HD%$K$h$C$FJQ99$r%a!<%k$9$k(B}
232
2469608b4a08 Start writing up the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 231
diff changeset
483 \label{sec:hgext:patchbomb}
2469608b4a08 Start writing up the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 231
diff changeset
484
2469608b4a08 Start writing up the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 231
diff changeset
485 Many projects have a culture of ``change review'', in which people
2469608b4a08 Start writing up the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 231
diff changeset
486 send their modifications to a mailing list for others to read and
2469608b4a08 Start writing up the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 231
diff changeset
487 comment on before they commit the final version to a shared
2469608b4a08 Start writing up the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 231
diff changeset
488 repository. Some projects have people who act as gatekeepers; they
2469608b4a08 Start writing up the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 231
diff changeset
489 apply changes from other people to a repository to which those others
2469608b4a08 Start writing up the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 231
diff changeset
490 don't have access.
2469608b4a08 Start writing up the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 231
diff changeset
491
2469608b4a08 Start writing up the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 231
diff changeset
492 Mercurial makes it easy to send changes over email for review or
2469608b4a08 Start writing up the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 231
diff changeset
493 application, via its \hgext{patchbomb} extension. The extension is so
2469608b4a08 Start writing up the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 231
diff changeset
494 namd because changes are formatted as patches, and it's usual to send
2469608b4a08 Start writing up the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 231
diff changeset
495 one changeset per email message. Sending a long series of changes by
2469608b4a08 Start writing up the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 231
diff changeset
496 email is thus much like ``bombing'' the recipient's inbox, hence
2469608b4a08 Start writing up the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 231
diff changeset
497 ``patchbomb''.
2469608b4a08 Start writing up the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 231
diff changeset
498
2469608b4a08 Start writing up the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 231
diff changeset
499 As usual, the basic configuration of the \hgext{patchbomb} extension
2469608b4a08 Start writing up the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 231
diff changeset
500 takes just one or two lines in your \hgrc.
2469608b4a08 Start writing up the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 231
diff changeset
501 \begin{codesample2}
2469608b4a08 Start writing up the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 231
diff changeset
502 [extensions]
2469608b4a08 Start writing up the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 231
diff changeset
503 patchbomb =
2469608b4a08 Start writing up the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 231
diff changeset
504 \end{codesample2}
2469608b4a08 Start writing up the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 231
diff changeset
505 Once you've enabled the extension, you will have a new command
241
09d5897ad935 Fix a few more errors in the index.
Bryan O'Sullivan <bos@serpentine.com>
parents: 232
diff changeset
506 available, named \hgxcmd{patchbomb}{email}.
232
2469608b4a08 Start writing up the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 231
diff changeset
507
243
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
508 The safest and best way to invoke the \hgxcmd{patchbomb}{email}
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
509 command is to \emph{always} run it first with the
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
510 \hgxopt{patchbomb}{email}{-n} option. This will show you what the
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
511 command \emph{would} send, without actually sending anything. Once
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
512 you've had a quick glance over the changes and verified that you are
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
513 sending the right ones, you can rerun the same command, with the
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
514 \hgxopt{patchbomb}{email}{-n} option removed.
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
515
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
516 The \hgxcmd{patchbomb}{email} command accepts the same kind of
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
517 revision syntax as every other Mercurial command. For example, this
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
518 command will send every revision between 7 and \texttt{tip},
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
519 inclusive.
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
520 \begin{codesample2}
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
521 hg email -n 7:tip
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
522 \end{codesample2}
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
523 You can also specify a \emph{repository} to compare with. If you
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
524 provide a repository but no revisions, the \hgxcmd{patchbomb}{email}
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
525 command will send all revisions in the local repository that are not
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
526 present in the remote repository. If you additionally specify
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
527 revisions or a branch name (the latter using the
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
528 \hgxopt{patchbomb}{email}{-b} option), this will constrain the
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
529 revisions sent.
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
530
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
531 It's perfectly safe to run the \hgxcmd{patchbomb}{email} command
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
532 without the names of the people you want to send to: if you do this,
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
533 it will just prompt you for those values interactively. (If you're
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
534 using a Linux or Unix-like system, you should have enhanced
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
535 \texttt{readline}-style editing capabilities when entering those
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
536 headers, too, which is useful.)
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
537
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
538 When you are sending just one revision, the \hgxcmd{patchbomb}{email}
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
539 command will by default use the first line of the changeset
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
540 description as the subject of the single email message it sends.
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
541
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
542 If you send multiple revisions, the \hgxcmd{patchbomb}{email} command
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
543 will usually send one message per changeset. It will preface the
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
544 series with an introductory message, in which you should describe the
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
545 purpose of the series of changes you're sending.
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
546
355
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
547 %\subsection{Changing the behaviour of patchbombs}
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
548 \subsection{patchbombs$B$N5sF0$rJQ99$9$k(B}
243
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
549
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
550 Not every project has exactly the same conventions for sending changes
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
551 in email; the \hgext{patchbomb} extension tries to accommodate a
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
552 number of variations through command line options.
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
553 \begin{itemize}
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
554 \item You can write a subject for the introductory message on the
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
555 command line using the \hgxopt{patchbomb}{email}{-s} option. This
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
556 takes one argument, the text of the subject to use.
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
557 \item To change the email address from which the messages originate,
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
558 use the \hgxopt{patchbomb}{email}{-f} option. This takes one
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
559 argument, the email address to use.
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
560 \item The default behaviour is to send unified diffs (see
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
561 section~\ref{sec:mq:patch} for a description of the format), one per
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
562 message. You can send a binary bundle instead with the
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
563 \hgxopt{patchbomb}{email}{-b} option.
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
564 \item Unified diffs are normally prefaced with a metadata header. You
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
565 can omit this, and send unadorned diffs, with the
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
566 \hgxopt{patchbomb}{email}{--plain} option.
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
567 \item Diffs are normally sent ``inline'', in the same body part as the
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
568 description of a patch. This makes it easiest for the largest
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
569 number of readers to quote and respond to parts of a diff, as some
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
570 mail clients will only quote the first MIME body part in a message.
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
571 If you'd prefer to send the description and the diff in separate
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
572 body parts, use the \hgxopt{patchbomb}{email}{-a} option.
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
573 \item Instead of sending mail messages, you can write them to an
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
574 \texttt{mbox}-format mail folder using the
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
575 \hgxopt{patchbomb}{email}{-m} option. That option takes one
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
576 argument, the name of the file to write to.
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
577 \item If you would like to add a \command{diffstat}-format summary to
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
578 each patch, and one to the introductory message, use the
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
579 \hgxopt{patchbomb}{email}{-d} option. The \command{diffstat}
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
580 command displays a table containing the name of each file patched,
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
581 the number of lines affected, and a histogram showing how much each
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
582 file is modified. This gives readers a qualitative glance at how
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
583 complex a patch is.
7df934d3dcb5 Further document the patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents: 241
diff changeset
584 \end{itemize}
231
28ddbf9f3729 Use new \hgxcmd and \hgxopt commands in a few places.
Bryan O'Sullivan <bos@serpentine.com>
parents: 226
diff changeset
585
355
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
586 %%% Local Variables:
293
3b1291f24c0d - replaved latex-mode to yatex-mode
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 290
diff changeset
587 %%% mode: yatex
223
4c9b9416cd23 Skeleton for chapter on extensions.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
588 %%% TeX-master: "00book"
355
65aec2b27f64 - started hgext.tex
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 293
diff changeset
589 %%% End: