hgbook

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