hgbook

annotate en/concepts.tex @ 108:e0b961975c5e

First bit of concepts chapter.
author Bryan O'Sullivan <bos@serpentine.com>
date Thu Nov 09 10:11:31 2006 -0800 (2006-11-09)
parents b8539d91c84d
children 1b67dc96f27a
rev   line source
bos@108 1 \chapter{Behind the scenes}
jeffpc@56 2 \label{chap:concepts}
jeffpc@56 3
bos@108 4 Unlike many revision control systems, the concepts upon which
bos@108 5 Mercurial is built are simple enough that it's easy to understand how
bos@108 6 the software really works. Knowing this certainly isn't necessary,
bos@108 7 but I find it useful to have a ``mental model'' of what's going on.
jeffpc@56 8
bos@108 9 \section{Tracking the history of a single file}
jeffpc@56 10
bos@108 11 When Mercurial tracks modifications to a file, it stores the history
bos@108 12 of that file in a metadata object called a \emph{filelog}. Each entry
bos@108 13 in the filelog contains enough information to reconstruct one revision
bos@108 14 of the file that is being tracked. Filelogs are stored as files in
bos@108 15 the \sdirname{.hg/data} directory. A filelog contains two kinds of
bos@108 16 information: revision data, and an index to help Mercurial to find a
bos@108 17 revision efficiently.
jeffpc@56 18
bos@108 19 For small files without much history, the revision data and index are
bos@108 20 combined in a single file (with a ``\texttt{.i}'' suffix). A file
bos@108 21 that is large, or has a lot of history, has its filelog stored as
bos@108 22 separate data (``\texttt{.d}'' suffix) and index (``\texttt{.i}''
bos@108 23 suffix) files. The correspondence between a file in the working
bos@108 24 directory and the filelog that tracks its history in the repository is
bos@108 25 illustrated in figure~\ref{fig:concepts:filelog}.
jeffpc@56 26
jeffpc@56 27 \begin{figure}[ht]
bos@108 28 \centering
bos@108 29 \grafix{filelog}
bos@108 30 \caption{Relationships between files in working directory and
bos@108 31 filelogs in repository}
bos@108 32 \label{fig:concepts:filelog}
jeffpc@56 33 \end{figure}
jeffpc@56 34
jeffpc@56 35 %%% Local Variables:
jeffpc@56 36 %%% mode: latex
jeffpc@56 37 %%% TeX-master: "00book"
jeffpc@56 38 %%% End: