hgbook

changeset 59:0aae9d676e0f

Merge with jeffpc.
author Bryan O'Sullivan <bos@serpentine.com>
date Wed Aug 02 19:53:34 2006 -0700 (2006-08-02)
parents 3f0176046fdc 3649ee841264
children 70d07ff31ee4
files en/99defs.tex en/Makefile
line diff
     1.1 --- a/en/00book.tex	Wed Aug 02 19:43:53 2006 -0700
     1.2 +++ b/en/00book.tex	Wed Aug 02 19:53:34 2006 -0700
     1.3 @@ -1,57 +1,58 @@
     1.4 -% The use of oneside here is a temporary hack; \marginpar entries
     1.5 -% don't show up on odd pages of PDF output without it.  Sigh.
     1.6 -\documentclass[oneside]{book}
     1.7 -\usepackage{enumerate}
     1.8 -\usepackage{fullpage}
     1.9 -\usepackage{makeidx}
    1.10 -\usepackage{ifpdf}
    1.11 -\usepackage{graphicx}
    1.12 -\usepackage{pslatex}
    1.13 -\usepackage{fancyvrb}
    1.14 -% leave hyperref until last
    1.15 -\usepackage[colorlinks=true,bookmarks=true]{hyperref}
    1.16 -
    1.17 -\include{99defs}
    1.18 -
    1.19 -\title{Distributed revision control with Mercurial}
    1.20 -\author{Bryan O'Sullivan}
    1.21 -\date{Copyright \copyright\ 2006 Bryan O'Sullivan.\\
    1.22 -  This material may be distributed only subject to the terms and
    1.23 -  conditions set forth in version 1.0 of the Open Publication License.
    1.24 -  Please refer to Appendix~\ref{cha:opl} for the license text.\\
    1.25 -  This book was prepared from revision \input{build_id}.}
    1.26 -
    1.27 -\makeindex
    1.28 -
    1.29 -\begin{document}
    1.30 -
    1.31 -\maketitle
    1.32 -
    1.33 -\addcontentsline{toc}{chapter}{Contents}
    1.34 -\pagenumbering{roman}
    1.35 -\tableofcontents
    1.36 -\listoffigures
    1.37 -%\listoftables
    1.38 -
    1.39 -\pagenumbering{arabic}
    1.40 -
    1.41 -\include{preface}
    1.42 -\include{intro}
    1.43 -\include{daily}
    1.44 -\include{hook}
    1.45 -\include{mq}
    1.46 -
    1.47 -\appendix
    1.48 -\include{license}
    1.49 -\addcontentsline{toc}{chapter}{Bibliography}
    1.50 -\bibliographystyle{alpha}
    1.51 -\bibliography{99book}
    1.52 -
    1.53 -\printindex
    1.54 -
    1.55 -\end{document}
    1.56 -
    1.57 -%%% Local Variables: 
    1.58 -%%% mode: latex
    1.59 -%%% TeX-master: t
    1.60 -%%% End: 
    1.61 +% The use of oneside here is a temporary hack; \marginpar entries
    1.62 +% don't show up on odd pages of PDF output without it.  Sigh.
    1.63 +\documentclass[oneside]{book}
    1.64 +\usepackage{enumerate}
    1.65 +\usepackage{fullpage}
    1.66 +\usepackage{makeidx}
    1.67 +\usepackage{ifpdf}
    1.68 +\usepackage{graphicx}
    1.69 +\usepackage{pslatex}
    1.70 +\usepackage{fancyvrb}
    1.71 +% leave hyperref until last
    1.72 +\usepackage[colorlinks=true,bookmarks=true]{hyperref}
    1.73 +
    1.74 +\include{99defs}
    1.75 +
    1.76 +\title{Distributed revision control with Mercurial}
    1.77 +\author{Bryan O'Sullivan}
    1.78 +\date{Copyright \copyright\ 2006 Bryan O'Sullivan.\\
    1.79 +  This material may be distributed only subject to the terms and
    1.80 +  conditions set forth in version 1.0 of the Open Publication License.
    1.81 +  Please refer to Appendix~\ref{cha:opl} for the license text.\\
    1.82 +  This book was prepared from revision \input{build_id}.}
    1.83 +
    1.84 +\makeindex
    1.85 +
    1.86 +\begin{document}
    1.87 +
    1.88 +\maketitle
    1.89 +
    1.90 +\addcontentsline{toc}{chapter}{Contents}
    1.91 +\pagenumbering{roman}
    1.92 +\tableofcontents
    1.93 +\listoffigures
    1.94 +%\listoftables
    1.95 +
    1.96 +\pagenumbering{arabic}
    1.97 +
    1.98 +\include{preface}
    1.99 +\include{intro}
   1.100 +\include{concepts}
   1.101 +\include{daily}
   1.102 +\include{hook}
   1.103 +\include{mq}
   1.104 +
   1.105 +\appendix
   1.106 +\include{license}
   1.107 +\addcontentsline{toc}{chapter}{Bibliography}
   1.108 +\bibliographystyle{alpha}
   1.109 +\bibliography{99book}
   1.110 +
   1.111 +\printindex
   1.112 +
   1.113 +\end{document}
   1.114 +
   1.115 +%%% Local Variables: 
   1.116 +%%% mode: latex
   1.117 +%%% TeX-master: t
   1.118 +%%% End: 
     2.1 --- a/en/99defs.tex	Wed Aug 02 19:43:53 2006 -0700
     2.2 +++ b/en/99defs.tex	Wed Aug 02 19:53:34 2006 -0700
     2.3 @@ -79,6 +79,9 @@
     2.4  \newenvironment{note}%
     2.5    {\begin{lrbox}{\notebox}\begin{minipage}{0.7\textwidth}\textbf{Note:}\space}%
     2.6    {\end{minipage}\end{lrbox}\fbox{\usebox{\notebox}}}
     2.7 +\newenvironment{caution}%
     2.8 +  {\begin{lrbox}{\notebox}\begin{minipage}{0.7\textwidth}\textbf{Caution:}\space}%
     2.9 +  {\end{minipage}\end{lrbox}\fbox{\usebox{\notebox}}}
    2.10  
    2.11  % Code sample, eating 4 characters of leading space.
    2.12  \DefineVerbatimEnvironment{codesample4}{Verbatim}{frame=single,gobble=4,numbers=left,commandchars=\\\{\}}
     3.1 --- a/en/Makefile	Wed Aug 02 19:43:53 2006 -0700
     3.2 +++ b/en/Makefile	Wed Aug 02 19:53:34 2006 -0700
     3.3 @@ -7,6 +7,7 @@
     3.4  	99book.bib \
     3.5  	99defs.tex \
     3.6  	build_id.tex \
     3.7 +	concepts.tex \
     3.8  	daily.tex \
     3.9  	hook.tex \
    3.10  	intro.tex \
    3.11 @@ -21,6 +22,7 @@
    3.12  	examples/hook.msglen \
    3.13  	examples/hook.simple \
    3.14  	examples/hook.ws \
    3.15 +	examples/concepts \
    3.16  	examples/mq.qinit-help \
    3.17  	examples/mq.dodiff \
    3.18  	examples/mq.id \
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/en/concepts.tex	Wed Aug 02 19:53:34 2006 -0700
     4.3 @@ -0,0 +1,131 @@
     4.4 +\chapter{Basic Concepts}
     4.5 +\label{chap:concepts}
     4.6 +
     4.7 +This chapter introduces some of the basic concepts behind distributed
     4.8 +version control systems such as Mercurial.
     4.9 +
    4.10 +\section{Repository}
    4.11 +\label{sec:concepts:repo}
    4.12 +The repository is a directory where Mercurial stores the history for the
    4.13 +files under revision control.
    4.14 +
    4.15 +\subsection{Where?}
    4.16 +% where is this repository you speak of?
    4.17 +XXX
    4.18 +
    4.19 +\subsection{How?}
    4.20 +% How are the changes stored?
    4.21 +XXX
    4.22 +
    4.23 +\subsection{Structure}
    4.24 +\label{sec:concepts:structure}
    4.25 +% What's the structure of the repository?
    4.26 +A typical Mercurial repository is a directory which contains a checked out
    4.27 +working copy (see section~\ref{sec:concepts:workingcopy}) as well as
    4.28 +\sdirname{.hg} directory.  Figure~\ref{ex:concepts:dirlist} shows the
    4.29 +contents of a freshly created repository.  This repository does not contain
    4.30 +any revisions. Let's take a look at a repository that has history for
    4.31 +several files.
    4.32 +Figure~\ref{ex:concepts:dirlist2} shows the contents of a repository keeping
    4.33 +history on two files.  We see the checked out copies of the files
    4.34 +\filename{foo} and \filename{bar}, as well as the files containing their
    4.35 +histories \filename{foo.i} and \filename{bar.i}, respectively. Additionally,
    4.36 +we see the \filename{changelog.i} and \filename{00manifest.i} files. These
    4.37 +contain the repository-wide revision data, such as the commit message, and
    4.38 +the list of files in the repository during the commit.
    4.39 +
    4.40 +\begin{figure}[ht]
    4.41 +  \interaction{concepts.dirlist}
    4.42 +  \caption{Contents of a freshly created repository}
    4.43 +  \label{ex:concepts:dirlist}
    4.44 +\end{figure}
    4.45 +
    4.46 +\begin{figure}[ht]
    4.47 +  \interaction{concepts.dirlist2}
    4.48 +  \caption{Contents of a repository tracking two files}
    4.49 +  \label{ex:concepts:dirlist2}
    4.50 +\end{figure}
    4.51 +
    4.52 +\subsection{hgrc}
    4.53 +% .hg/hgrc
    4.54 +XXX
    4.55 +
    4.56 +\subsection{Creating a Repository}
    4.57 +% hg init
    4.58 +Creating a repository is quick and painless.  One uses the \hgcmd{init}
    4.59 +command as figure~\ref{ex:concepts:hginit} demonstrates.  The one argument
    4.60 +passed to the \hgcmd{init} command is the name of the repository. The name
    4.61 +can be any string usable as a directory name.
    4.62 +
    4.63 +\begin{caution}
    4.64 +If you do not specify a name of the repository, the current working
    4.65 +directory will be used instead.
    4.66 +\end{caution}
    4.67 +
    4.68 +\begin{figure}[ht]
    4.69 +  \interaction{concepts.hginit}
    4.70 +  \caption{Creating a new repository}
    4.71 +  \label{ex:concepts:hginit}
    4.72 +\end{figure}
    4.73 +
    4.74 +\subsection{Remote Repositories}
    4.75 +\label{sec:concepts:remoterepo}
    4.76 +In addition to repositories stored on the local file system, Mercurial
    4.77 +supports so called \emph{remote repositories}.  These remote repositories
    4.78 +can be accessed via several different methods.  See
    4.79 +section~\ref{sec:XXX:remotesetup} for instructions how to set up remote
    4.80 +repositories.
    4.81 +% XXX: reference the proper section!
    4.82 +
    4.83 +\subsubsection{SSH}
    4.84 +\label{sec:concepts:remoterepo:ssh}
    4.85 +Mercurial can use \command{ssh} to send and receive changes. The remote
    4.86 +repository is identified by an URL. The basic format for the URL is:
    4.87 +
    4.88 +\begin{verbatim}
    4.89 +ssh://[user@]host/path
    4.90 +\end{verbatim}
    4.91 +
    4.92 +Where \cmdargs{user} is optional, and the \cmdargs{path} is path to the
    4.93 +repository --- either an absolute or relative to the user's home directory
    4.94 +--- on the remote host with hostname: \cmdargs{host}.
    4.95 +
    4.96 +\begin{note}
    4.97 +If the path for the remote repository is absolute there will be two
    4.98 +consecutive slashes.  E.g., if the remote path is \dirname{/repos/hgbook},
    4.99 +the URL would look something like the following:
   4.100 +
   4.101 +\begin{verbatim}
   4.102 +ssh://someuser@remotebox//repos/hgbook
   4.103 +\end{verbatim}
   4.104 +
   4.105 +Relative paths have only one slash and are relative to the user's home
   4.106 +directory.
   4.107 +\end{note}
   4.108 +
   4.109 +\subsubsection{HTTP \& HTTPS}
   4.110 +\label{sec:concepts:remoterepo:http}
   4.111 +The other protocol supported is HTTP as well as HTTPS.  The repository URL
   4.112 +is very much like that of the \command{ssh}.
   4.113 +
   4.114 +\begin{verbatim}
   4.115 +http://[user@]remotebox/path
   4.116 +\end{verbatim}
   4.117 +
   4.118 +Just as before, the username is optional.
   4.119 +% XXX: is it optional for both push & pull or just for pull?
   4.120 +This time however, the path is relative to the HTTP server root.  
   4.121 +
   4.122 +\section{Working Copy}
   4.123 +\label{sec:concepts:workingcopy}
   4.124 +XXX
   4.125 +
   4.126 +\section{Revisions}
   4.127 +\label{sec:concepts:revs}
   4.128 +XXX
   4.129 +
   4.130 +%%% Local Variables: 
   4.131 +%%% mode: latex
   4.132 +%%% TeX-master: "00book"
   4.133 +%%% End:
   4.134 +
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/en/examples/concepts	Wed Aug 02 19:53:34 2006 -0700
     5.3 @@ -0,0 +1,19 @@
     5.4 +#$ name: dirlist
     5.5 +hg init newrepo
     5.6 +cd newrepo
     5.7 +
     5.8 +find .
     5.9 +
    5.10 +#$ name:
    5.11 +echo "a line of text" > foo
    5.12 +echo "another life of text" > bar
    5.13 +hg commit -A -m "Some files"
    5.14 +
    5.15 +#$ name: dirlist2
    5.16 +find .
    5.17 +
    5.18 +#$ name:
    5.19 +cd ..
    5.20 +
    5.21 +#$ name: hginit
    5.22 +hg init reponame