author | Andreas Lochbihler |
Wed, 30 May 2012 09:13:39 +0200 | |
changeset 48035 | 2f9584581cf2 |
parent 47449 | 5e1482296b12 |
child 48497 | ba61aceaa18a |
permissions | -rw-r--r-- |
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
1 |
Important notes on Mercurial repository access for Isabelle |
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
2 |
=========================================================== |
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
3 |
|
40601 | 4 |
Introduction |
5 |
------------ |
|
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
6 |
|
40601 | 7 |
Mercurial http://www.selenic.com/mercurial belongs to the current |
8 |
generation of source code management systems that follow the so-called |
|
9 |
paradigm of "distributed version control". This is a terrific name |
|
10 |
for plain revision control without the legacy of CVS or SVN. See also |
|
11 |
http://hginit.com/ for an introduction to the main ideas. The |
|
12 |
Mercurial book http://hgbook.red-bean.com/ explains many more details. |
|
13 |
||
14 |
Mercurial offers great flexibility in organizing the flow of changes, |
|
15 |
both between individual developers and designated pull/push areas that |
|
16 |
are shared with others. This additional power demands some additional |
|
17 |
responsibility to maintain a certain development process that fits to |
|
18 |
a particular project. |
|
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
19 |
|
40601 | 20 |
Regular Mercurial operations are strictly monotonic, where changeset |
21 |
transactions are only added, but never deleted. There are special |
|
22 |
tools to manipulate repositories via non-monotonic actions (such as |
|
23 |
"rollback" or "strip"), but recovering from gross mistakes that have |
|
24 |
escaped into the public can be hard and embarrassing. It is much |
|
25 |
easier to inspect and amend changesets routinely before pushing. |
|
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
26 |
|
40601 | 27 |
The effect of the critical "pull" / "push" operations can be tested in |
28 |
a dry run via "incoming" / "outgoing". The "fetch" extension includes |
|
29 |
useful sanity checks beyond raw "pull" / "update" / "merge". Most |
|
30 |
other operations are local to the user's repository clone. This gives |
|
31 |
some freedom for experimentation without affecting anybody else. |
|
32 |
||
33 |
Mercurial provides nice web presentation of incoming changes with a |
|
34 |
digest of log entries; this also includes RSS/Atom news feeds. There |
|
47449 | 35 |
are add-on history browsers such as "hg view" and TortoiseHg. Unlike |
36 |
the default web view, some of these tools help to inspect the semantic |
|
37 |
content of non-trivial merge nodes. |
|
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
38 |
|
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
39 |
|
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
40 |
Initial configuration |
29481 | 41 |
--------------------- |
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
42 |
|
28913 | 43 |
The official Isabelle repository can be cloned like this: |
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
44 |
|
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
45 |
hg clone http://isabelle.in.tum.de/repos/isabelle |
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
46 |
|
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
47 |
This will create a local directory "isabelle", unless an alternative |
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
48 |
name is specified. The full repository meta-data and history of |
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
49 |
changes is in isabelle/.hg; local configuration for this clone can be |
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
50 |
added to isabelle/.hg/hgrc, but note that hgrc files are never copied |
40601 | 51 |
by another clone operation. |
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
52 |
|
28917 | 53 |
|
28913 | 54 |
There is also $HOME/.hgrc for per-user Mercurial configuration. The |
40601 | 55 |
initial configuration requires at least an entry to identify yourself |
56 |
as follows: |
|
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
57 |
|
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
58 |
[ui] |
40601 | 59 |
username = XXX |
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
60 |
|
40601 | 61 |
Isabelle contributors are free to choose either a short "login name" |
62 |
(for accounts at TU Munich) or a "full name" -- with or without mail |
|
63 |
address. It is important to stick to this choice once and for all. |
|
64 |
The machine default that Mercurial produces for unspecified |
|
65 |
[ui]username is not appropriate. |
|
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
66 |
|
40601 | 67 |
Such configuration can be given in $HOME/.hgrc (for each home |
68 |
directory on each machine) or in .hg/hgrc (for each repository clone). |
|
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
69 |
|
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
70 |
|
40601 | 71 |
Here are some further examples for hgrc. This is how to provide |
72 |
default options for common commands: |
|
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
73 |
|
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
74 |
[defaults] |
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
75 |
log = -l 10 |
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
76 |
|
40601 | 77 |
This is how to configure some extension, which is called "graphlog" |
78 |
and provides the "glog" command: |
|
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
79 |
|
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
80 |
[extensions] |
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
81 |
hgext.graphlog = |
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
82 |
|
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
83 |
|
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
84 |
Shared pull/push access |
29481 | 85 |
----------------------- |
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
86 |
|
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
87 |
The entry point http://isabelle.in.tum.de/repos/isabelle is world |
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
88 |
readable, both via plain web browsing and the hg client as described |
40601 | 89 |
above. Anybody can produce a clone, change it locally, and then use |
90 |
regular mechanisms of Mercurial to report changes upstream, say via |
|
91 |
mail to someone with write access to that file space. It is also |
|
92 |
quite easy to publish changed clones again on the web, using the |
|
93 |
ad-hoc command "hg serve -v", or the hgweb.cgi or hgwebdir.cgi scripts |
|
94 |
that are included in the Mercurial distribution, and send a "pull |
|
95 |
request" to someone else. There are also public hosting services for |
|
96 |
Mercurial repositories. |
|
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
97 |
|
28913 | 98 |
The downstream/upstream mode of operation is quite common in the |
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
99 |
distributed version control community, and works well for occasional |
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
100 |
changes produced by anybody out there. Of course, upstream |
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
101 |
maintainers need to review and moderate changes being proposed, before |
40601 | 102 |
pushing anything onto the official Isabelle repository at TUM. Direct |
103 |
pushes are also reviewed routinely in a post-hoc fashion; everybody |
|
104 |
hooked on the main repository is called to keep an eye on incoming |
|
105 |
changes. In any case, changesets need to be understandable, at the |
|
106 |
time of writing and many years later. |
|
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
107 |
|
40601 | 108 |
Push access to the Isabelle repository requires an account at TUM, |
47449 | 109 |
with properly configured ssh to the local machines (e.g. macbroy20 .. |
110 |
macbroy29). You also need to be a member of the "isabelle" Unix |
|
40601 | 111 |
group. |
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
112 |
|
28913 | 113 |
Sharing a locally modified clone then works as follows, using your |
114 |
user name instead of "wenzelm": |
|
115 |
||
47449 | 116 |
hg out ssh://wenzelm@macbroy20//home/isabelle-repository/repos/isabelle |
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
117 |
|
28913 | 118 |
In fact, the "out" or "outgoing" command performs only a dry run: it |
119 |
displays the changesets that would get published. An actual "push", |
|
120 |
with a lasting effect on the Isabelle repository, works like this: |
|
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
121 |
|
47449 | 122 |
hg push ssh://wenzelm@macbroy20//home/isabelle-repository/repos/isabelle |
28913 | 123 |
|
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
124 |
|
40601 | 125 |
Default paths for push and pull can be configured in |
126 |
isabelle/.hg/hgrc, for example: |
|
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
127 |
|
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
128 |
[paths] |
47449 | 129 |
default = ssh://wenzelm@macbroy20//home/isabelle-repository/repos/isabelle |
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
130 |
|
28913 | 131 |
Now "hg pull" or "hg push" will use that shared file space, unless a |
132 |
different URL is specified explicitly. |
|
133 |
||
134 |
When cloning a repository, the default path is set to the initial |
|
135 |
source URL. So we could have cloned via that ssh URL in the first |
|
136 |
place, to get exactly to the same point: |
|
137 |
||
47449 | 138 |
hg clone ssh://wenzelm@macbroy20//home/isabelle-repository/repos/isabelle |
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
139 |
|
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
140 |
|
40601 | 141 |
Simple merges |
142 |
------------- |
|
30182 | 143 |
|
144 |
The main idea of Mercurial is to let individual users produce |
|
145 |
independent branches of development first, but merge with others |
|
146 |
frequently. The basic hg merge operation is more general than |
|
147 |
required for the mode of operation with a shared pull/push area. The |
|
40601 | 148 |
"fetch" extension accommodates this case nicely, automating trivial |
30182 | 149 |
merges and requiring manual intervention for actual conflicts only. |
150 |
||
40601 | 151 |
The fetch extension can be configured via $HOME/.hgrc like this: |
30182 | 152 |
|
153 |
[extensions] |
|
154 |
hgext.fetch = |
|
155 |
||
156 |
[defaults] |
|
157 |
fetch = -m "merged" |
|
158 |
||
40601 | 159 |
To keep merges semantically trivial and prevent genuine merge |
160 |
conflicts or lost updates, it is essential to observe to following |
|
161 |
general discipline wrt. the public Isabelle push area: |
|
162 |
||
163 |
* Before editing, pull or fetch the latest version. |
|
164 |
||
165 |
* Accumulate private commits for a maximum of 1-3 days. |
|
166 |
||
167 |
* Start publishing again by pull or fetch, which normally produces |
|
168 |
local merges. |
|
169 |
||
170 |
* Test the merged result as usual and push back in real time. |
|
171 |
||
172 |
Piling private changes and public merges longer than 0.5-2 hours is |
|
173 |
apt to produce some mess when pushing eventually! |
|
30182 | 174 |
|
175 |
||
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
176 |
Content discipline |
29481 | 177 |
------------------ |
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
178 |
|
40601 | 179 |
The following principles should be kept in mind when producing |
180 |
changesets that are meant to be published at some point. |
|
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
181 |
|
40601 | 182 |
* The author of changes needs to be properly identified, using |
183 |
[ui]username configuration as described above. |
|
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
184 |
|
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
185 |
While Mercurial also provides means for signed changesets, we want |
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
186 |
to keep things simple and trust that users specify their identity |
40601 | 187 |
correctly (and uniquely). |
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
188 |
|
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
189 |
* The history of sources is an integral part of the sources |
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
190 |
themselves. This means that private experiments and branches |
40601 | 191 |
should not be published by accident. Named branches are not |
192 |
allowed on the public version. Note that old SVN-style branching |
|
193 |
is replaced by regular repository clones in Mercurial. |
|
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
194 |
|
40601 | 195 |
Exchanging local experiments with some other users can be done |
196 |
directly on peer-to-peer basis, without affecting the central |
|
197 |
pull/push area. |
|
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
198 |
|
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
199 |
* Log messages are an integral part of the history of sources. |
40601 | 200 |
Other people will have to inspect them routinely, to understand |
201 |
why things have been done in a certain way at some point. |
|
202 |
||
203 |
Authors of log entries should be aware that published changes are |
|
204 |
actually read. The main point is not to announce novelties, but |
|
205 |
to describe faithfully what has been done, and provide some clues |
|
206 |
about the motivation behind it. The main recipient is someone who |
|
207 |
needs to understand the change in the distant future to isolate |
|
208 |
problems. Sometimes it is helpful to reference past changes via |
|
209 |
changeset ids in the log entry. |
|
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
210 |
|
40601 | 211 |
* The standard changelog entry format of the Isabelle repository |
212 |
admits several (vaguely related) items to be rolled into one |
|
213 |
changeset. Each item is then described on a separate line that |
|
214 |
may become longer as screen line and is terminated by punctuation. |
|
215 |
These lines are roughly ordered by importance. |
|
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
216 |
|
40601 | 217 |
This format conforms to established Isabelle tradition. In |
218 |
contrast, the default of Mercurial prefers a single headline |
|
219 |
followed by a long body text. The reason for that is a somewhat |
|
220 |
different development model of typical "distributed" projects, |
|
221 |
where external changes pass through a hierarchy of reviewers and |
|
222 |
maintainers, until they end up in some authoritative repository. |
|
223 |
Isabelle changesets can be more spontaneous, growing from the |
|
224 |
bottom-up. |
|
225 |
||
226 |
The web style of http://isabelle.in.tum.de/repos/isabelle/ |
|
227 |
accommodates the Isabelle changelog format. Note that multiple |
|
228 |
lines will sometimes display as a single paragraph in HTML, so |
|
229 |
some terminating punctuation is required. Do not squeeze multiple |
|
230 |
items on the same line in the original text! |
|
28907
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
231 |
|
1a470f95ef18
Important notes on Mercurial repository access for Isabelle.
wenzelm
parents:
diff
changeset
|
232 |
|
32361
141e5151b918
clarified situation about unidentified repository versions -- in a distributed setting there is not "the" repository;
wenzelm
parents:
30182
diff
changeset
|
233 |
Building a repository version of Isabelle |
141e5151b918
clarified situation about unidentified repository versions -- in a distributed setting there is not "the" repository;
wenzelm
parents:
30182
diff
changeset
|
234 |
----------------------------------------- |
28908 | 235 |
|
40601 | 236 |
Compared to a proper distribution or development snapshot, it is |
237 |
relatively hard to build from the raw repository version. Essential |
|
238 |
contributing components are missing and need to be reconstructed by |
|
239 |
running the Admin/build script by hand. Afterwards the main Isabelle |
|
240 |
system and logic images can be compiled via the toplevel ./build |
|
241 |
script. Note that the repository lacks some textual version |
|
242 |
identifiers in the sources and scripts; this implies some changed |
|
243 |
behavior when processing settings etc. |
|
28908 | 244 |
|
40601 | 245 |
There is no guarantee that the NEWS file is up to date at an arbitrary |
246 |
point in history. |