Commits

Bryan O'Sullivan committed 339e752

More progress on MQ chapter and general support.

Added a note environment.

Fixed generated HTML so it wouldn't use huge escaped entities for everything.

Wrote a small amount of actual content.

  • Participants
  • Parent commits 69d90ab

Comments (0)

Files changed (4)

File en/99defs.tex

 \newcommand{\hgcmd}[1]{``\texttt{hg #1}''}
 \newcommand{\hgcmdargs}[2]{``\texttt{hg #1 #2}''}
 
+\newsavebox{\notebox}
+\newenvironment{note}{\begin{lrbox}{\notebox}\begin{minipage}{\textwidth}\textbf{Note:}\space}{\end{minipage}\end{lrbox}\fbox{\usebox{\notebox}}}
+
 \DefineVerbatimEnvironment{codesample4}{Verbatim}{frame=single,gobble=4,numbers=left,commandchars=\\\{\}}
 \newcommand{\interaction}[1]{\VerbatimInput[frame=single,numbers=left,commandchars=\\\{\}]{examples/#1.out}}
 
 
 example-sources := \
 	examples/run-example \
-	examples/mq.qinit-help
+	examples/mq.qinit-help \
+	examples/mq.tutorial
 
 latex-options = \
 	-interaction batchmode \
 
 define htlatex
 	mkdir -p $(dir $(1))
-	head -4 $(shell which htlatex) > $(dir $(1))/htlatex.book
+	head -2 $(shell which htlatex) > $(dir $(1))/htlatex.book
+	cp 99book.bib $(dir $@)
+	echo '(cd $(dir $@) && bibtex $(basename $(notdir $@)))' >> $(dir $(1))/htlatex.book
+	head -3 $(shell which htlatex) >> $(dir $(1))/htlatex.book
+	echo 'echo status $$$$' >>  $(dir $(1))/htlatex.book
 	chmod 755 $(dir $(1))/htlatex.book
 	$(dir $(1))/htlatex.book $(2) "xhtml,html4-uni,$(3)" " -cunihtf -utf8" "" "$(call latex-options,$(1))" || (rm -f $(1); exit 1)
 	cd $(dir $(1)) && tex4ht -f/$(basename $(notdir $(1))) -cvalidate -cunihtf
 	cd $(dir $(1)) && t4ht -f/$(basename $(notdir $(1)))
+	perl -pi -e 's/&#x00([0-7][0-9a-f]);/chr(hex($$1))/egi' $(dir $(1))/*.html
 endef
 
 html/onepage/hgbook.html: $(sources) examples
 	cd examples && ./run-example
 
 clean:
-	rm -rf html pdf *.aux *.dvi *.log *.out
+	rm -rf html pdf *.aux *.dvi *.log *.out examples/*.out examples/.run

File en/examples/mq.tutorial

+echo '[extensions]' >> $HGRC
+echo 'hgext.mq =' >> $HGRC
+
+#$ name: qinit
+
+hg clone http://hg.serpentine.com/mercurial/hg mq-sandbox
+
+cd mq-sandbox
+
+hg qinit
+
+#$ name: qnew
+
+hg tip
+
+hg qnew first.patch
+
+ls .hg/patches
+
+hg tip
 with the standard Mercurial distribution.)  To enable MQ, edit your
 \tildefile{.hgrc} file, and add the lines in figure~\ref{ex:mq:config}.
 
-\begin{figure}
+\begin{figure}[h]
   \begin{codesample4}
     [extensions]
     hgext.mq =
 \end{figure}
 
 Once the extension is enabled, it will make a number of new commands
-available.  To verify that the extension is working, follow the
-example in figure~\ref{ex:mq:enabled}.
+available.  To verify that the extension is working, you can use
+\hgcmd{help} to see if the \hgcmd{qinit} command is now available; see
+the example in figure~\ref{ex:mq:enabled}.
 
-\begin{figure}
+\begin{figure}[h]
   \interaction{mq.qinit-help.help}
   \caption{How to verify that MQ is enabled}
   \label{ex:mq:enabled}
 \end{figure}
 
+You can use MQ with \emph{any} Mercurial repository; to start, simply
+prepare the repository using the \hgcmd{qinit} command (see
+figure~\ref{ex:mq:qinit}).  This command creates an empty directory
+called \filename{.hg/patches}, where MQ will keep its metadata.  As
+with many Mercurial commands, the \hgcmd{qinit} command prints nothing
+if it succeeds.
+
+\begin{figure}[h]
+  \interaction{mq.tutorial.qinit}
+  \caption{Preparing a repository for use with MQ}
+  \label{ex:mq:qinit}
+\end{figure}
+
+\begin{figure}[h]
+  \interaction{mq.tutorial.qnew}
+  \caption{Creating a new patch}
+  \label{ex:mq:qnew}
+\end{figure}
+
+To commence work on a new patch, use the \hgcmd{qnew} command.  This
+command takes one argument, the name of the patch to create.  MQ will
+use this as the name of an actual file in the \filename{.hg/patches}
+directory, as you can see in figure~\ref{ex:mq:qnew}.
+
+Now also present in the \filename{.hg/patches} directory are two new
+files, \filename{series} and \filename{status}.  The \filename{series}
+file lists all of the patches that MQ knows about for this repository,
+with one patch per line.  The \filename{status} file lists all of the
+patches that MQ has \emph{applied} in this repository.
+
+\begin{note}
+  You may sometimes want to edit the \filename{series} file by hand;
+  for example, to change the sequence in which some patches are
+  applied.  However, manually editing the \filename{status} file is
+  almost always a bad idea, as it's easy to corrupt MQ's idea of what
+  is happening.
+\end{note}
+
 %%% Local Variables: 
 %%% mode: latex
 %%% TeX-master: "00book"