comparison en/hgext.tex @ 231:28ddbf9f3729

Use new \hgxcmd and \hgxopt commands in a few places.
author Bryan O'Sullivan <bos@serpentine.com>
date Sun, 27 May 2007 09:39:58 -0700
parents eef2171243e8
children 2469608b4a08
comparison
equal deleted inserted replaced
230:f83281da4122 231:28ddbf9f3729
11 \emph{plugins}). We've already discussed a few of these extensions in 11 \emph{plugins}). We've already discussed a few of these extensions in
12 earlier chapters. 12 earlier chapters.
13 \begin{itemize} 13 \begin{itemize}
14 \item Section~\ref{sec:tour-merge:fetch} covers the \hgext{fetch} 14 \item Section~\ref{sec:tour-merge:fetch} covers the \hgext{fetch}
15 extension; this combines pulling new changes and merging them with 15 extension; this combines pulling new changes and merging them with
16 local changes into a single command, \hgcmd{fetch}. 16 local changes into a single command, \hgxcmd{fetch}{fetch}.
17 \item The \hgext{bisect} extension adds an efficient pruning search 17 \item The \hgext{bisect} extension adds an efficient pruning search
18 for changes that introduced bugs, and we documented it in 18 for changes that introduced bugs, and we documented it in
19 chapter~\ref{sec:undo:bisect}. 19 chapter~\ref{sec:undo:bisect}.
20 \item In chapter~\ref{chap:hook}, we covered several extensions that 20 \item In chapter~\ref{chap:hook}, we covered several extensions that
21 are useful for hook-related functionality: \hgext{acl} adds access 21 are useful for hook-related functionality: \hgext{acl} adds access
146 \end{codesample4} 146 \end{codesample4}
147 \item Make sure that you have the Mercurial Queues extension, 147 \item Make sure that you have the Mercurial Queues extension,
148 \hgext{mq}, enabled. If you've never used MQ, read 148 \hgext{mq}, enabled. If you've never used MQ, read
149 section~\ref{sec:mq:start} to get started quickly. 149 section~\ref{sec:mq:start} to get started quickly.
150 \item Go into the \dirname{inotify} repo, and apply all of the 150 \item Go into the \dirname{inotify} repo, and apply all of the
151 \hgext{inotify} patches using the \hgopt{qpush}{-a} option to the 151 \hgext{inotify} patches using the \hgxopt{mq}{qpush}{-a} option to
152 \hgcmd{qpush} command. 152 the \hgxcmd{mq}{qpush} command.
153 \begin{codesample4} 153 \begin{codesample4}
154 cd inotify 154 cd inotify
155 hg qpush -a 155 hg qpush -a
156 \end{codesample4} 156 \end{codesample4}
157 If you get an error message from \hgcmd{qpush}, you should not 157 If you get an error message from \hgxcmd{mq}{qpush}, you should not
158 continue. Instead, ask for help. 158 continue. Instead, ask for help.
159 \item Build and install the patched version of Mercurial. 159 \item Build and install the patched version of Mercurial.
160 \begin{codesample4} 160 \begin{codesample4}
161 python setup.py build --force 161 python setup.py build --force
162 sudo python setup.py install --skip-build 162 sudo python setup.py install --skip-build
191 modest size. Better yet, the bigger your repository is, the greater a 191 modest size. Better yet, the bigger your repository is, the greater a
192 performance advantage you'll see. The \hgext{inotify} daemon makes 192 performance advantage you'll see. The \hgext{inotify} daemon makes
193 status operations almost instantaneous on repositories of all sizes! 193 status operations almost instantaneous on repositories of all sizes!
194 194
195 If you like, you can manually start a status daemon using the 195 If you like, you can manually start a status daemon using the
196 \hgcmd{inserve} command. This gives you slightly finer control over 196 \hgxcmd{inotify}{inserve} command. This gives you slightly finer
197 how the daemon ought to run. This command will of course only be 197 control over how the daemon ought to run. This command will of course
198 available when the \hgext{inotify} extension is enabled. 198 only be available when the \hgext{inotify} extension is enabled.
199 199
200 When you're using the \hgext{inotify} extension, you should notice 200 When you're using the \hgext{inotify} extension, you should notice
201 \emph{no difference at all} in Mercurial's behaviour, with the sole 201 \emph{no difference at all} in Mercurial's behaviour, with the sole
202 exception of status-related commands running a whole lot faster than 202 exception of status-related commands running a whole lot faster than
203 they used to. You should specifically expect that commands will not 203 they used to. You should specifically expect that commands will not
219 simply add a one-line entry to enable the extension. 219 simply add a one-line entry to enable the extension.
220 \begin{codesample2} 220 \begin{codesample2}
221 [extensions] 221 [extensions]
222 extdiff = 222 extdiff =
223 \end{codesample2} 223 \end{codesample2}
224 This introduces a command named \hgcmd{extdiff}, which by default uses 224 This introduces a command named \hgxcmd{extdiff}{extdiff}, which by
225 your system's \command{diff} command to generate a unified diff in the 225 default uses your system's \command{diff} command to generate a
226 same form as the built-in \hgcmd{diff} command. 226 unified diff in the same form as the built-in \hgcmd{diff} command.
227 \interaction{extdiff.extdiff} 227 \interaction{extdiff.extdiff}
228 The result won't be exactly the same as with the built-in \hgcmd{diff} 228 The result won't be exactly the same as with the built-in \hgcmd{diff}
229 variations, because the output of \command{diff} varies from one 229 variations, because the output of \command{diff} varies from one
230 system to another, even when passed the same options. 230 system to another, even when passed the same options.
231 231
232 As the ``\texttt{making snapshot}'' lines of output above imply, the 232 As the ``\texttt{making snapshot}'' lines of output above imply, the
233 \hgcmd{extdiff} command works by creating two snapshots of your source 233 \hgxcmd{extdiff}{extdiff} command works by creating two snapshots of
234 tree. The first snapshot is of the source revision; the second, of 234 your source tree. The first snapshot is of the source revision; the
235 the target revision or working directory. The \hgcmd{extdiff} command 235 second, of the target revision or working directory. The
236 generates these snapshots in a temporary directory, passes the name of 236 \hgxcmd{extdiff}{extdiff} command generates these snapshots in a
237 each directory to an external diff viewer, then deletes the temporary 237 temporary directory, passes the name of each directory to an external
238 directory. For efficiency, it only snapshots the directories and 238 diff viewer, then deletes the temporary directory. For efficiency, it
239 files that have changed between the two revisions. 239 only snapshots the directories and files that have changed between the
240 two revisions.
240 241
241 Snapshot directory names have the same base name as your repository. 242 Snapshot directory names have the same base name as your repository.
242 If your repository path is \dirname{/quux/bar/foo}, then \dirname{foo} 243 If your repository path is \dirname{/quux/bar/foo}, then \dirname{foo}
243 will be the name of each snapshot directory. Each snapshot directory 244 will be the name of each snapshot directory. Each snapshot directory
244 name has its changeset ID appended, if appropriate. If a snapshot is 245 name has its changeset ID appended, if appropriate. If a snapshot is
245 of revision \texttt{a631aca1083f}, the directory will be named 246 of revision \texttt{a631aca1083f}, the directory will be named
246 \dirname{foo.a631aca1083f}. A snapshot of the working directory won't 247 \dirname{foo.a631aca1083f}. A snapshot of the working directory won't
247 have a changeset ID appended, so it would just be \dirname{foo} in 248 have a changeset ID appended, so it would just be \dirname{foo} in
248 this example. To see what this looks like in practice, look again at 249 this example. To see what this looks like in practice, look again at
249 the \hgcmd{extdiff} example above. Notice that the diff has the 250 the \hgxcmd{extdiff}{extdiff} example above. Notice that the diff has
250 snapshot directory names embedded in its header. 251 the snapshot directory names embedded in its header.
251 252
252 The \hgcmd{extdiff} command accepts two important options. The 253 The \hgxcmd{extdiff}{extdiff} command accepts two important options.
253 \hgopt{extdiff}{-p} option lets you choose a program to view 254 The \hgxopt{extdiff}{extdiff}{-p} option lets you choose a program to
254 differences with, instead of \command{diff}. With the 255 view differences with, instead of \command{diff}. With the
255 \hgopt{extdiff}{-o} option, you can change the options that 256 \hgxopt{extdiff}{extdiff}{-o} option, you can change the options that
256 \hgcmd{extdiff} passes to the program (by default, these options are 257 \hgxcmd{extdiff}{extdiff} passes to the program (by default, these
257 ``\texttt{-Npru}'', which only make sense if you're running 258 options are ``\texttt{-Npru}'', which only make sense if you're
258 \command{diff}). In other respects, the \hgcmd{extdiff} acts 259 running \command{diff}). In other respects, the
259 similarly to the built-in \hgcmd{diff} command: you use the same 260 \hgxcmd{extdiff}{extdiff} command acts similarly to the built-in
260 option names, syntax, and arguments to specify the revisions you want, 261 \hgcmd{diff} command: you use the same option names, syntax, and
261 the files you want, and so on. 262 arguments to specify the revisions you want, the files you want, and
263 so on.
262 264
263 As an example, here's how to run the normal system \command{diff} 265 As an example, here's how to run the normal system \command{diff}
264 command, getting it to generate context diffs (using the 266 command, getting it to generate context diffs (using the
265 \cmdopt{diff}{-c} option) instead of unified diffs, and five lines of 267 \cmdopt{diff}{-c} option) instead of unified diffs, and five lines of
266 context instead of the default three (passing \texttt{5} as the 268 context instead of the default three (passing \texttt{5} as the
280 section~\ref{mq-collab:tips:interdiff}. 282 section~\ref{mq-collab:tips:interdiff}.
281 283
282 \subsection{Defining command aliases} 284 \subsection{Defining command aliases}
283 285
284 It can be cumbersome to remember the options to both the 286 It can be cumbersome to remember the options to both the
285 \hgcmd{extdiff} command and the diff viewer you want to use, so the 287 \hgxcmd{extdiff}{extdiff} command and the diff viewer you want to use,
286 \hgext{extdiff} extension lets you define \emph{new} commands that 288 so the \hgext{extdiff} extension lets you define \emph{new} commands
287 will invoke your diff viewer with exactly the right options. 289 that will invoke your diff viewer with exactly the right options.
288 290
289 All you need to do is edit your \hgrc, and add a section named 291 All you need to do is edit your \hgrc, and add a section named
290 \rcsection{extdiff}. Inside this section, you can define multiple 292 \rcsection{extdiff}. Inside this section, you can define multiple
291 commands. Here's how to add a \texttt{kdiff3} command. Once you've 293 commands. Here's how to add a \texttt{kdiff3} command. Once you've
292 defined this, you can type ``\texttt{hg kdiff3}'' and the 294 defined this, you can type ``\texttt{hg kdiff3}'' and the
314 [extdiff] 316 [extdiff]
315 cmd.vimdiff = vim 317 cmd.vimdiff = vim
316 opts.vimdiff = -f '+next' '+execute "DirDiff" argv(0) argv(1)' 318 opts.vimdiff = -f '+next' '+execute "DirDiff" argv(0) argv(1)'
317 \end{codesample2} 319 \end{codesample2}
318 320
321
319 %%% Local Variables: 322 %%% Local Variables:
320 %%% mode: latex 323 %%% mode: latex
321 %%% TeX-master: "00book" 324 %%% TeX-master: "00book"
322 %%% End: 325 %%% End: