hgbook
changeset 3:906d9021f9e5
Making progress on autogenerated example output.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Sat Jun 24 17:42:40 2006 -0700 (2006-06-24) |
parents | 379a802c0210 |
children | 33a2e7b9978d |
files | en/00book.tex en/99defs.tex en/examples/mq.qinit-help en/examples/run-example en/mq.tex |
line diff
1.1 --- a/en/00book.tex Sat Jun 24 16:14:02 2006 -0700 1.2 +++ b/en/00book.tex Sat Jun 24 17:42:40 2006 -0700 1.3 @@ -2,6 +2,7 @@ 1.4 \usepackage{fullpage} 1.5 \usepackage{graphics} 1.6 \usepackage{newcent} 1.7 +\usepackage{fancyvrb} 1.8 \usepackage{hyperref} 1.9 1.10 \include{99defs}
2.1 --- a/en/99defs.tex Sat Jun 24 16:14:02 2006 -0700 2.2 +++ b/en/99defs.tex Sat Jun 24 17:42:40 2006 -0700 2.3 @@ -1,8 +1,11 @@ 2.4 +\newcommand{\tildefile}[1]{\texttt{\~/#1}} 2.5 \newcommand{\filename}[1]{\texttt{#1}} 2.6 \newcommand{\hgext}[1]{\texttt{#1}} 2.7 \newcommand{\hgcmd}[1]{``\texttt{hg #1}''} 2.8 \newcommand{\hgcmdargs}[2]{``\texttt{hg #1 #2}''} 2.9 2.10 +\DefineVerbatimEnvironment{codesample}{Verbatim}{frame=single,gobble=2,numbers=left} 2.11 + 2.12 %%% Local Variables: 2.13 %%% mode: latex 2.14 %%% TeX-master: "00book"
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/en/examples/mq.qinit-help Sat Jun 24 17:42:40 2006 -0700 3.3 @@ -0,0 +1,2 @@ 3.4 +# name: help 3.5 +hg help qinit
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/en/examples/run-example Sat Jun 24 17:42:40 2006 -0700 4.3 @@ -0,0 +1,58 @@ 4.4 +#!/usr/bin/python 4.5 + 4.6 +import cStringIO 4.7 +import os 4.8 +import pty 4.9 +import re 4.10 +import sys 4.11 + 4.12 +class example: 4.13 + def __init__(self, name): 4.14 + self.name = name 4.15 + 4.16 + def parse(self): 4.17 + fp = open(self.name) 4.18 + cfp = cStringIO.StringIO() 4.19 + for line in fp: 4.20 + cfp.write(line) 4.21 + if not line.rstrip().endswith('\\'): 4.22 + yield cfp.getvalue() 4.23 + cfp.seek(0) 4.24 + cfp.truncate() 4.25 + 4.26 + name_re = re.compile('#\s*name:\s*(.*)$') 4.27 + 4.28 + def status(self, s): 4.29 + sys.stdout.write(s) 4.30 + if not s.endswith('\n'): 4.31 + sys.stdout.flush() 4.32 + 4.33 + def run(self): 4.34 + ofp = None 4.35 + self.status('running %s ' % os.path.basename(self.name)) 4.36 + for hunk in self.parse(): 4.37 + m = self.name_re.match(hunk) 4.38 + if m: 4.39 + self.status('.') 4.40 + out = m.group(1) 4.41 + assert os.sep not in out 4.42 + if out: 4.43 + ofp = open('%s.%s.out' % (self.name, out), 'w') 4.44 + else: 4.45 + ofp = None 4.46 + elif ofp: ofp.write(hunk) 4.47 + self.status('\n') 4.48 + 4.49 +def main(path='.'): 4.50 + args = sys.argv[1:] 4.51 + if args: 4.52 + for a in args: 4.53 + example(a).run() 4.54 + return 4.55 + for name in os.listdir(path): 4.56 + if name == 'run-example' or name.startswith('.'): continue 4.57 + if name.endswith('.out') or name.endswith('~'): continue 4.58 + example(os.path.join(path, name)).run() 4.59 + 4.60 +if __name__ == '__main__': 4.61 + main()
5.1 --- a/en/mq.tex Sat Jun 24 16:14:02 2006 -0700 5.2 +++ b/en/mq.tex Sat Jun 24 17:42:40 2006 -0700 5.3 @@ -21,7 +21,7 @@ 5.4 5.5 The patch management problem arises in many situations. Probably the 5.6 most visible is that a user of an open source software project will 5.7 -contribute a bugfix or new feature to the project's maintainers in the 5.8 +contribute a bug fix or new feature to the project's maintainers in the 5.9 form of a patch. 5.10 5.11 Distributors of operating systems that include open source software 5.12 @@ -35,7 +35,7 @@ 5.13 patch will contain only one bug fix (the patch might modify several 5.14 files, but it's doing ``only one thing''), and you may have a number 5.15 of such patches for different bugs you need fixed and local changes 5.16 -you require. In this situation, if you submit a bugfix patch to the 5.17 +you require. In this situation, if you submit a bug fix patch to the 5.18 upstream maintainers of a package and they include your fix in a 5.19 subsequent release, you can simply drop that single patch when you're 5.20 updating to the newer release. 5.21 @@ -99,7 +99,7 @@ 5.22 modifications those patches make. 5.23 5.24 Quilt knows nothing about revision control tools, so it works equally 5.25 -well on top of an unpacked tarball or a Suversion repository. 5.26 +well on top of an unpacked tarball or a Subversion repository. 5.27 5.28 \subsection{From patchwork quilt to Mercurial Queues} 5.29 \label{sec:mq:quilt-mq} 5.30 @@ -128,15 +128,19 @@ 5.31 \section{Getting started with Mercurial Queues} 5.32 \label{sec:mq:start} 5.33 5.34 -Because MQ is implemented as an extension, you have to explicitly 5.35 -enable it in order to use it. (You don't need to download anything; 5.36 -MQ ships with the standard Mercurial distribution.) To enable it, 5.37 -edit your \filename{~/.hgrc} file, and add the following lines: 5.38 +Because MQ is implemented as an extension, you must explicitly enable 5.39 +before you can use it. (You don't need to download anything; MQ ships 5.40 +with the standard Mercurial distribution.) To enable MQ, edit your 5.41 +\tildefile{.hgrc} file, and add the following lines: 5.42 5.43 -\begin{verbatim} 5.44 -[extensions] 5.45 -hgext.mq = 5.46 -\end{verbatim} 5.47 +\begin{codesample} 5.48 + [extensions] 5.49 + hgext.mq = 5.50 +\end{codesample} 5.51 + 5.52 +Once the extension is enabled, it will make a number of new commands 5.53 +available. 5.54 + 5.55 5.56 %%% Local Variables: 5.57 %%% mode: latex