
bos@108: \chapter{Behind the scenes}
jeffpc@56: \label{chap:concepts}
jeffpc@56: 
bos@108: Unlike many revision control systems, the concepts upon which
bos@108: Mercurial is built are simple enough that it's easy to understand how
bos@108: the software really works.  Knowing this certainly isn't necessary,
bos@108: but I find it useful to have a ``mental model'' of what's going on.
jeffpc@56: 
bos@108: \section{Tracking the history of a single file}
jeffpc@56: 
bos@108: When Mercurial tracks modifications to a file, it stores the history
bos@108: of that file in a metadata object called a \emph{filelog}.  Each entry
bos@108: in the filelog contains enough information to reconstruct one revision
bos@108: of the file that is being tracked.  Filelogs are stored as files in
bos@108: the \sdirname{.hg/data} directory.  A filelog contains two kinds of
bos@108: information: revision data, and an index to help Mercurial to find a
bos@108: revision efficiently.  
jeffpc@56: 
bos@108: For small files without much history, the revision data and index are
bos@108: combined in a single file (with a ``\texttt{.i}'' suffix).  A file
bos@108: that is large, or has a lot of history, has its filelog stored as
bos@108: separate data (``\texttt{.d}'' suffix) and index (``\texttt{.i}''
bos@108: suffix) files.  The correspondence between a file in the working
bos@108: directory and the filelog that tracks its history in the repository is
bos@108: illustrated in figure~\ref{fig:concepts:filelog}.
jeffpc@56: 
jeffpc@56: \begin{figure}[ht]
bos@108:   \centering
bos@108:   \grafix{filelog}
bos@108:   \caption{Relationships between files in working directory and
bos@108:     filelogs in repository}
bos@108:   \label{fig:concepts:filelog}
jeffpc@56: \end{figure}
jeffpc@56: 
jeffpc@56: %%% Local Variables: 
jeffpc@56: %%% mode: latex
jeffpc@56: %%% TeX-master: "00book"
jeffpc@56: %%% End:




