Mercurial > hgbook
comparison en/ch05-collab.xml @ 805:743dc55775fe
Merged upstream
author | Raphael Borun Das Gupta <hg@raphael.dasgupta.ch> |
---|---|
date | Sat, 18 Apr 2009 17:45:54 +0200 |
parents | 83540574ee49 29f0f79cf614 |
children | 06458701453c |
comparison
equal
deleted
inserted
replaced
804:83540574ee49 | 805:743dc55775fe |
---|---|
17 useful capabilities.</para> | 17 useful capabilities.</para> |
18 | 18 |
19 <para id="x_44c">For interactive use, the web interface lets you browse a | 19 <para id="x_44c">For interactive use, the web interface lets you browse a |
20 single repository or a collection of repositories. You can view | 20 single repository or a collection of repositories. You can view |
21 the history of a repository, examine each change (comments and | 21 the history of a repository, examine each change (comments and |
22 diffs), and view the contents of each directory and file.</para> | 22 diffs), and view the contents of each directory and file. You |
23 | 23 can even get a view of history that gives a graphical view of |
24 <para id="x_44d">Also for human consumption, the web interface provides an | 24 the relationships between individual changes and merges.</para> |
25 RSS feed of the changes in a repository. This lets you | 25 |
26 <para id="x_44d">Also for human consumption, the web interface provides | |
27 Atom and RSS feeds of the changes in a repository. This lets you | |
26 <quote>subscribe</quote> to a repository using your favorite | 28 <quote>subscribe</quote> to a repository using your favorite |
27 feed reader, and be automatically notified of activity in that | 29 feed reader, and be automatically notified of activity in that |
28 repository as soon as it happens. I find this capability much | 30 repository as soon as it happens. I find this capability much |
29 more convenient than the model of subscribing to a mailing list | 31 more convenient than the model of subscribing to a mailing list |
30 to which notifications are sent, as it requires no additional | 32 to which notifications are sent, as it requires no additional |
38 efficiently even over low-bandwidth network connections.</para> | 40 efficiently even over low-bandwidth network connections.</para> |
39 | 41 |
40 <para id="x_44f">The easiest way to get started with the web interface is to | 42 <para id="x_44f">The easiest way to get started with the web interface is to |
41 use your web browser to visit an existing repository, such as | 43 use your web browser to visit an existing repository, such as |
42 the master Mercurial repository at <ulink | 44 the master Mercurial repository at <ulink |
43 url="http://www.selenic.com/repo/hg?style=gitweb">http://www.selenic.com/repo/hg?style=gitweb</ulink>.</para> | 45 url="http://www.selenic.com/repo/hg">http://www.selenic.com/repo/hg</ulink>.</para> |
44 | 46 |
45 <para id="x_450">If you're interested in providing a web interface | 47 <para id="x_450">If you're interested in providing a web interface |
46 to your own repositories, Mercurial provides two ways to do | 48 to your own repositories, there are several good ways to do |
47 this. The first is using the <command role="hg-cmd">hg | 49 this.</para> |
50 | |
51 <para id="x_69d">The easiest and fastest way to get started in an informal | |
52 environment is to use the <command role="hg-cmd">hg | |
48 serve</command> command, which is best suited to short-term | 53 serve</command> command, which is best suited to short-term |
49 <quote>lightweight</quote> serving. See <xref | 54 <quote>lightweight</quote> serving. See <xref |
50 linkend="sec:collab:serve"/> below for details of how to use | 55 linkend="sec:collab:serve"/> below for details of how to use |
51 this command. If you have a long-lived repository that you'd | 56 this command.</para> |
52 like to make permanently available, Mercurial has built-in | 57 |
53 support for the CGI (Common Gateway Interface) standard, which | 58 <para id="x_69e">For longer-lived repositories that you'd like to have |
54 all common web servers support. See <xref | 59 permanently available, there are several public hosting services |
55 linkend="sec:collab:cgi"/> for details of CGI | 60 available.</para> |
61 | |
62 <itemizedlist> | |
63 <listitem> | |
64 <para id="x_69f">Bitbucket, at <ulink | |
65 url="http://bitbucket.org/">http://bitbucket.org/</ulink>, | |
66 provides free hosting for open source projects, and paid | |
67 hosting for commercial projects.</para> | |
68 </listitem> | |
69 </itemizedlist> | |
70 | |
71 <para id="x_6a0">If you would prefer to host your own repositories, Mercurial | |
72 has built-in support for several popular hosting technologies, | |
73 most notably CGI (Common Gateway Interface), and WSGI (Web | |
74 Services Gateway Interface). See <xref | |
75 linkend="sec:collab:cgi"/> for details of CGI and WSGI | |
56 configuration.</para> | 76 configuration.</para> |
57 | |
58 </sect1> | 77 </sect1> |
78 | |
59 <sect1> | 79 <sect1> |
60 <title>Collaboration models</title> | 80 <title>Collaboration models</title> |
61 | 81 |
62 <para id="x_451">With a suitably flexible tool, making decisions about | 82 <para id="x_451">With a suitably flexible tool, making decisions about |
63 workflow is much more of a social engineering challenge than a | 83 workflow is much more of a social engineering challenge than a |
94 think early about the possibility that someone might | 114 think early about the possibility that someone might |
95 accidentally merge those changes into a release branch. You | 115 accidentally merge those changes into a release branch. You |
96 could avoid this particular problem by writing a hook that | 116 could avoid this particular problem by writing a hook that |
97 prevents changes from being merged from an inappropriate | 117 prevents changes from being merged from an inappropriate |
98 branch.</para> | 118 branch.</para> |
99 | 119 </sect2> |
100 </sect2> | 120 |
101 <sect2> | 121 <sect2> |
102 <title>Informal anarchy</title> | 122 <title>Informal anarchy</title> |
103 | 123 |
104 <para id="x_455">I wouldn't suggest an <quote>anything goes</quote> | 124 <para id="x_455">I wouldn't suggest an <quote>anything goes</quote> |
105 approach as something sustainable, but it's a model that's | 125 approach as something sustainable, but it's a model that's |
113 a number of people get together in a single location (a | 133 a number of people get together in a single location (a |
114 company's conference room, a hotel meeting room, that kind of | 134 company's conference room, a hotel meeting room, that kind of |
115 place) and spend several days more or less locked in there, | 135 place) and spend several days more or less locked in there, |
116 hacking intensely on a handful of projects.</para> | 136 hacking intensely on a handful of projects.</para> |
117 | 137 |
118 <para id="x_457">A sprint is the perfect place to use the | 138 <para id="x_457">A sprint or a hacking session in a coffee shop are the perfect places to use the |
119 <command role="hg-cmd">hg serve</command> command, since | 139 <command role="hg-cmd">hg serve</command> command, since |
120 <command role="hg-cmd">hg serve</command> does not require any | 140 <command role="hg-cmd">hg serve</command> does not require any |
121 fancy server infrastructure. You can get started with | 141 fancy server infrastructure. You can get started with |
122 <command role="hg-cmd">hg serve</command> in moments, by | 142 <command role="hg-cmd">hg serve</command> in moments, by |
123 reading <xref linkend="sec:collab:serve"/> below. Then simply | 143 reading <xref linkend="sec:collab:serve"/> below. Then simply |
127 your URL into their web browser and quickly review your | 147 your URL into their web browser and quickly review your |
128 changes; or they can pull a bugfix from you and verify it; or | 148 changes; or they can pull a bugfix from you and verify it; or |
129 they can clone a branch containing a new feature and try it | 149 they can clone a branch containing a new feature and try it |
130 out.</para> | 150 out.</para> |
131 | 151 |
132 <para id="x_458">The charm, and the problem, with doing things in an ad hoc | 152 <para id="x_458">The charm, and the problem, with doing things |
133 fashion like this is that only people who know about your | 153 in an ad hoc fashion like this is that only people who know |
134 changes, and where they are, can see them. Such an informal | 154 about your changes, and where they are, can see them. Such an |
135 approach simply doesn't scale beyond a handful people, because | 155 informal approach simply doesn't scale beyond a handful |
136 each individual needs to know about $n$ different repositories | 156 people, because each individual needs to know about |
137 to pull from.</para> | 157 <emphasis>n</emphasis> different repositories to pull |
138 | 158 from.</para> |
139 </sect2> | 159 </sect2> |
160 | |
140 <sect2> | 161 <sect2> |
141 <title>A single central repository</title> | 162 <title>A single central repository</title> |
142 | 163 |
143 <para id="x_459">For smaller projects migrating from a centralised revision | 164 <para id="x_459">For smaller projects migrating from a centralised revision |
144 control tool, perhaps the easiest way to get started is to | 165 control tool, perhaps the easiest way to get started is to |
160 potential for damage, I can ask you to clone my repository | 181 potential for damage, I can ask you to clone my repository |
161 into a temporary repository of your own and test it. This | 182 into a temporary repository of your own and test it. This |
162 lets us put off publishing the potentially unsafe change until | 183 lets us put off publishing the potentially unsafe change until |
163 it has had a little testing.</para> | 184 it has had a little testing.</para> |
164 | 185 |
165 <para id="x_45c">In this kind of scenario, people usually use | 186 <para id="x_45c">If a team is hosting its own repository in this |
166 the <command>ssh</command> protocol to securely push changes | 187 kind of scenario, people will usually use the |
167 to the central repository, as documented in <xref | 188 <command>ssh</command> protocol to securely push changes to |
189 the central repository, as documented in <xref | |
168 linkend="sec:collab:ssh"/>. It's also usual to publish a | 190 linkend="sec:collab:ssh"/>. It's also usual to publish a |
169 read-only copy of the repository over HTTP using CGI, as in | 191 read-only copy of the repository over HTTP, as in |
170 <xref linkend="sec:collab:cgi"/>. Publishing | 192 <xref linkend="sec:collab:cgi"/>. Publishing over HTTP |
171 over HTTP satisfies the needs of people who don't have push | 193 satisfies the needs of people who don't have push access, and |
172 access, and those who want to use web browsers to browse the | 194 those who want to use web browsers to browse the repository's |
173 repository's history.</para> | 195 history.</para> |
174 | 196 </sect2> |
175 </sect2> | 197 |
198 <sect2> | |
199 <title>A hosted central repository</title> | |
200 | |
201 <para id="x_6a1">A wonderful thing about public hosting services like | |
202 <ulink url="http://bitbucket.org/">Bitbucket</ulink> is that | |
203 not only do they handle the fiddly server configuration | |
204 details, such as user accounts, authentication, and secure | |
205 wire protocols, they provide additional infrastructure to make | |
206 this model work well.</para> | |
207 | |
208 <para id="x_6a2">For instance, a well-engineered hosting service will let | |
209 people clone their own copies of a repository with a single | |
210 click. This lets people work in separate spaces and share | |
211 their changes when they're ready.</para> | |
212 | |
213 <para id="x_6a3">In addition, a good hosting service will let people | |
214 communicate with each other, for instance to say <quote>there | |
215 are changes ready for you to review in this | |
216 tree</quote>.</para> | |
217 </sect2> | |
218 | |
176 <sect2> | 219 <sect2> |
177 <title>Working with multiple branches</title> | 220 <title>Working with multiple branches</title> |
178 | 221 |
179 <para id="x_45d">Projects of any significant size naturally tend to make | 222 <para id="x_45d">Projects of any significant size naturally tend to make |
180 progress on several fronts simultaneously. In the case of | 223 progress on several fronts simultaneously. In the case of |
194 <quote>development direction</quote> can live in its own | 237 <quote>development direction</quote> can live in its own |
195 central repository, and you can merge changes from one to | 238 central repository, and you can merge changes from one to |
196 another as the need arises. Because repositories are | 239 another as the need arises. Because repositories are |
197 independent of each other, unstable changes in a development | 240 independent of each other, unstable changes in a development |
198 branch will never affect a stable branch unless someone | 241 branch will never affect a stable branch unless someone |
199 explicitly merges those changes in.</para> | 242 explicitly merges those changes into the stable branch.</para> |
200 | 243 |
201 <para id="x_45f">Here's an example of how this can work in practice. Let's | 244 <para id="x_45f">Here's an example of how this can work in practice. Let's |
202 say you have one <quote>main branch</quote> on a central | 245 say you have one <quote>main branch</quote> on a central |
203 server.</para> | 246 server.</para> |
204 | 247 |
225 revision was committed.</para> | 268 revision was committed.</para> |
226 | 269 |
227 &interaction.branching.update; | 270 &interaction.branching.update; |
228 | 271 |
229 <para id="x_464">In addition, immediately after the main branch is tagged, | 272 <para id="x_464">In addition, immediately after the main branch is tagged, |
230 someone can then clone the main branch on the server to a new | 273 we can then clone the main branch on the server to a new |
231 <quote>stable</quote> branch, also on the server.</para> | 274 <quote>stable</quote> branch, also on the server.</para> |
232 | 275 |
233 &interaction.branching.clone; | 276 &interaction.branching.clone; |
234 | 277 |
235 <para id="x_465">Someone who needs to make a change to the stable branch | 278 <para id="x_465">If we need to make a change to the stable |
236 can then clone <emphasis>that</emphasis> repository, make | 279 branch, we can then clone <emphasis>that</emphasis> |
237 their changes, commit, and push their changes back there.</para> | 280 repository, make our changes, commit, and push our changes |
281 back there.</para> | |
238 | 282 |
239 &interaction.branching.stable; | 283 &interaction.branching.stable; |
240 | 284 |
241 <para id="x_466">Because Mercurial repositories are independent, and | 285 <para id="x_466">Because Mercurial repositories are independent, and |
242 Mercurial doesn't move changes around automatically, the | 286 Mercurial doesn't move changes around automatically, the |
243 stable and main branches are <emphasis>isolated</emphasis> | 287 stable and main branches are <emphasis>isolated</emphasis> |
244 from each other. The changes that you made on the main branch | 288 from each other. The changes that we made on the main branch |
245 don't <quote>leak</quote> to the stable branch, and vice | 289 don't <quote>leak</quote> to the stable branch, and vice |
246 versa.</para> | 290 versa.</para> |
247 | 291 |
248 <para id="x_467">You'll often want all of your bugfixes on the stable | 292 <para id="x_467">We'll often want all of our bugfixes on the stable |
249 branch to show up on the main branch, too. Rather than | 293 branch to show up on the main branch, too. Rather than |
250 rewrite a bugfix on the main branch, you can simply pull and | 294 rewrite a bugfix on the main branch, we can simply pull and |
251 merge changes from the stable to the main branch, and | 295 merge changes from the stable to the main branch, and |
252 Mercurial will bring those bugfixes in for you.</para> | 296 Mercurial will bring those bugfixes in for us.</para> |
253 | 297 |
254 &interaction.branching.merge; | 298 &interaction.branching.merge; |
255 | 299 |
256 <para id="x_468">The main branch will still contain changes that are not on | 300 <para id="x_468">The main branch will still contain changes that |
257 the stable branch, but it will also contain all of the | 301 are not on the stable branch, but it will also contain all of |
258 bugfixes from the stable branch. The stable branch remains | 302 the bugfixes from the stable branch. The stable branch |
259 unaffected by these changes.</para> | 303 remains unaffected by these changes, since changes are only |
260 | 304 flowing from the stable to the main branch, and not the other |
261 </sect2> | 305 way.</para> |
306 </sect2> | |
307 | |
262 <sect2> | 308 <sect2> |
263 <title>Feature branches</title> | 309 <title>Feature branches</title> |
264 | 310 |
265 <para id="x_469">For larger projects, an effective way to manage change is | 311 <para id="x_469">For larger projects, an effective way to manage change is |
266 to break up a team into smaller groups. Each group has a | 312 to break up a team into smaller groups. Each group has a |
279 | 325 |
280 <para id="x_46b">When a particular feature is deemed to be in suitable | 326 <para id="x_46b">When a particular feature is deemed to be in suitable |
281 shape, someone on that feature team pulls and merges from the | 327 shape, someone on that feature team pulls and merges from the |
282 master branch into the feature branch, then pushes back up to | 328 master branch into the feature branch, then pushes back up to |
283 the master branch.</para> | 329 the master branch.</para> |
284 | 330 </sect2> |
285 </sect2> | 331 |
286 <sect2> | 332 <sect2> |
287 <title>The release train</title> | 333 <title>The release train</title> |
288 | 334 |
289 <para id="x_46c">Some projects are organized on a <quote>train</quote> | 335 <para id="x_46c">Some projects are organized on a <quote>train</quote> |
290 basis: a release is scheduled to happen every few months, and | 336 basis: a release is scheduled to happen every few months, and |
295 difference is that when a feature branch misses a train, | 341 difference is that when a feature branch misses a train, |
296 someone on the feature team pulls and merges the changes that | 342 someone on the feature team pulls and merges the changes that |
297 went out on that train release into the feature branch, and | 343 went out on that train release into the feature branch, and |
298 the team continues its work on top of that release so that | 344 the team continues its work on top of that release so that |
299 their feature can make the next release.</para> | 345 their feature can make the next release.</para> |
300 | 346 </sect2> |
301 </sect2> | 347 |
302 <sect2> | 348 <sect2> |
303 <title>The Linux kernel model</title> | 349 <title>The Linux kernel model</title> |
304 | 350 |
305 <para id="x_46e">The development of the Linux kernel has a shallow | 351 <para id="x_46e">The development of the Linux kernel has a shallow |
306 hierarchical structure, surrounded by a cloud of apparent | 352 hierarchical structure, surrounded by a cloud of apparent |
370 often seems completely insane. It's subject to the whims of | 416 often seems completely insane. It's subject to the whims of |
371 individuals; people make sweeping changes whenever they deem | 417 individuals; people make sweeping changes whenever they deem |
372 it appropriate; and the pace of development is astounding. | 418 it appropriate; and the pace of development is astounding. |
373 And yet Linux is a highly successful, well-regarded piece of | 419 And yet Linux is a highly successful, well-regarded piece of |
374 software.</para> | 420 software.</para> |
375 | 421 </sect2> |
376 </sect2> | 422 |
377 <sect2> | 423 <sect2> |
378 <title>Pull-only versus shared-push collaboration</title> | 424 <title>Pull-only versus shared-push collaboration</title> |
379 | 425 |
380 <para id="x_476">A perpetual source of heat in the open source community is | 426 <para id="x_476">A perpetual source of heat in the open source community is |
381 whether a development model in which people only ever pull | 427 whether a development model in which people only ever pull |
389 no way to make a choice over which model you'll use: the tool | 435 no way to make a choice over which model you'll use: the tool |
390 gives you shared-push, and if you want to do anything else, | 436 gives you shared-push, and if you want to do anything else, |
391 you'll have to roll your own approach on top (such as applying | 437 you'll have to roll your own approach on top (such as applying |
392 a patch by hand).</para> | 438 a patch by hand).</para> |
393 | 439 |
394 <para id="x_478">A good distributed revision control tool, such as | 440 <para id="x_478">A good distributed revision control tool will |
395 Mercurial, will support both models. You and your | 441 support both models. You and your collaborators can then |
396 collaborators can then structure how you work together based | 442 structure how you work together based on your own needs and |
397 on your own needs and preferences, not on what contortions | 443 preferences, not on what contortions your tools force you |
398 your tools force you into.</para> | 444 into.</para> |
399 | |
400 </sect2> | 445 </sect2> |
401 <sect2> | 446 <sect2> |
402 <title>Where collaboration meets branch management</title> | 447 <title>Where collaboration meets branch management</title> |
403 | 448 |
404 <para id="x_479">Once you and your team set up some shared | 449 <para id="x_479">Once you and your team set up some shared |
407 but slightly different challenge: that of managing the | 452 but slightly different challenge: that of managing the |
408 multiple directions in which your team may be moving at once. | 453 multiple directions in which your team may be moving at once. |
409 Even though this subject is intimately related to how your | 454 Even though this subject is intimately related to how your |
410 team collaborates, it's dense enough to merit treatment of its | 455 team collaborates, it's dense enough to merit treatment of its |
411 own, in <xref linkend="chap:branch"/>.</para> | 456 own, in <xref linkend="chap:branch"/>.</para> |
412 | |
413 </sect2> | 457 </sect2> |
414 </sect1> | 458 </sect1> |
459 | |
415 <sect1> | 460 <sect1> |
416 <title>The technical side of sharing</title> | 461 <title>The technical side of sharing</title> |
417 | 462 |
418 <para id="x_47a">The remainder of this chapter is devoted to the question of | 463 <para id="x_47a">The remainder of this chapter is devoted to the question of |
419 serving data to your collaborators.</para> | 464 sharing changes with your collaborators.</para> |
420 | |
421 </sect1> | 465 </sect1> |
466 | |
422 <sect1 id="sec:collab:serve"> | 467 <sect1 id="sec:collab:serve"> |
423 <title>Informal sharing with <command role="hg-cmd">hg | 468 <title>Informal sharing with <command role="hg-cmd">hg |
424 serve</command></title> | 469 serve</command></title> |
425 | 470 |
426 <para id="x_47b">Mercurial's <command role="hg-cmd">hg serve</command> | 471 <para id="x_47b">Mercurial's <command role="hg-cmd">hg serve</command> |
493 starts, it prints no output, which can be a bit unnerving. If | 538 starts, it prints no output, which can be a bit unnerving. If |
494 you'd like to confirm that it is indeed running correctly, and | 539 you'd like to confirm that it is indeed running correctly, and |
495 find out what URL you should send to your collaborators, start | 540 find out what URL you should send to your collaborators, start |
496 it with the <option role="hg-opt-global">-v</option> | 541 it with the <option role="hg-opt-global">-v</option> |
497 option.</para> | 542 option.</para> |
498 | |
499 </sect2> | 543 </sect2> |
500 </sect1> | 544 </sect1> |
545 | |
501 <sect1 id="sec:collab:ssh"> | 546 <sect1 id="sec:collab:ssh"> |
502 <title>Using the Secure Shell (ssh) protocol</title> | 547 <title>Using the Secure Shell (ssh) protocol</title> |
503 | 548 |
504 <para id="x_486">You can pull and push changes securely over a network | 549 <para id="x_486">You can pull and push changes securely over a network |
505 connection using the Secure Shell (<literal>ssh</literal>) | 550 connection using the Secure Shell (<literal>ssh</literal>) |
506 protocol. To use this successfully, you may have to do a little | 551 protocol. To use this successfully, you may have to do a little |
507 bit of configuration on the client or server sides.</para> | 552 bit of configuration on the client or server sides.</para> |
508 | 553 |
509 <para id="x_487">If you're not familiar with ssh, it's a network protocol | 554 <para id="x_487">If you're not familiar with ssh, it's the name of |
510 that lets you securely communicate with another computer. To | 555 both a command and a network protocol that let you securely |
511 use it with Mercurial, you'll be setting up one or more user | 556 communicate with another computer. To use it with Mercurial, |
512 accounts on a server so that remote users can log in and execute | 557 you'll be setting up one or more user accounts on a server so |
513 commands.</para> | 558 that remote users can log in and execute commands.</para> |
514 | 559 |
515 <para id="x_488">(If you <emphasis>are</emphasis> familiar with ssh, you'll | 560 <para id="x_488">(If you <emphasis>are</emphasis> familiar with ssh, you'll |
516 probably find some of the material that follows to be elementary | 561 probably find some of the material that follows to be elementary |
517 in nature.)</para> | 562 in nature.)</para> |
518 | 563 |
567 | 612 |
568 <para id="x_492">And if you really want to specify an | 613 <para id="x_492">And if you really want to specify an |
569 <emphasis>absolute</emphasis> path on the server, begin the | 614 <emphasis>absolute</emphasis> path on the server, begin the |
570 path component with two slashes, as in this example.</para> | 615 path component with two slashes, as in this example.</para> |
571 <programlisting>ssh://server//absolute/path</programlisting> | 616 <programlisting>ssh://server//absolute/path</programlisting> |
572 | 617 </sect2> |
573 </sect2> | 618 |
574 <sect2> | 619 <sect2> |
575 <title>Finding an ssh client for your system</title> | 620 <title>Finding an ssh client for your system</title> |
576 | 621 |
577 <para id="x_493">Almost every Unix-like system comes with OpenSSH | 622 <para id="x_493">Almost every Unix-like system comes with OpenSSH |
578 preinstalled. If you're using such a system, run | 623 preinstalled. If you're using such a system, run |
580 <command>ssh</command> command is installed (it's usually in | 625 <command>ssh</command> command is installed (it's usually in |
581 <filename class="directory">/usr/bin</filename>). In the | 626 <filename class="directory">/usr/bin</filename>). In the |
582 unlikely event that it isn't present, take a look at your | 627 unlikely event that it isn't present, take a look at your |
583 system documentation to figure out how to install it.</para> | 628 system documentation to figure out how to install it.</para> |
584 | 629 |
585 <para id="x_494">On Windows, you'll first need to download a suitable ssh | 630 <para id="x_494">On Windows, the TortoiseHg package is bundled |
586 client. There are two alternatives.</para> | 631 with a version of Simon Tatham's excellent |
632 <command>plink</command> command, and you should not need to | |
633 do any further configuration.</para> | |
634 </sect2> | |
635 | |
636 <sect2> | |
637 <title>Generating a key pair</title> | |
638 | |
639 <para id="x_499">To avoid the need to repetitively type a | |
640 password every time you need to use your ssh client, I | |
641 recommend generating a key pair.</para> | |
642 | |
643 <tip> | |
644 <title>Key pairs are not mandatory</title> | |
645 | |
646 <para id="x_6a4">Mercurial knows nothing about ssh authentication or key | |
647 pairs. You can, if you like, safely ignore this section and | |
648 the one that follows until you grow tired of repeatedly | |
649 typing ssh passwords.</para> | |
650 </tip> | |
651 | |
587 <itemizedlist> | 652 <itemizedlist> |
588 <listitem><para id="x_495">Simon Tatham's excellent PuTTY package | 653 <listitem> |
589 <citation>web:putty</citation> provides a complete suite | 654 <para id="x_6a5">On a Unix-like system, the |
590 of ssh client commands.</para> | 655 <command>ssh-keygen</command> command will do the |
591 </listitem> | 656 trick.</para> |
592 <listitem><para id="x_496">If you have a high tolerance for pain, you can | 657 <para id="x_6a6">On Windows, if you're using TortoiseHg, you may need |
593 use the Cygwin port of OpenSSH.</para> | 658 to download a command named <command>puttygen</command> |
594 </listitem></itemizedlist> | 659 from <ulink |
595 <para id="x_497">In either case, you'll need to edit your <filename | 660 url="http://www.chiark.greenend.org.uk/~sgtatham/putty">the |
596 role="special">hg.ini</filename> file to | 661 PuTTY web site</ulink> to generate a key pair. See |
597 tell Mercurial where to find the actual client command. For | 662 <ulink |
598 example, if you're using PuTTY, you'll need to use the | 663 url="http://the.earth.li/~sgtatham/putty/0.60/htmldoc/Chapter8.html#pubkey-puttygen">the |
599 <command>plink</command> command as a command-line ssh | 664 <command>puttygen</command> documentation</ulink> for |
600 client.</para> | 665 details of how use the command.</para> |
601 <programlisting>[ui] | 666 </listitem> |
602 ssh = C:/path/to/plink.exe -ssh -i "C:/path/to/my/private/key"</programlisting> | 667 </itemizedlist> |
603 | |
604 <note> | |
605 <para id="x_498"> The path to <command>plink</command> shouldn't contain | |
606 any whitespace characters, or Mercurial may not be able to | |
607 run it correctly (so putting it in <filename | |
608 class="directory">C:\Program Files</filename> is probably | |
609 not a good idea).</para> | |
610 </note> | |
611 | |
612 </sect2> | |
613 <sect2> | |
614 <title>Generating a key pair</title> | |
615 | |
616 <para id="x_499">To avoid the need to repetitively type a password every | |
617 time you need to use your ssh client, I recommend generating a | |
618 key pair. On a Unix-like system, the | |
619 <command>ssh-keygen</command> command will do the trick. On | |
620 Windows, if you're using PuTTY, the | |
621 <command>puttygen</command> command is what you'll | |
622 need.</para> | |
623 | 668 |
624 <para id="x_49a">When you generate a key pair, it's usually | 669 <para id="x_49a">When you generate a key pair, it's usually |
625 <emphasis>highly</emphasis> advisable to protect it with a | 670 <emphasis>highly</emphasis> advisable to protect it with a |
626 passphrase. (The only time that you might not want to do this | 671 passphrase. (The only time that you might not want to do this |
627 is when you're using the ssh protocol for automated tasks on a | 672 is when you're using the ssh protocol for automated tasks on a |
640 <filename>.pub</filename> extension. If you're using | 685 <filename>.pub</filename> extension. If you're using |
641 <command>puttygen</command> on Windows, you can save the | 686 <command>puttygen</command> on Windows, you can save the |
642 public key to a file of your choosing, or paste it from the | 687 public key to a file of your choosing, or paste it from the |
643 window it's displayed in straight into the <filename | 688 window it's displayed in straight into the <filename |
644 role="special">authorized_keys</filename> file.</para> | 689 role="special">authorized_keys</filename> file.</para> |
645 | |
646 </sect2> | 690 </sect2> |
647 <sect2> | 691 <sect2> |
648 <title>Using an authentication agent</title> | 692 <title>Using an authentication agent</title> |
649 | 693 |
650 <para id="x_49d">An authentication agent is a daemon that stores | 694 <para id="x_49d">An authentication agent is a daemon that stores |
661 plain text of your passphrases, in some cases even if your | 705 plain text of your passphrases, in some cases even if your |
662 system has been power-cycled. You should make your own | 706 system has been power-cycled. You should make your own |
663 judgment as to whether this is an acceptable risk. It | 707 judgment as to whether this is an acceptable risk. It |
664 certainly saves a lot of repeated typing.</para> | 708 certainly saves a lot of repeated typing.</para> |
665 | 709 |
666 <para id="x_49f">On Unix-like systems, the agent is called | 710 <itemizedlist> |
667 <command>ssh-agent</command>, and it's often run automatically | 711 <listitem> |
668 for you when you log in. You'll need to use the | 712 <para id="x_49f">On Unix-like systems, the agent is called |
669 <command>ssh-add</command> command to add passphrases to the | 713 <command>ssh-agent</command>, and it's often run |
670 agent's store. On Windows, if you're using PuTTY, the | 714 automatically for you when you log in. You'll need to use |
671 <command>pageant</command> command acts as the agent. It adds | 715 the <command>ssh-add</command> command to add passphrases |
672 an icon to your system tray that will let you manage stored | 716 to the agent's store.</para> |
673 passphrases.</para> | 717 </listitem> |
674 | 718 <listitem> |
675 </sect2> | 719 <para id="x_6a7">On Windows, if you're using TortoiseHg, the |
720 <command>pageant</command> command acts as the agent. As | |
721 with <command>puttygen</command>, you'll need to <ulink | |
722 url="http://www.chiark.greenend.org.uk/%7Esgtatham/putty/download.html">download | |
723 <command>pageant</command></ulink> from the PuTTY web | |
724 site and read <ulink | |
725 url="http://the.earth.li/~sgtatham/putty/0.60/htmldoc/Chapter9.html#pageant">its | |
726 documentation</ulink>. The <command>pageant</command> | |
727 command adds an icon to your system tray that will let you | |
728 manage stored passphrases.</para> | |
729 </listitem> | |
730 </itemizedlist> | |
731 </sect2> | |
732 | |
676 <sect2> | 733 <sect2> |
677 <title>Configuring the server side properly</title> | 734 <title>Configuring the server side properly</title> |
678 | 735 |
679 <para id="x_4a0">Because ssh can be fiddly to set up if you're new to it, | 736 <para id="x_4a0">Because ssh can be fiddly to set up if you're new to it, |
680 there's a variety of things that can go wrong. Add Mercurial | 737 a variety of things can go wrong. Add Mercurial |
681 on top, and there's plenty more scope for head-scratching. | 738 on top, and there's plenty more scope for head-scratching. |
682 Most of these potential problems occur on the server side, not | 739 Most of these potential problems occur on the server side, not |
683 the client side. The good news is that once you've gotten a | 740 the client side. The good news is that once you've gotten a |
684 configuration working, it will usually continue to work | 741 configuration working, it will usually continue to work |
685 indefinitely.</para> | 742 indefinitely.</para> |
819 client sorted out. You should now be able to use Mercurial to | 876 client sorted out. You should now be able to use Mercurial to |
820 access repositories hosted by that username on that server. | 877 access repositories hosted by that username on that server. |
821 If you run into problems with Mercurial and ssh at this point, | 878 If you run into problems with Mercurial and ssh at this point, |
822 try using the <option role="hg-opt-global">--debug</option> | 879 try using the <option role="hg-opt-global">--debug</option> |
823 option to get a clearer picture of what's going on.</para> | 880 option to get a clearer picture of what's going on.</para> |
824 | |
825 </sect2> | 881 </sect2> |
826 <sect2> | 882 <sect2> |
827 <title>Using compression with ssh</title> | 883 <title>Using compression with ssh</title> |
828 | 884 |
829 <para id="x_4b6">Mercurial does not compress data when it uses the ssh | 885 <para id="x_4b6">Mercurial does not compress data when it uses the ssh |
840 | 896 |
841 <para id="x_4b8">Both <command>ssh</command> and <command>plink</command> | 897 <para id="x_4b8">Both <command>ssh</command> and <command>plink</command> |
842 accept a <option role="cmd-opt-ssh">-C</option> option which | 898 accept a <option role="cmd-opt-ssh">-C</option> option which |
843 turns on compression. You can easily edit your <filename | 899 turns on compression. You can easily edit your <filename |
844 role="special">~/.hgrc</filename> to enable compression for | 900 role="special">~/.hgrc</filename> to enable compression for |
845 all of Mercurial's uses of the ssh protocol.</para> | 901 all of Mercurial's uses of the ssh protocol. Here is how to |
902 do so for regular <command>ssh</command> on Unix-like systems, | |
903 for example.</para> | |
846 <programlisting>[ui] | 904 <programlisting>[ui] |
847 ssh = ssh -C</programlisting> | 905 ssh = ssh -C</programlisting> |
848 | 906 |
849 <para id="x_4b9">If you use <command>ssh</command>, you can configure it to | 907 <para id="x_4b9">If you use <command>ssh</command> on a |
850 always use compression when talking to your server. To do | 908 Unix-like system, you can configure it to always use |
851 this, edit your <filename | 909 compression when talking to your server. To do this, edit |
852 role="special">.ssh/config</filename> file (which may not | 910 your <filename role="special">.ssh/config</filename> file |
853 yet exist), as follows.</para> | 911 (which may not yet exist), as follows.</para> |
912 | |
854 <programlisting>Host hg | 913 <programlisting>Host hg |
855 Compression yes | 914 Compression yes |
856 HostName hg.example.com</programlisting> | 915 HostName hg.example.com</programlisting> |
857 <para id="x_4ba">This defines an alias, <literal>hg</literal>. When you | 916 |
858 use it on the <command>ssh</command> command line or in a | 917 <para id="x_4ba">This defines a hostname alias, |
859 Mercurial <literal>ssh</literal>-protocol URL, it will cause | 918 <literal>hg</literal>. When you use that hostname on the |
919 <command>ssh</command> command line or in a Mercurial | |
920 <literal>ssh</literal>-protocol URL, it will cause | |
860 <command>ssh</command> to connect to | 921 <command>ssh</command> to connect to |
861 <literal>hg.example.com</literal> and use compression. This | 922 <literal>hg.example.com</literal> and use compression. This |
862 gives you both a shorter name to type and compression, each of | 923 gives you both a shorter name to type and compression, each of |
863 which is a good thing in its own right.</para> | 924 which is a good thing in its own right.</para> |
864 | |
865 </sect2> | 925 </sect2> |
866 </sect1> | 926 </sect1> |
927 | |
867 <sect1 id="sec:collab:cgi"> | 928 <sect1 id="sec:collab:cgi"> |
868 <title>Serving over HTTP using CGI</title> | 929 <title>Serving over HTTP using CGI</title> |
930 | |
931 <para id="x_6a8">The simplest way to host one or more repositories in a | |
932 permanent way is to use a web server and Mercurial's CGI | |
933 support.</para> | |
869 | 934 |
870 <para id="x_4bb">Depending on how ambitious you are, configuring Mercurial's | 935 <para id="x_4bb">Depending on how ambitious you are, configuring Mercurial's |
871 CGI interface can take anything from a few moments to several | 936 CGI interface can take anything from a few moments to several |
872 hours.</para> | 937 hours.</para> |
873 | 938 |
875 towards a more complex configuration. Even for the most basic | 940 towards a more complex configuration. Even for the most basic |
876 case, you're almost certainly going to need to read and modify | 941 case, you're almost certainly going to need to read and modify |
877 your web server's configuration.</para> | 942 your web server's configuration.</para> |
878 | 943 |
879 <note> | 944 <note> |
880 <para id="x_4bd"> Configuring a web server is a complex, fiddly, and | 945 <title>High pain tolerance required</title> |
881 highly system-dependent activity. I can't possibly give you | 946 |
882 instructions that will cover anything like all of the cases | 947 <para id="x_4bd">Configuring a web server is a complex, fiddly, |
883 you will encounter. Please use your discretion and judgment in | 948 and highly system-dependent activity. I can't possibly give |
884 following the sections below. Be prepared to make plenty of | 949 you instructions that will cover anything like all of the |
885 mistakes, and to spend a lot of time reading your server's | 950 cases you will encounter. Please use your discretion and |
886 error logs.</para> | 951 judgment in following the sections below. Be prepared to make |
952 plenty of mistakes, and to spend a lot of time reading your | |
953 server's error logs.</para> | |
954 | |
955 <para id="x_6a9">If you don't have a strong stomach for tweaking | |
956 configurations over and over, or a compelling need to host | |
957 your own services, you might want to try one of the public | |
958 hosting services that I mentioned earlier.</para> | |
887 </note> | 959 </note> |
888 | 960 |
889 <sect2> | 961 <sect2> |
890 <title>Web server configuration checklist</title> | 962 <title>Web server configuration checklist</title> |
891 | 963 |
892 <para id="x_4be">Before you continue, do take a few moments to check a few | 964 <para id="x_4be">Before you continue, do take a few moments to check a few |
893 aspects of your system's setup.</para> | 965 aspects of your system's setup.</para> |
894 | 966 |
895 <orderedlist> | 967 <orderedlist> |
896 <listitem><para id="x_4bf">Do you have a web server installed at all? | 968 <listitem><para id="x_4bf">Do you have a web server installed |
897 Mac OS X ships with Apache, but many other systems may not | 969 at all? Mac OS X and some Linux distributions ship with |
898 have a web server installed.</para> | 970 Apache, but many other systems may not have a web server |
971 installed.</para> | |
899 </listitem> | 972 </listitem> |
900 <listitem><para id="x_4c0">If you have a web server installed, is it | 973 <listitem><para id="x_4c0">If you have a web server installed, is it |
901 actually running? On most systems, even if one is | 974 actually running? On most systems, even if one is |
902 present, it will be disabled by default.</para> | 975 present, it will be disabled by default.</para> |
903 </listitem> | 976 </listitem> |
915 less capable in some ways than Apache, most of these | 988 less capable in some ways than Apache, most of these |
916 capabilities are not relevant to serving Mercurial | 989 capabilities are not relevant to serving Mercurial |
917 repositories. And <literal>lighttpd</literal> is undeniably | 990 repositories. And <literal>lighttpd</literal> is undeniably |
918 <emphasis>much</emphasis> easier to get started with than | 991 <emphasis>much</emphasis> easier to get started with than |
919 Apache.</para> | 992 Apache.</para> |
920 | 993 </sect2> |
921 </sect2> | 994 |
922 <sect2> | 995 <sect2> |
923 <title>Basic CGI configuration</title> | 996 <title>Basic CGI configuration</title> |
924 | 997 |
925 <para id="x_4c3">On Unix-like systems, it's common for users to have a | 998 <para id="x_4c3">On Unix-like systems, it's common for users to have a |
926 subdirectory named something like <filename | 999 subdirectory named something like <filename |
1046 up.</para> | 1119 up.</para> |
1047 | 1120 |
1048 <para id="x_4d0">At this point, when you try to reload the page, you | 1121 <para id="x_4d0">At this point, when you try to reload the page, you |
1049 should be presented with a nice HTML view of your | 1122 should be presented with a nice HTML view of your |
1050 repository's history. Whew!</para> | 1123 repository's history. Whew!</para> |
1051 | |
1052 </sect3> | 1124 </sect3> |
1125 | |
1053 <sect3> | 1126 <sect3> |
1054 <title>Configuring lighttpd</title> | 1127 <title>Configuring lighttpd</title> |
1055 | 1128 |
1056 <para id="x_4d1">To be exhaustive in my experiments, I tried configuring | 1129 <para id="x_4d1">To be exhaustive in my experiments, I tried configuring |
1057 the increasingly popular <literal>lighttpd</literal> web | 1130 the increasingly popular <literal>lighttpd</literal> web |
1082 configuration problems as I did with Apache. However, I | 1155 configuration problems as I did with Apache. However, I |
1083 found <literal>lighttpd</literal> to be noticeably easier to | 1156 found <literal>lighttpd</literal> to be noticeably easier to |
1084 configure than Apache, even though I've used Apache for over | 1157 configure than Apache, even though I've used Apache for over |
1085 a decade, and this was my first exposure to | 1158 a decade, and this was my first exposure to |
1086 <literal>lighttpd</literal>.</para> | 1159 <literal>lighttpd</literal>.</para> |
1087 | |
1088 </sect3> | 1160 </sect3> |
1089 </sect2> | 1161 </sect2> |
1162 | |
1090 <sect2> | 1163 <sect2> |
1091 <title>Sharing multiple repositories with one CGI script</title> | 1164 <title>Sharing multiple repositories with one CGI script</title> |
1092 | 1165 |
1093 <para id="x_4d4">The <filename role="special">hgweb.cgi</filename> script | 1166 <para id="x_4d4">The <filename role="special">hgweb.cgi</filename> script |
1094 only lets you publish a single repository, which is an | 1167 only lets you publish a single repository, which is an |
1213 <literal>collections</literal> and <literal>paths</literal> | 1286 <literal>collections</literal> and <literal>paths</literal> |
1214 mechanisms simultaneously in a single configuration | 1287 mechanisms simultaneously in a single configuration |
1215 file.</para> | 1288 file.</para> |
1216 | 1289 |
1217 <note> | 1290 <note> |
1218 <para id="x_4e2"> If multiple repositories have the same virtual path, | 1291 <title>Beware duplicate virtual paths</title> |
1219 <filename role="special">hgwebdir.cgi</filename> will not | 1292 |
1220 report an error. Instead, it will behave | 1293 <para id="x_4e2"> If several repositories have the same |
1221 unpredictably.</para> | 1294 virtual path, <filename |
1295 role="special">hgwebdir.cgi</filename> will not report | |
1296 an error. Instead, it will behave unpredictably.</para> | |
1222 </note> | 1297 </note> |
1223 | |
1224 </sect3> | 1298 </sect3> |
1225 </sect2> | 1299 </sect2> |
1300 | |
1226 <sect2> | 1301 <sect2> |
1227 <title>Downloading source archives</title> | 1302 <title>Downloading source archives</title> |
1228 | 1303 |
1229 <para id="x_4e3">Mercurial's web interface lets users download an archive | 1304 <para id="x_4e3">Mercurial's web interface lets users download an archive |
1230 of any revision. This archive will contain a snapshot of the | 1305 of any revision. This archive will contain a snapshot of the |
1233 | 1308 |
1234 <para id="x_4e4">By default, this feature is not enabled. To enable it, | 1309 <para id="x_4e4">By default, this feature is not enabled. To enable it, |
1235 you'll need to add an <envar | 1310 you'll need to add an <envar |
1236 role="rc-item-web">allow_archive</envar> item to the | 1311 role="rc-item-web">allow_archive</envar> item to the |
1237 <literal role="rc-web">web</literal> section of your <filename | 1312 <literal role="rc-web">web</literal> section of your <filename |
1238 role="special">~/.hgrc</filename>.</para> | 1313 role="special">~/.hgrc</filename>; see below for details.</para> |
1239 | |
1240 </sect2> | 1314 </sect2> |
1241 <sect2> | 1315 <sect2> |
1242 <title>Web configuration options</title> | 1316 <title>Web configuration options</title> |
1243 | 1317 |
1244 <para id="x_4e5">Mercurial's web interfaces (the <command role="hg-cmd">hg | 1318 <para id="x_4e5">Mercurial's web interfaces (the <command role="hg-cmd">hg |
1316 the number of rows in each stripe.</para> | 1390 the number of rows in each stripe.</para> |
1317 </listitem> | 1391 </listitem> |
1318 <listitem><para id="x_4f0"><envar | 1392 <listitem><para id="x_4f0"><envar |
1319 role="rc-item-web">style</envar>: Controls the template | 1393 role="rc-item-web">style</envar>: Controls the template |
1320 Mercurial uses to display the web interface. Mercurial | 1394 Mercurial uses to display the web interface. Mercurial |
1321 ships with two web templates, named | 1395 ships with several web templates.</para> |
1322 <literal>default</literal> and <literal>gitweb</literal> | 1396 <itemizedlist> |
1323 (the latter is much more visually attractive). You can | 1397 <listitem> |
1398 <para id="x_6aa"><literal>coal</literal> is monochromatic.</para> | |
1399 </listitem> | |
1400 <listitem> | |
1401 <para id="x_6ab"><literal>gitweb</literal> emulates the visual | |
1402 style of git's web interface.</para> | |
1403 </listitem> | |
1404 <listitem> | |
1405 <para id="x_6ac"><literal>monoblue</literal> uses solid blues and | |
1406 greys.</para> | |
1407 </listitem> | |
1408 <listitem> | |
1409 <para id="x_6ad"><literal>paper</literal> is the default.</para> | |
1410 </listitem> | |
1411 <listitem> | |
1412 <para id="x_6ae"><literal>spartan</literal> was the default for a | |
1413 long time.</para> | |
1414 </listitem> | |
1415 </itemizedlist> | |
1416 <para id="x_6af">You can | |
1324 also specify a custom template of your own; see | 1417 also specify a custom template of your own; see |
1325 <xref linkend="chap:template"/> for details. Here, you can | 1418 <xref linkend="chap:template"/> for details. Here, you can |
1326 see how to enable the <literal>gitweb</literal> | 1419 see how to enable the <literal>gitweb</literal> |
1327 style.</para> | 1420 style.</para> |
1328 <programlisting>[web] | 1421 <programlisting>[web] |
1359 <listitem><para id="x_4f5"><envar role="rc-item-web">name</envar>: | 1452 <listitem><para id="x_4f5"><envar role="rc-item-web">name</envar>: |
1360 String. The name to use for the repository in the web | 1453 String. The name to use for the repository in the web |
1361 interface. This overrides the default name, which is | 1454 interface. This overrides the default name, which is |
1362 the last component of the repository's path.</para> | 1455 the last component of the repository's path.</para> |
1363 </listitem></itemizedlist> | 1456 </listitem></itemizedlist> |
1364 | |
1365 </sect3> | 1457 </sect3> |
1458 | |
1366 <sect3> | 1459 <sect3> |
1367 <title>Options specific to the <command role="hg-cmd">hg | 1460 <title>Options specific to the <command role="hg-cmd">hg |
1368 serve</command> command</title> | 1461 serve</command> command</title> |
1369 | 1462 |
1370 <para id="x_4f6">Some of the items in the <literal | 1463 <para id="x_4f6">Some of the items in the <literal |
1398 </listitem> | 1491 </listitem> |
1399 <listitem><para id="x_4fb"><envar role="rc-item-web">port</envar>: | 1492 <listitem><para id="x_4fb"><envar role="rc-item-web">port</envar>: |
1400 Integer. The TCP port number on which the server should | 1493 Integer. The TCP port number on which the server should |
1401 listen. The default port number used is 8000.</para> | 1494 listen. The default port number used is 8000.</para> |
1402 </listitem></itemizedlist> | 1495 </listitem></itemizedlist> |
1403 | |
1404 </sect3> | 1496 </sect3> |
1497 | |
1405 <sect3> | 1498 <sect3> |
1406 <title>Choosing the right <filename | 1499 <title>Choosing the right <filename |
1407 role="special">~/.hgrc</filename> file to add <literal | 1500 role="special">~/.hgrc</filename> file to add <literal |
1408 role="rc-web">web</literal> items to</title> | 1501 role="rc-web">web</literal> items to</title> |
1409 | 1502 |
1421 role="hg-cmd">hg serve</command> command when you run it. | 1514 role="hg-cmd">hg serve</command> command when you run it. |
1422 To cause CGI scripts to see your settings, either create a | 1515 To cause CGI scripts to see your settings, either create a |
1423 <filename role="special">~/.hgrc</filename> file in the | 1516 <filename role="special">~/.hgrc</filename> file in the |
1424 home directory of the user ID that runs your web server, or | 1517 home directory of the user ID that runs your web server, or |
1425 add those settings to a system-wide <filename | 1518 add those settings to a system-wide <filename |
1426 role="special">~/.hgrc</filename> file.</para> | 1519 role="special">hgrc</filename> file.</para> |
1427 | |
1428 | |
1429 </sect3> | 1520 </sect3> |
1521 </sect2> | |
1522 </sect1> | |
1523 | |
1524 <sect1> | |
1525 <title>System-wide configuration</title> | |
1526 | |
1527 <para id="x_6b0">On Unix-like systems shared by multiple users (such as a | |
1528 server to which people publish changes), it often makes sense to | |
1529 set up some global default behaviors, such as what theme to use | |
1530 in web interfaces.</para> | |
1531 | |
1532 <para id="x_6b1">If a file named <filename>/etc/mercurial/hgrc</filename> | |
1533 exists, Mercurial will read it at startup time and apply any | |
1534 configuration settings it finds in that file. It will also look | |
1535 for files ending in a <literal>.rc</literal> extension in a | |
1536 directory named <filename>/etc/mercurial/hgrc.d</filename>, and | |
1537 apply any configuration settings it finds in each of those | |
1538 files.</para> | |
1539 | |
1540 <sect2> | |
1541 <title>Making Mercurial more trusting</title> | |
1542 | |
1543 <para id="x_6b2">One situation in which a global <filename>hgrc</filename> | |
1544 can be useful is if users are pulling changes owned by other | |
1545 users. By default, Mercurial will not trust most of the | |
1546 configuration items in a <filename>.hg/hgrc</filename> file | |
1547 inside a repository that is owned by a different user. If we | |
1548 clone or pull changes from such a repository, Mercurial will | |
1549 print a warning stating that it does not trust their | |
1550 <filename>.hg/hgrc</filename>.</para> | |
1551 | |
1552 <para id="x_6b3">If everyone in a particular Unix group is on the same team | |
1553 and <emphasis>should</emphasis> trust each other's | |
1554 configuration settings, or we want to trust particular users, | |
1555 we can override Mercurial's skeptical defaults by creating a | |
1556 system-wide <filename>hgrc</filename> file such as the | |
1557 following:</para> | |
1558 | |
1559 <programlisting># Save this as e.g. /etc/mercurial/hgrc.d/trust.rc | |
1560 [trusted] | |
1561 # Trust all entries in any hgrc file owned by the "editors" or | |
1562 # "www-data" groups. | |
1563 groups = editors, www-data | |
1564 | |
1565 # Trust entries in hgrc files owned by the following users. | |
1566 users = apache, bobo | |
1567 </programlisting> | |
1430 </sect2> | 1568 </sect2> |
1431 </sect1> | 1569 </sect1> |
1432 </chapter> | 1570 </chapter> |
1433 | 1571 |
1434 <!-- | 1572 <!-- |