Mercurial > CVu-Mercurial
annotate Hg.tex @ 12:b8b1e594670d default tip
Small typo correction.
author | Jim Hague <jim.hague@acm.org> |
---|---|
date | Wed, 26 Aug 2009 14:46:50 +0100 |
parents | 03d0ebf7ce0b |
children |
rev | line source |
---|---|
9
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
1 \documentclass[a4paper]{article} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
2 \usepackage{pslatex} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
3 \usepackage{url} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
4 |
10
2e4d690ffabb
Tart up PDF output with clickable links and doc info.
Jim Hague <jim.hague@acm.org>
parents:
9
diff
changeset
|
5 \usepackage[pdftex]{hyperref} |
2e4d690ffabb
Tart up PDF output with clickable links and doc info.
Jim Hague <jim.hague@acm.org>
parents:
9
diff
changeset
|
6 \hypersetup{ |
2e4d690ffabb
Tart up PDF output with clickable links and doc info.
Jim Hague <jim.hague@acm.org>
parents:
9
diff
changeset
|
7 pdfauthor={Jim Hague}, |
2e4d690ffabb
Tart up PDF output with clickable links and doc info.
Jim Hague <jim.hague@acm.org>
parents:
9
diff
changeset
|
8 pdftitle={Inside a distributed version control system}, |
2e4d690ffabb
Tart up PDF output with clickable links and doc info.
Jim Hague <jim.hague@acm.org>
parents:
9
diff
changeset
|
9 colorlinks} |
2e4d690ffabb
Tart up PDF output with clickable links and doc info.
Jim Hague <jim.hague@acm.org>
parents:
9
diff
changeset
|
10 |
9
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
11 \newcommand{\standout}[1]{ |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
12 {\begin{center} \large \textbf{#1} \end{center}} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
13 } |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
14 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
15 \setlength{\parskip}{2mm} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
16 \setlength{\parindent}{0mm} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
17 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
18 \begin{document} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
19 \title{Inside a distributed version control system} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
20 \author{Jim Hague\\ |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
21 \texttt{jim.hague@acm.org}} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
22 \date{May 2009} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
23 \maketitle |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
24 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
25 \section{Preamble} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
26 Grinton Lodge is a Youth Hostel that sits on an exposed hillside just |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
27 above the small hamlet of Grinton in Swaledale, in the Yorkshire Dales |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
28 National Park. A former Victorian shooting lodge, it now welcomes |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
29 walkers and other travellers from around the world. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
30 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
31 Tonight, a Wednesday in mid-November, is not one of its busiest |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
32 nights. Kat, the duty staff member, tells me that there is a small |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
33 corporate team-building group in the annex. There's no sign of them at |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
34 present. Otherwise, that portion of the world that has beaten a path |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
35 to the door of this grand building today consists of just me. And Kat |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
36 goes home soon. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
37 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
38 The November CVu, removed from its wrappers and read yesterday, lies |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
39 in my bag. Taunting me. Go on, it says, if you've ever going to put |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
40 finger to keyboard in the name of CVu, well, tonight you are out of |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
41 excuses. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
42 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
43 Bugger. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
44 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
45 \section{Let's look into Mercurial} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
46 If you're at all interested in version control systems~--- and any |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
47 software developer not using one daily is a strange beast indeed~--- |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
48 you'll at least have become vaguely aware in the last few years of the |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
49 growing maturity of the latest group of version control systems |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
50 offering funky new stuff. These are the distributed version control |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
51 systems (DVCS). There is more to them than just their headline |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
52 attributes, being able to check history and do checkins while |
11
03d0ebf7ce0b
More speeling fixes. Thanks Dirk.
Jim Hague <jim.hague@acm.org>
parents:
10
diff
changeset
|
53 disconnected from a central server, but these are damn useful to start |
9
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
54 with. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
55 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
56 When I first heard about DVCS, it wasn't immediately obvious to me (to |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
57 put it mildly) how they would work. After years of using a centralised |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
58 version control system, I had rough mental model of what went on. But |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
59 how do you cope without the central server forcing ordering onto the |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
60 changes? |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
61 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
62 Since then I've started using Mercurial\footnote{ |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
63 \url{http://www.selenic.com/mercurial}}. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
64 Mercurial is a DVCS. It's one of |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
65 three DVCSs that have gained significant popularity in the last few |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
66 years, the other two being Git\footnote{\url{http://git-scm.com}} and |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
67 Bazaar\footnote{\url{http://bazaar-vcs.org/}}. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
68 I switched a significant work project over |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
69 to Mercurial (from Subversion) in mid-2007, because a customer site |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
70 required on-site work but could not allow access back to the company |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
71 VPN. I chose Mercurial for a variety of reasons which I won't bore you |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
72 with here\footnote{ |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
73 OK, if you must know: |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
74 \begin{itemize} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
75 \item Implementability. I needed the system to work on Windows, Linux and |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
76 AIX. The latter was not one of the directly supported platforms for |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
77 any of the candidates. Git's implementation uses a horde of |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
78 tools. Bazaar requires only Python, but required Python 2.4 while IBM |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
79 stubbornly still supplies only Python 2.3. Mercurial requires Python |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
80 2.3 or greater, and uses some C for speed. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
81 \item Simplicity. My users used Subversion daily, but did not generally |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
82 have much experience with other VCS. From the command line, |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
83 Mercurial's core operations will be familiar to a Subversion |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
84 user. This is also true of Bazaar, but was less true of Git. Git has |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
85 improved in this matter since then, but a Mr Winder of this parish |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
86 tells me that it's still possible to seriously embarrass |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
87 yourself. There was also a lack of Windows support for Git at the |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
88 time. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
89 \item Speed. Mercurial is fast. In the same ballpark as Git. Bazaar |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
90 wasn't, and although it has improved significantly, has, in my |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
91 estimation, added user complexity in the process, and at the time |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
92 of writing is still off the pace for some operations. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
93 \item Documentation. At the time, Bryan O'Sullivan's excellent Mercurial |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
94 book (\url{http://hgbook.red-bean.com}) was a clear winner for best |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
95 documentation. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
96 \end{itemize}}. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
97 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
98 What I want to do in this article is give you an insight into how a |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
99 DVCS works. OK, so specifically I'm going to be talking about |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
100 Mercurial, but Git and Bazaar attack the problem in a similar way. But |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
101 first I'd better give you some idea of how you use Mercurial. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
102 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
103 \subsection{The 5 minute Mercurial overview} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
104 \subsubsection{The basics} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
105 I think it unlikely that someone possessing the taste and discernment |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
106 to be reading CVu would not be familiar with at least one version |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
107 control system. So, while I want to give you a flavour of what it's |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
108 like to use, I'm not going to hang about. If you'd like a proper |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
109 introduction, or you don't follow something, I thoroughly recommend |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
110 you consult the Mercurial book. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
111 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
112 To start using Mercurial to keep track of a project. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
113 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
114 \begin{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
115 $ hg init |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
116 $ |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
117 \end{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
118 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
119 This creates the repository root in the current directory. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
120 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
121 Like CVS\footnote{\url{http://www.nongnu.org/cvs/}} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
122 with its \texttt{CVS} directory and |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
123 Subversion\footnote{\url{http://subversion.tigris.org/}} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
124 with its \texttt{.svn} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
125 directory, Mercurial keeps its private data in a directory. Mercifully there is |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
126 only one of these, in the top level of your project. And rather than |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
127 holding details of where the actual repository is to be found, the \texttt{.hg} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
128 directory holds the entire repository. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
129 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
130 Next you need to specify the files you want Mercurial to track. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
131 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
132 \begin{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
133 $ echo "There was a gibbon one morning" > pome.txt |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
134 $ hg add pome.txt |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
135 $ |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
136 \end{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
137 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
138 As you might expect, this marks the files as to be added. And as you |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
139 might also expect, you need to commit to record the added files in the |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
140 repository. The commit comment can be supplied on the command line; if |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
141 you don't supply a comment, you'll be dropped into an editor to |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
142 provide one. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
143 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
144 There is a suggested format for these messages~--- a one line summary |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
145 followed by any more required detail on following lines. By default |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
146 Mercurial will only display the first line of commit messages when |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
147 listing changes. In these examples I'll stick to terse messages, and |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
148 I'll enter them from the command line. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
149 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
150 \begin{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
151 $ hg commit -m "My Pome" -u "Jim Hague <jim.hague@acm.org>" |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
152 $ |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
153 \end{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
154 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
155 Mercurial records the user making the change as part of the change |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
156 information. It is usual to give your name and email address as I've |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
157 done here. You can imagine, though, that constantly having to repeat |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
158 this is a bit tedious, so you can set a default user name in a |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
159 configuration file. Mercurial keeps global, user and repository |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
160 configurations, and it can go in any of those. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
161 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
162 As with Subversion, after further edits you see how your working copy |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
163 differs from the repository. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
164 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
165 \begin{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
166 $ hg status |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
167 M pome.txt |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
168 $ hg diff |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
169 diff -r 33596ef855c1 pome.txt |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
170 --- a/pome.txt Wed Apr 23 22:36:33 2008 +0100 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
171 +++ b/pome.txt Wed Apr 23 22:48:01 2008 +0100 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
172 @@ -1,1 +1,2 @@ There was a gibbon one morning |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
173 There was a gibbon one morning |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
174 +said "I think I will fly to the moon". |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
175 $ hg commit -m "A great second line" |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
176 $ |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
177 \end{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
178 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
179 And look through a log of changes. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
180 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
181 \begin{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
182 $ hg log |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
183 changeset: 1:3d65e7a57890 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
184 tag: tip |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
185 user: Jim Hague <jim.hague@acm.org> |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
186 date: Wed Apr 23 22:49:10 2008 +0100 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
187 summary: A great second line |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
188 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
189 changeset: 0:33596ef855c1 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
190 user: Jim Hague <jim.hague@acm.org> |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
191 date: Wed Apr 23 22:36:33 2008 +0100 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
192 summary: My Pome |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
193 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
194 $ |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
195 \end{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
196 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
197 There are some items here that need an explanation. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
198 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
199 The changeset identifier is in fact two identifiers separated by a |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
200 colon. The first is the sequence number of the changeset in the |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
201 repository, and is directly comparable to the change number in a |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
202 Subversion repository. The second is a globally unique identifier for |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
203 that change. As the change is copied from one repository to another |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
204 (this is a distributed system, remember, even if we haven't come to |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
205 that bit yet), its sequence number in any particular repository will |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
206 change, but the global identifier will always remain the same. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
207 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
208 \texttt{tip} is a Mercurial term. It means simply the most recent change. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
209 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
210 Want to rename a file? |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
211 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
212 \begin{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
213 $ hg mv pome.txt poem.txt |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
214 $ hg status |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
215 A poem.txt |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
216 R pome.txt |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
217 $ hg commit -m "Rename my file" |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
218 $ |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
219 \end{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
220 (The command to rename a file is actually \texttt{hg rename}, |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
221 but Mercurial saves Unix-trained fingers from |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
222 typing embarrassment.) |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
223 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
224 At this point you may be wondering about directories. \texttt{hg mkdir} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
225 perhaps? Well, no. Mercurial only tracks files. To be sure, the |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
226 directory a file occupies is tracked, but effectively only as a |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
227 component of the file name. This has the slightly unexpected result |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
228 that you can't record an empty directory in your repository.\footnote{ |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
229 I tripped over this converting a work Subversion |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
230 repository. One possibility is to create a placeholder file in the |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
231 directory. In the event I created the directory (which receives build |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
232 products) as part of the build instead.} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
233 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
234 Given this, and the status output above that suggests strongly that |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
235 Mercurial treats a rename as a copy followed by a delete, you may be |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
236 worried that Mercurial won't cope at all well with rearranging your |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
237 repository. Relax. Mercurial does store the details of the rename as |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
238 part of the changeset, and copes very well with rearrangements\footnote{ |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
239 The Mercurial designers justify not dealing with |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
240 directories as first class objects by pointing out that provided you |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
241 can correctly move files about in the tree, the other reasons for |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
242 tracking directories are uncommon and do not in their opinion justify |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
243 the considerable added complexity. So far I've found no reason to |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
244 doubt that judgement.}. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
245 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
246 Want to rewind the working copy to a previous revision? |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
247 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
248 \begin{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
249 $ hg update -r 1 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
250 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
251 $ |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
252 \end{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
253 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
254 \texttt{hg update} updates the working files. In this case I'm specifying |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
255 that I want to go back to local changeset 1. I could also have typed |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
256 \texttt{-r 3d65e7a57890}, or even \texttt{-r 3d}; |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
257 when specifying the global change |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
258 identifier you only need to type enough digits to make it unique. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
259 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
260 This is all very well, but it's not exactly distributed, is it? |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
261 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
262 \subsubsection{Going distributed} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
263 A version control system goes Distributed by allowing multiple copies |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
264 of the repository to exist, and work to be done in all those |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
265 repositories in parallel. So when you start work on an existing |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
266 project, the first thing to do is to get your own copy of the |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
267 repository. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
268 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
269 \begin{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
270 elsewhere$ hg clone ssh://jim.home.net/Poem Jim-Poem |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
271 updating working directory |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
272 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
273 \end{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
274 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
275 Mercurial lets you access other repositories via the file system, over http or |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
276 over ssh. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
277 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
278 \begin{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
279 elsewhere$ cd Jim-Poem |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
280 elsewhere$ hg log |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
281 changeset: 3:a065eb26e6b9 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
282 tag: tip |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
283 user: Jim Hague <jim.hague@acm.org> |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
284 date: Thu Apr 24 18:52:31 2008 +0100 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
285 summary: Rename my file |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
286 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
287 changeset: 2:ff97668b7422 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
288 user: Jim Hague <jim.hague@acm.org> |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
289 date: Thu Apr 24 18:50:22 2008 +0100 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
290 summary: Finished first verse |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
291 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
292 changeset: 1:3d65e7a57890 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
293 user: Jim Hague <jim.hague@acm.org> |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
294 date: Wed Apr 23 22:49:10 2008 +0100 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
295 summary: A great second line |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
296 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
297 changeset: 0:33596ef855c1 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
298 user: Jim Hague <jim.hague@acm.org> |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
299 date: Wed Apr 23 22:36:33 2008 +0100 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
300 summary: My Pome |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
301 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
302 $ |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
303 \end{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
304 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
305 \texttt{hg clone} is aptly named. It creates a new repository that contains |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
306 exactly the same changes as the source repository. You can make a |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
307 clone just by copying your project directory, if you're confident |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
308 nothing else will access it during the copy. \texttt{hg clone} saves you this |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
309 worry, and sets the default push/pull location in the new repo to the |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
310 cloned repo. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
311 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
312 From that point, you use \texttt{hg pull} to collect changes from other |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
313 places into your repo (though note it does not by default update your |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
314 working copy), and, as you might guess, \texttt{hg push} shoves your changes |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
315 into a foreign repository. By default these will act on the repository |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
316 you cloned from, but you can specify any other repository. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
317 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
318 More on those in a moment. First, though, I want to show you something |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
319 you can't do in Subversion. Start with the repository with 4 changes |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
320 we just cloned. I want to focus on the first couple of lines, so I'll |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
321 wind the working copy back to the point where only those lines exist. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
322 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
323 \begin{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
324 $ hg update -r 1 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
325 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
326 $ |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
327 \end{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
328 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
329 And make a change. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
330 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
331 \begin{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
332 $ hg diff |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
333 diff -r 3d65e7a57890 pome.txt |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
334 --- a/pome.txt Wed Apr 23 22:49:10 2008 +0100 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
335 +++ b/pome.txt Thu Apr 24 19:13:14 2008 +0100 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
336 @@ -1,2 +1,2 @@ There was a gibbon one morning |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
337 -There was a gibbon one morning |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
338 -said "I think I will fly to the moon". |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
339 +There was a baboon who one afternoon |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
340 +said "I think I will fly to the sun". |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
341 $ hg commit -m "Better first two lines" |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
342 $ |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
343 \end{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
344 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
345 The alert among you will have sat up at that. Well done! Yes, there's |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
346 something very worrying. How can I commit a change at an old point? |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
347 If you try this in Subversion, it will complain mightily about your |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
348 file being out of date. But Mercurial just went ahead and did |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
349 something. The Bazaar experts among you will know that in Bazaar, if |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
350 you use \texttt{bzr revert -r} to bring the working copy to a past revision, |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
351 make a change and commit, then your latest version will be the past |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
352 revision plus your change. Perhaps that's what Mercurial did? |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
353 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
354 No. What Mercurial did is central to Mercurial's view of the |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
355 world. You took your working copy back to an old changeset, and then |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
356 committed a fresh change based at that changeset. Mercurial actually |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
357 did just what you asked it to do, no more and no less. Let's see the |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
358 initial evidence. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
359 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
360 \begin{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
361 $ hg heads |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
362 changeset: 4:267d32f158b3 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
363 tag: tip |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
364 parent: 1:3d65e7a57890 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
365 user: Jim Hague <jim.hague@acm.org> |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
366 date: Thu Apr 24 19:13:59 2008 +0100 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
367 summary: Better first two lines |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
368 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
369 changeset: 3:a065eb26e6b9 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
370 user: Jim Hague <jim.hague@acm.org> |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
371 date: Thu Apr 24 18:52:31 2008 +0100 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
372 summary: Rename my file |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
373 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
374 $ |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
375 \end{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
376 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
377 Time for some more Mercurial terminology. You can think of a \texttt{head} in |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
378 Mercurial as the most recent change on a branch. In Mercurial, a |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
379 branch is simply what happens when you commit a change that has as its |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
380 parent a change that already has a child. Mercurial has a standard |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
381 extension \texttt{hg glog} which uses some ASCII art to show the current |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
382 state: |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
383 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
384 \begin{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
385 $ hg glog |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
386 @ changeset: 4:267d32f158b3 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
387 | tag: tip |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
388 | parent: 1:3d65e7a57890 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
389 | user: Jim Hague <jim.hague@acm.org> |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
390 | date: Thu Apr 24 19:13:59 2008 +0100 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
391 | summary: Better first two lines |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
392 | |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
393 | o changeset: 3:a065eb26e6b9 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
394 | | user: Jim Hague <jim.hague@acm.org> |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
395 | | date: Thu Apr 24 18:52:31 2008 +0100 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
396 | | summary: Rename my file |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
397 | | |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
398 | o changeset: 2:ff97668b7422 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
399 |/ user: Jim Hague <jim.hague@acm.org> |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
400 | date: Thu Apr 24 18:50:22 2008 +0100 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
401 | summary: Finished first verse |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
402 | |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
403 o changeset: 1:3d65e7a57890 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
404 | user: Jim Hague <jim.hague@acm.org> |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
405 | date: Wed Apr 23 22:49:10 2008 +0100 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
406 | summary: A great second line |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
407 | |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
408 o changeset: 0:33596ef855c1 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
409 user: Jim Hague <jim.hague@acm.org> |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
410 date: Wed Apr 23 22:36:33 2008 +0100 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
411 summary: My Pome |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
412 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
413 $ |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
414 \end{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
415 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
416 \texttt{hg view} shows a nicer graphical view\footnote{Though, being |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
417 Tcl/Tk based, not that much nicer.}. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
418 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
419 So the change is in there. It's the latest change, and is simply on a |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
420 different branch to the other changes. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
421 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
422 Almost invariably, you will want to bring everything back together and |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
423 merge the branches. A merge is a change that combines two heads back |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
424 into one. It prepares an updated working directory with the merged |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
425 contents of the two heads for you to review and, if satisfactory, |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
426 commit. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
427 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
428 \begin{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
429 $ hg merge |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
430 merging pome.txt and poem.txt |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
431 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
432 (branch merge, don't forget to commit) |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
433 $ cat poem.txt |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
434 There was a baboon who one afternoon |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
435 said "I think I will fly to the sun". |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
436 So with two great palms strapped to his arms, |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
437 he started his takeoff run. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
438 $ hg commit -m "Merge first line branch" |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
439 $ |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
440 \end{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
441 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
442 (I'm no poet. The poem is, of |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
443 course, \textit{Silly Old Baboon} by the late, great, Spike |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
444 Milligan. From \textit{A Book of Milliganimals}, Puffin, 1971.) |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
445 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
446 Here's the ASCII art again showing what just happened. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
447 Oh, and notice in the above that Mercurial has done the |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
448 right thing with regard to the rename. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
449 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
450 \begin{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
451 $ hg glog |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
452 @ changeset: 5:792ab970fc80 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
453 |\ tag: tip |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
454 | | parent: 4:267d32f158b3 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
455 | | parent: 3:a065eb26e6b9 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
456 | | user: Jim Hague <jim.hague@acm.org> |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
457 | | date: Thu Apr 24 19:29:53 2008 +0100 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
458 | | summary: Merge first line branch |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
459 | | |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
460 | o changeset: 4:267d32f158b3 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
461 | | parent: 1:3d65e7a57890 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
462 | | user: Jim Hague <jim.hague@acm.org> |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
463 | | date: Thu Apr 24 19:13:59 2008 +0100 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
464 | | summary: Better first two lines |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
465 | | |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
466 o | changeset: 3:a065eb26e6b9 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
467 | | user: Jim Hague <jim.hague@acm.org> |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
468 | | date: Thu Apr 24 18:52:31 2008 +0100 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
469 | | summary: Rename my file |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
470 | | |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
471 o | changeset: 2:ff97668b7422 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
472 |/ user: Jim Hague <jim.hague@acm.org> |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
473 | date: Thu Apr 24 18:50:22 2008 +0100 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
474 | summary: Finished first verse |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
475 | |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
476 o changeset: 1:3d65e7a57890 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
477 | user: Jim Hague <jim.hague@acm.org> |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
478 | date: Wed Apr 23 22:49:10 2008 +0100 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
479 | summary: A great second line |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
480 | |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
481 o changeset: 0:33596ef855c1 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
482 user: Jim Hague <jim.hague@acm.org> |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
483 date: Wed Apr 23 22:36:33 2008 +0100 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
484 summary: My Pome |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
485 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
486 $ |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
487 \end{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
488 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
489 So, our little branch change has now been merged back, and we have a |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
490 single line of development again. Notice that unlike the other |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
491 changesets, changeset 5 has two parent changesets, indicating it is a |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
492 merge changeset. You can only merge two branches in one operation; or |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
493 putting it another way, a changeset can have a maximum of two parents. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
494 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
495 This behaviour is absolutely central to Mercurial's philosophy. If a |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
496 change is committed that takes as its starting point a change that |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
497 already has a child, then a branch gets created. Working with |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
498 Mercurial, branches get created frequently, and equally frequently |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
499 merged back. As befits any frequent operation, both are easy to do. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
500 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
501 You're probably thinking at this point that this making a commit onto |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
502 an old version is a slightly strange thing to do, and you'd be right. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
503 But that's exactly what's going to happen the moment you go |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
504 distributed. Two people working independently with their own |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
505 repositories are going to make commits based, typically, on the latest |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
506 changes they happen to have incorporated into their tree. To be |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
507 Distributed, a DVCS has to deal with this. Mercurial faces it head-on. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
508 When you pull changes into your repo (or someone else pushes them), if |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
509 any of the changes overlap~--- are both based on the same base change~--- |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
510 you get extra heads, and it's up to you to let these extra heads live |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
511 or merge, as you please. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
512 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
513 In practice this is more manageable then you might think. Consider a |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
514 typical Mercurial usage, where the 'master' repo sits on a known |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
515 server, and everyone pulls changes from the master and pushes their |
11
03d0ebf7ce0b
More speeling fixes. Thanks Dirk.
Jim Hague <jim.hague@acm.org>
parents:
10
diff
changeset
|
516 own efforts to the master. By default Mercurial won't let you push if |
9
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
517 the receiving repo will gain an extra head as a result, so you |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
518 typically pull (and do any required merging) just before |
11
03d0ebf7ce0b
More speeling fixes. Thanks Dirk.
Jim Hague <jim.hague@acm.org>
parents:
10
diff
changeset
|
519 pushing. Subversion users will recognise this pattern. Subversion |
9
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
520 won't let you commit a change if your working copy is not at the very |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
521 latest revision, so the Subversion user will update, and merge if |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
522 necessary, just before committing. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
523 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
524 What, then, about a branch in the conventional sense of '1.0 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
525 maintenance branch'? Typically in Mercurial you'd handle this by |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
526 keeping a separate cloned repository for those changes. Cloning is |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
527 fast, and if local uses hard links where possible on filesystems that |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
528 support them, so isn't necessarily extravagant on disc space. You can, |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
529 if you prefer, handle them all in a single repo with 'named |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
530 branches', but cloning is definitely simpler. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
531 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
532 OK, so now you know the basics of using Mercurial. We can proceed to |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
533 looking at how this magic is achieved. In particular, where does this |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
534 magic globally unique identifier for a change come from? |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
535 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
536 \subsection{Inside the Mercurial repo} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
537 The way Mercurial handles its repo is really quite simple. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
538 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
539 That's simple, as in 'most things are simple once you know the |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
540 answer'. I found the explanation helpful\footnote{For the curious, |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
541 Bryan O'Sullivan's excellent Mercurial book |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
542 has a chapter on the subject, and the Mercurial website has a fair amount |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
543 of detail too.}, so this section attempts |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
544 the 10,000ft (FL100 if you prefer) view of Mercurial. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
545 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
546 First remember that any file or component can only have one or two |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
547 parents. You can't merge more than one other branch at once. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
548 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
549 We start with the basic building block, which Mercurial calls a |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
550 revlog. A revlog is a thing that holds a file and all the changes in |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
551 the file history\footnote{For any non-trivial file, this will |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
552 actually be two files on the disc, a data file and an index.}. The |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
553 revlog stores the differences between successive versions |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
554 of the file, though it will periodically store a complete version of |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
555 the file instead of a difference, so that the content of any |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
556 particular file version can always be reconstructed without excessive |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
557 effort. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
558 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
559 Under the secret-squirrel Mercurial \texttt{.hg} directory at the top of your |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
560 project is a store which holds a revlog for each file in your |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
561 project. So you have the complete history of the project locally. No |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
562 more round trips to the server. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
563 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
564 Both the differences between successive versions and the periodic |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
565 complete versions of a file are compressed before storing. This is |
12 | 566 surprisingly effective at minimising the storage requirements of the |
9
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
567 entire history of your project. I have a small Java project handy, |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
568 comprising a little over 300 source modules. There are 5 branches plus |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
569 the mainline, and some 1920 commits in all. A Subversion checkout of |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
570 the current mainline takes 51Mb. Converting the project to Mercurial |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
571 yields a Mercurial repository that takes 60Mb, so a little |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
572 bigger. Remember, though, that the Mercurial repository includes not |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
573 just the working copy, but also the entire history of the project. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
574 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
575 Any point in the evolution of a revlog can be uniquely identified with |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
576 a nodeid. This is simply the SHA1 hash of the current file contents |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
577 concatenated with the nodeids of one or both parents of the current |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
578 revision. Note that this way, two file states are identical if and |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
579 only if the file contents are the same *and* the file has the |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
580 same history. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
581 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
582 Here's a dump of a revlog index: |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
583 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
584 \begin{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
585 $ hg debugindex .hg/store/data/pome.txt.i |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
586 rev offset length base linkrev nodeid p1 p2 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
587 0 0 32 0 0 6bbbd5d6cc53 000000000000 000000000000 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
588 1 32 51 0 1 83d266583303 6bbbd5d6cc53 000000000000 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
589 2 83 84 0 2 14a54ec34bb6 83d266583303 000000000000 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
590 3 167 76 3 4 dc4df776b38b 83d266583303 000000000000 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
591 $ |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
592 \end{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
593 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
594 Note here that a file state can have two parents. If both the parent |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
595 nodeids are non-null, the file state has two parents, and the state is |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
596 therefore the result of a merge. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
597 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
598 Let's dump out a revlog at a particular revision: |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
599 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
600 \begin{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
601 $ hg debugdata .hg/store/data/pome.txt.i 2 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
602 There was a gibbon one morning |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
603 said "I think I will fly to the moon". |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
604 So with two great palms strapped to his arms, |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
605 he started his takeoff run. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
606 $ |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
607 \end{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
608 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
609 The next component is the manifest. This is simply a list of all the |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
610 files in the project, together with their current nodeids. The |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
611 manifest is a file, held in a revlog. The nodeid of the manifest, |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
612 therefore, identifies the project filesystem at a particular point. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
613 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
614 \begin{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
615 $ hg debugdata .hg/store/00manifest.i 5 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
616 poem.txt5168b1a5e2f44aa4e0f164e170820845183f50c8 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
617 $ |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
618 \end{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
619 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
620 Finally we have the changeset. This is the atomic collection of |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
621 changes to a repository that leads to a new revision. The changeset |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
622 info includes the nodeid of the corresponding manifest, the timestamp |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
623 and committer ID, a list of changed files and a comment. The changeset |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
624 also includes the nodeid of the parent changeset, or the two parents |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
625 if the change is a merge. The changeset description is held in a |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
626 revlog, the changelog. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
627 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
628 \begin{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
629 $ hg debugdata .hg/store/00changelog.i 5 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
630 1ccc11b6f7308cc8fa1573c2f3811a4710c91e3e |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
631 Jim Hague <jim.hague@acm.org> |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
632 1209061793 -3600 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
633 poem.txt |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
634 pome.txt |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
635 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
636 Merge first line branch |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
637 $ |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
638 \end{verbatim} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
639 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
640 The nodeid of the changeset, therefore, gives us a globally unique |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
641 identifier for any particular change. Changesets have a |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
642 Subversion-like incrementing change number, but it is peculiar to that |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
643 repository. The nodeid, however, is global. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
644 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
645 One more detail remains to complete the picture. How do we get back |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
646 from a particular file change to find the responsible changeset? Each |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
647 revlog change has a linkrev entry that does just this. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
648 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
649 So, now we have a repository with a history of the changes applied to |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
650 that repository. Each change has a unique identifier. If we find that |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
651 change in another repository, it means that at the point in the other |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
652 repository we have exactly the same state; the file contents and |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
653 history are identical. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
654 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
655 At this point we can see how pulling changes from another repository |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
656 works. Mercurial has to determine which changesets in the source |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
657 repository are missing in the target repository. To do this, for each |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
658 head in the source repo it has to find the most recent change in that |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
659 head that it already present in the target repo, and get any remaining |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
660 changes after that point. These changes are then copied over and |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
661 applied. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
662 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
663 The Mercurial revlog format has proved remarkably durable. Since the |
11
03d0ebf7ce0b
More speeling fixes. Thanks Dirk.
Jim Hague <jim.hague@acm.org>
parents:
10
diff
changeset
|
664 first release of Mercurial in April 2005, there have been a total of 5 |
9
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
665 changes to the file format. However, of those, all but one have been |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
666 changes to the handling of file names. The most recent change, in |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
667 October 2008, and its predecessor in December 2006, were both |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
668 introduced purely to cope with Windows specific issues. The one change |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
669 that touched the data structures described above was in April 2006. The |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
670 format introduced, RevLogNG, changed only the details of index data |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
671 held, not the overall design. The chief Mercurial developer, Matt |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
672 Mackall, notes that the code in present-day Mercurial devoted to |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
673 reading the old format comprises 28 lines of Python. Compared with, |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
674 say, the early tribulations of Subversion and the switch from \texttt{bdfs} to |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
675 \texttt{fsfs}, this is an impressive record. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
676 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
677 \section{Reflections on going distributed} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
678 It's nearly traditional at this stage in an introduction to DVCS to |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
679 demonstrate several different workflow scenarios that you can build |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
680 with a DVCS. Which makes the important point that a DVCS can be |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
681 adapted to your workflow in a way that is at best unwieldy with a |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
682 CVCS. I intend, though, to break with tradition here. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
683 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
684 By this stage, I hope you can see that distributing version control |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
685 works by introducing branches where development takes place in |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
686 parallel. Mercurial treats these branches as arising naturally from |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
687 the commits made and transferred between repositories. Both Git and |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
688 Bazaar take a slightly different viewpoint, and explicitly generate a |
11
03d0ebf7ce0b
More speeling fixes. Thanks Dirk.
Jim Hague <jim.hague@acm.org>
parents:
10
diff
changeset
|
689 fresh branch for work in a particular repository. But in both cases |
9
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
690 the underlying principle of identifying changes by a globally unique |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
691 identifier and resolving parallel development by merges between |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
692 overlapping changes is the same. And all three can be used in a truly |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
693 distributed manner, with full history and the ability to commit being |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
694 available locally. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
695 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
696 So instead of chatter on about workflows, I want instead to reflect on |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
697 the consequences all this has for that all-important question of |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
698 whether a DVCS is a suitable vehicle for your data. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
699 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
700 The first is a minor and rather obvious point. If you want to store |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
701 files that are very large and which change often in your DVCS, then |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
702 all the compression in the world is unlikely to stop the storage |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
703 requirements for the full project history from becoming uncomfortably |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
704 large, particularly if the files are not very compressible to start |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
705 with. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
706 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
707 The second, and main, point is that there is an important question you |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
708 need to ask about your data. We've seen that a DVCS relies on |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
709 branching and merging to weave its magic. So take a close look at your |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
710 data, and ask: |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
711 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
712 \standout{Will It Merge?} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
713 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
714 The subset of plain old text which comprises program source |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
715 code requires some human oversight, but will merge automatically |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
716 well enough for the process to be well within the bounds of the |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
717 possible. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
718 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
719 Unfortunately when we move further afield mergeability becomes a rarer |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
720 commodity. I nearly began the previous paragraph by stating that |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
721 plain old text will merge well enough. Then Doubt set in~--- what about |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
722 XML? Or BASE64 encoded content? |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
723 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
724 Of course, merge doesn't necessarily have to be textual merge. I am |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
725 told that Word can be used to diff and merge two Word \texttt{.doc} files, a |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
726 data format notorious for its binary impenetrability. As long as some |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
727 suitable merge agent is available, and the DVCS can be configured to |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
728 use it for data of a particular type\footnote{Mercurial can have the |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
729 merge and diff tools specified with reference to the file extension on |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
730 which they operate~--- I assume Bazaar and Git are similar.}, then there |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
731 is no bar to successful DVCS use. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
732 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
733 Before this reliance on mergeability causes you to dismiss DVCS out of |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
734 hand, reflect. A CVCS can only handle non-mergeable data by acting as |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
735 a versioned file store; in other words, having as the only available |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
736 merge option the use of one or other of the merge candidates in its |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
737 entirety. Useful though a versioned file store can be, it cannot be |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
738 considered a full-featured version control system. By treating the |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
739 offending unmergeable files as external to the DVCS, or with careful |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
740 workflow~--- disabling the distributed and mergeable potentials~--- a DVCS |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
741 can deal with these files, but only at a cost of its distributedness |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
742 or its version control system-ness. In this it differs little from a |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
743 CVCS. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
744 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
745 So, for all data you want to version control, let your battle cry be: |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
746 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
747 \standout{Will It Merge?} |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
748 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
749 At this point, I have an urge to don lab coat and safety goggles and |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
750 be videoed attempting to mechanically merge data in a variety of |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
751 different formats. Frankly, this is unlikely to be as exciting at |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
752 blending iPhones\footnote{\url{http://www.willitblend.com}}, |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
753 but from a system development point of view it's rather more |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
754 important. And, I think gives us a large clue as to one of the |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
755 reasons for the continuing |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
756 popularity of Plain Old Text as a source code representation mechanism. |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
757 |
2155510c62f3
A version formatted with Latex. And spellchecked.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
758 \end{document} |