2 <article xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="en" |
2 <article xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="en" |
3 xmlns:xlink="http://www.w3.org/1999/xlink"> |
3 xmlns:xlink="http://www.w3.org/1999/xlink"> |
4 <info> |
4 <info> |
5 <title>Sharing Mercurial repositories with mercurial-server</title> |
5 <title>Sharing Mercurial repositories with mercurial-server</title> |
6 <author><firstname>Paul</firstname><surname>Crowley</surname></author> |
6 <author><firstname>Paul</firstname><surname>Crowley</surname></author> |
7 <copyright><year>2009</year><holder>Paul Crowley, LShift Ltd</holder></copyright> |
7 <copyright><year>2008-2010</year><holder>Paul Crowley, LShift Ltd</holder></copyright> |
8 </info> |
8 </info> |
9 <section> |
9 <section> |
10 <title>About mercurial-server</title> |
10 <title>About mercurial-server</title> |
11 <para> |
11 <para> |
12 Home page: <link xlink:href="http://www.lshift.net/mercurial-server.html"/> |
12 Home page: <link xlink:href="http://www.lshift.net/mercurial-server.html"/> |
418 </listitem> |
418 </listitem> |
419 </itemizedlist> |
419 </itemizedlist> |
420 </section> |
420 </section> |
421 </section> |
421 </section> |
422 <section> |
422 <section> |
|
423 <title>In detail</title> |
|
424 <section> |
423 <title>How mercurial-server works</title> |
425 <title>How mercurial-server works</title> |
424 <para> |
426 <para> |
425 All of the repositories controlled by mercurial-server are owned by a |
427 All of the repositories controlled by mercurial-server are owned by a |
426 single user, the <systemitem |
428 single user, the <systemitem |
427 class="username">hg</systemitem> user, which is why all URLs for |
429 class="username">hg</systemitem> user, which is why all URLs for |
473 operation. |
475 operation. |
474 </para> |
476 </para> |
475 <para> |
477 <para> |
476 However, while the first paragraph holds no matter what bugs |
478 However, while the first paragraph holds no matter what bugs |
477 mercurial-server contains, the second depends on the relevant code being |
479 mercurial-server contains, the second depends on the relevant code being |
478 correct; though the entire codebase is short, mercurial-server is a fairly |
480 correct; though the entire codebase is short, like all software mercurial-server may harbour bugs. Backups are essential! |
479 new program and may harbour bugs. Backups are essential! |
481 </para> |
480 </para> |
482 </section> |
481 </section> |
483 <section> |
482 <section> |
484 <title>Logging</title> |
483 <title>Legalese</title> |
485 <para> |
|
486 Every successful access is logged in a file called |
|
487 <filename>~hg/repos/<replaceable>repository</replaceable>/.hg/mercurial-server.log</filename>. This file is in YAML format for easy parsing, but if you don't like YAML, simply treat each line as a JSON data structure prepended with <code>- </code>. The log records the time as a |
|
488 UTC ISO 8601 time, the operation ("push" or "pull"), the path to the key as |
|
489 used in the access rules, the SSH connection information (including the source IP address), and the hex changeset IDs. |
|
490 </para> |
|
491 </section> |
|
492 <section> |
|
493 <title>Paths and configuration</title> |
|
494 <para> |
|
495 For security reasons, all mercurial-server code runs as the <systemitem |
|
496 class="username">hg</systemitem> user. The first thing this code reads when it starts is <filename>~hg/.mercurial-server</filename>; if this file is absent or corrupt the code won't run. This file specifies all of the file paths that mercurial-server uses. In particular, it specifies that mercurial-server always uses <code>HGRCPATH = /etc/mercurial-server/remote-hgrc.d</code> for remote operations, overriding any system <code>HGRCPATH</code>. |
|
497 </para> |
|
498 <para> |
|
499 By creating such a file with suitable entries, you can run mercurial-server as a user other than <systemitem |
|
500 class="username">hg</systemitem>, or install it without root privileges; however I strongly recommend that if you need to do this, you use a user account that is used for no other purpose, and take the time to thoroughly understand how mercurial-server works before you attempt it. |
|
501 </para> |
|
502 </section> |
|
503 <section> |
|
504 <title>License</title> |
484 <para> |
505 <para> |
485 This program is free software; you can redistribute it and/or modify it |
506 This program is free software; you can redistribute it and/or modify it |
486 under the terms of the GNU General Public License as published by the Free |
507 under the terms of the GNU General Public License as published by the Free |
487 Software Foundation; either version 2 of the License, or (at your option) |
508 Software Foundation; either version 2 of the License, or (at your option) |
488 any later version. |
509 any later version. |