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