5 -------- |
5 -------- |
6 |
6 |
7 Mercurial http://www.selenic.com/mercurial belongs to a new generation |
7 Mercurial http://www.selenic.com/mercurial belongs to a new generation |
8 of source code management systems, following the paradigm of |
8 of source code management systems, following the paradigm of |
9 "distributed version control". Compared to the old centralized model |
9 "distributed version control". Compared to the old centralized model |
10 of CVS/SVN, this gives considerable more power and freedom in |
10 of CVS or SVN, this gives considerable more power and freedom in |
11 organizing the flow of changes, both between individual developers and |
11 organizing the flow of changes, both between individual developers and |
12 designated pull/push areas that are shared with others. |
12 designated pull/push areas that are shared with others. |
13 |
13 |
14 More power for the user also means more responsibility! Due to its |
14 More power for the user also means more responsibility! Due to its |
15 decentralized nature, changesets that have been published once, |
15 decentralized nature, changesets that have been published once, |
16 e.g. via push to a shared repository that is visible on the net, |
16 e.g. via "push" to a shared repository that is visible on the net, |
17 cannot be easily retracted from the public again. Regular Mercurial |
17 cannot be easily retracted from the public again. Regular Mercurial |
18 operations are strictly monotonic, where changset transactions are |
18 operations are strictly monotonic, where changset transactions are |
19 only added, but never deleted. There are special tools to "repair" |
19 only added, but never deleted. There are special tools to manipulate |
20 individual repositories via non-monotonic actions, but this does not |
20 individual repositories via non-monotonic actions, but this does not |
21 yet retrieve unwanted changesets that have escaped into the public. |
21 yet retrieve any changesets that have escaped into the public by |
|
22 accident. |
22 |
23 |
23 Only global operations like pull/push, unbundle/bundle etc. fall into |
24 Only global operations like "pull" / "push", "unbundle" / "bundle" |
24 this critical category; incoming/outgoing or in/out may help to |
25 etc. fall into this critical category. Note that "incoming" / |
25 inspect changesets before exchanging them globally. Anything else in |
26 "outgoing" allow to inspect changesets before exchanging them |
26 Mercurial is local to the user's repository clone (including |
27 globally. Anything else in Mercurial is local to the user's |
27 commit/update/merge etc.) and is in fact much simpler and safer to use |
28 repository clone (including "commit", "update", "merge" etc.) and is |
28 than the corresponding operations of CVS or SVN. |
29 in fact much simpler and safer to use than the corresponding |
|
30 operations of CVS or SVN. |
29 |
31 |
30 |
32 |
31 Initial configuration |
33 Initial configuration |
32 ===================== |
34 ===================== |
33 |
35 |
34 Never use any Mercurial version before 1.0! At the moment, versions |
36 Always use Mercurial version 1.0 or later, such as 1.0.1 or 1.0.2. |
35 1.0, 1.0.1 and 1.0.2 all work equally well. |
37 The old 0.9.x versions do not work in a multi-user environment with |
|
38 shared file spaces. |
36 |
39 |
37 |
40 |
38 The public pull area of the Isabelle repository can be cloned like |
41 The official Isabelle repository can be cloned like this: |
39 this: |
|
40 |
42 |
41 hg clone http://isabelle.in.tum.de/repos/isabelle |
43 hg clone http://isabelle.in.tum.de/repos/isabelle |
42 |
44 |
43 This will create a local directory "isabelle", unless an alternative |
45 This will create a local directory "isabelle", unless an alternative |
44 name is specified. The full repository meta-data and history of |
46 name is specified. The full repository meta-data and history of |
45 changes is in isabelle/.hg; local configuration for this clone can be |
47 changes is in isabelle/.hg; local configuration for this clone can be |
46 added to isabelle/.hg/hgrc, but note that hgrc files are never copied |
48 added to isabelle/.hg/hgrc, but note that hgrc files are never copied |
47 by another clone operation! |
49 by another clone operation! |
48 |
50 |
49 There is also ~/.hgrc for per-user Mercurial configuration. The |
51 There is also $HOME/.hgrc for per-user Mercurial configuration. The |
50 initial configuration should include at least an entry to identify |
52 initial configuration should include at least an entry to identify |
51 yourself. For example, something like this in /home/wenzelm/.hgrc: |
53 yourself. For example, something like this in /home/wenzelm/.hgrc: |
52 |
54 |
53 [ui] |
55 [ui] |
54 username = wenzelm |
56 username = wenzelm |
55 |
57 |
56 Failing to configure the username correctly makes the system invent |
58 Failing to configure the username correctly makes the system invent |
57 funny machine names that may persist eternally in the flow of |
59 funny machine names that may persist indefinitely in the public flow |
58 changesets. |
60 of changesets. |
59 |
61 |
60 In principle, user names can be chosen freely, but for longterm |
62 In principle, user names can be chosen freely, but for longterm |
61 committers of the Isabelle repository the obvious choice is to keep |
63 committers of the Isabelle repository the obvious choice is to keep |
62 with the old CVS naming scheme. |
64 with the old CVS naming scheme. |
63 |
65 |
64 |
66 |
65 There are other useful configuration to go into ~/.hgrc, e.g. defaults |
67 There are other useful configuration to go into $HOME/.hgrc, |
66 for common commands: |
68 e.g. defaults for common commands: |
67 |
69 |
68 [defaults] |
70 [defaults] |
69 log = -l 10 |
71 log = -l 10 |
70 |
72 |
71 The next example shows how to install some Mercurial extension: |
73 The next example shows how to install some Mercurial extension: |
84 ======================= |
86 ======================= |
85 |
87 |
86 The entry point http://isabelle.in.tum.de/repos/isabelle is world |
88 The entry point http://isabelle.in.tum.de/repos/isabelle is world |
87 readable, both via plain web browsing and the hg client as described |
89 readable, both via plain web browsing and the hg client as described |
88 above. Anybody can produce a clone, change it arbitrarily, and then |
90 above. Anybody can produce a clone, change it arbitrarily, and then |
89 use regular mechanisms of Mercurial to report changes "upstream", say |
91 use regular mechanisms of Mercurial to report changes upstream, say |
90 via e-mail to someone with write access to that file space. It is |
92 via e-mail to someone with write access to that file space. It is |
91 also quite easy to publish changed clones again on the web, using hg |
93 also quite easy to publish changed clones again on the web, using the |
92 serve, or the hgweb.cgi or hgwebdir.cgi scripts that are included in |
94 adhoc command "hg serve -v", or the hgweb.cgi or hgwebdir.cgi scripts |
93 the Mercurial distribution. |
95 that are included in the Mercurial distribution. |
94 |
96 |
95 This downstream/upstream mode of operation is quite common in the |
97 The downstream/upstream mode of operation is quite common in the |
96 distributed version control community, and works well for occasional |
98 distributed version control community, and works well for occasional |
97 changes produced by anybody out there. Of course, upstream |
99 changes produced by anybody out there. Of course, upstream |
98 maintainers need to review and moderate changes being proposed, before |
100 maintainers need to review and moderate changes being proposed, before |
99 pushing anything onto the official Isabelle repository at TUM. |
101 pushing anything onto the official Isabelle repository at TUM. |
100 |
102 |
101 |
103 |
102 Direct pull/push access requires an account at TUM, with properly |
104 Write access to the Isabelle repository requires an account at TUM, |
103 configured ssh access to the local machines (e.g. macbroy20, |
105 with properly configured ssh access to the local machines |
104 atbroy100). |
106 (e.g. macbroy20, atbroy100). You also need to be a member of the |
|
107 "isabelle" Unix group. |
105 |
108 |
106 The simple wrapper script /home/isabelle/mercurial/bin/hg provides a |
109 Sharing a locally modified clone then works as follows, using your |
107 uniform view on the different Linux installations on the local |
110 user name instead of "wenzelm": |
108 network. Thus it is advisable to add that directory to the shell PATH |
|
109 of the account at TUM: |
|
110 |
111 |
111 PATH="/home/isabelle/mercurial/bin:$PATH" |
112 hg out ssh://wenzelm@atbroy100//home/isabelle-repository/repos/isabelle |
112 |
113 |
113 Now a clone of the shared push/pull area can be produced like this, |
114 In fact, the "out" or "outgoing" command performs only a dry run: it |
114 using your user name instead of "wenzelm": |
115 displays the changesets that would get published. An actual "push", |
|
116 with a lasting effect on the Isabelle repository, works like this: |
115 |
117 |
116 hg clone ssh://wenzelm@atbroy100//home/isabelle-repository/repos/isabelle |
118 hg push ssh://wenzelm@atbroy100//home/isabelle-repository/repos/isabelle |
117 |
119 |
118 In fact, the only difference to the previous clone of |
120 |
119 http://isabelle.in.tum.de/repos/isabelle is a different default |
121 Default paths for push and pull can be configure in isabelle/.hg/hgrc, |
120 pull/push path in isabelle/.hg/hgrc: |
122 for example: |
121 |
123 |
122 [paths] |
124 [paths] |
123 default = ssh://wenzelm@atbroy100//home/isabelle-repository/repos/isabelle |
125 default = ssh://wenzelm@atbroy100//home/isabelle-repository/repos/isabelle |
124 |
126 |
125 This means an earlier pull-only clone can be changed into a pull/push |
127 Now "hg pull" or "hg push" will use that shared file space, unless a |
126 version by editing this single line of the internal repository |
128 different URL is specified explicitly. |
127 configuration. |
129 |
|
130 When cloning a repository, the default path is set to the initial |
|
131 source URL. So we could have cloned via that ssh URL in the first |
|
132 place, to get exactly to the same point: |
|
133 |
|
134 hg clone ssh://wenzelm@atbroy100//home/isabelle-repository/repos/isabelle |
128 |
135 |
129 |
136 |
130 Content discipline |
137 Content discipline |
131 ================== |
138 ================== |
132 |
139 |
133 Old-style centralized version control is occasionally compared with a |
140 Old-style centralized version control is occasionally compared to "a |
134 "library where everybody scribbles into the books". Or seen the other |
141 library where everybody scribbles into the books". Or seen the other |
135 way round, the centralized model discourages individual |
142 way round, the centralized model discourages individual |
136 experimentation (with local branches etc.), because everything is |
143 experimentation (with local branches etc.), because everything is |
137 forced to happen on a shared file space. With Mercurial, arbitrary |
144 forced to happen on a shared file space. With Mercurial, arbitrary |
138 variations on local clones are no problem, but care is required again |
145 variations on local clones are no problem, but care is required again |
139 when publishing changes eventually. |
146 when publishing changes eventually. |
166 Users should be aware that others will actually read what is |
173 Users should be aware that others will actually read what is |
167 written into log messages. |
174 written into log messages. |
168 |
175 |
169 The usual changelog presentation style for the Isabelle repository |
176 The usual changelog presentation style for the Isabelle repository |
170 admits log entries that consist of several lines, but without the |
177 admits log entries that consist of several lines, but without the |
171 special head line that is used in Mercurial projects elsewhere. |
178 special headline that is used in Mercurial projects elsewhere. |
172 Since some display styles strip newlines from text, it is |
179 Since some display styles strip newlines from text, it is |
173 advisable to separate lines via punctuation, and not rely on |
180 advisable to separate lines via punctuation, and not rely on |
174 two-dimensional presentation too much. |
181 two-dimensional presentation too much. |
175 |
182 |
176 |
183 |
177 Building Isabelle from the repository version |
184 Building Isabelle from the repository version |
178 ============================================= |
185 ============================================= |
179 |
186 |
180 Compared to a proper distribution or development snapshot, a |
187 Compared to a proper distribution or development snapshot, a |
181 repository version of Isabelle lacks proper version identifiers in |
188 repository version of Isabelle lacks textual version identifiers in |
182 various places, and some components produced by Admin/build. After |
189 some sources and scripts, and various components produced by |
183 applying that script with suitable options, the regular user |
190 Admin/build are missing. After applying that script with suitable |
184 instructions for building and running Isabelle from sources apply. |
191 arguments, the regular user instructions for building and running |
|
192 Isabelle from sources apply. |
185 |
193 |
186 Needless to say, the results from the build process must not be |
194 Needless to say, the results from the build process must not be added |
187 committed back into the repository! |
195 to the repository! |
188 |
196 |
189 |
197 |
190 Makarius 29-Nov-2008 |
198 Makarius 30-Nov-2008 |