Mercurial > hg-git-serve
comparison src/hgext3rd/hggit_serve/__init__.py @ 14:959ef686193f
Add user-facing documentation.
| author | Paul Fisher <paul@pfish.zone> |
|---|---|
| date | Fri, 20 Feb 2026 21:05:31 -0500 |
| parents | 00bdfac5416c |
| children | a70f387ab3cd |
comparison
equal
deleted
inserted
replaced
| 13:00bdfac5416c | 14:959ef686193f |
|---|---|
| 11 | 11 |
| 12 then in another terminal:: | 12 then in another terminal:: |
| 13 | 13 |
| 14 $ git clone http://localhost:8000/ # or wherever 'hg serve' ran | 14 $ git clone http://localhost:8000/ # or wherever 'hg serve' ran |
| 15 | 15 |
| 16 Git pulling and pushing are protected by the same ACL as regular Mercurial | |
| 17 interactions through :hg:`serve`, with the same authentication mechanism. | |
| 18 | |
| 16 This works atop the ``hggit`` extension, and (unlike ``hggit``) requires that | 19 This works atop the ``hggit`` extension, and (unlike ``hggit``) requires that |
| 17 you have Git installed (maybe this will go away in a future version?). | 20 you have Git installed (maybe this will go away in a future version?). |
| 18 | 21 |
| 19 Setup | 22 Setup and configuration |
| 20 ----- | 23 ----------------------- |
| 21 | 24 |
| 22 TODO | 25 Enable the ``hggit_serve`` extension in one of the many Mercurial configuration |
| 26 files available to you. | |
| 27 | |
| 28 Exporting the repository | |
| 29 ^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 30 | |
| 31 Serving a Git version of the repository requires that the Git version | |
| 32 be exported from the repository using ``hggit``. This generally exists for | |
| 33 a repository cloned from a Git source, but does not exist for a repository | |
| 34 created entirely within Mercurial. Once a repository has been exported to Git, | |
| 35 ``hggit_serve`` will automatically update the Git version of the repository | |
| 36 every time new commits are added to the Mercurial side. | |
| 37 | |
| 38 This may be an expensive operation the first time an export is performed, | |
| 39 but after the first export, further exports only have to add new revisions | |
| 40 and make incremental updates. | |
| 41 | |
| 42 By default, ``hggit_serve`` will only export Git versions of repositories | |
| 43 that have already been :hg:`git-export`ed before. You can control this behavior | |
| 44 in :hg:`config`:: | |
| 45 | |
| 46 [hggit-serve] | |
| 47 | |
| 48 auto-export = default | |
| 49 # auto-export: when a repository is written to, update the Git export, | |
| 50 # but only if one exists. You will have to run | |
| 51 # | |
| 52 # hg git-export | |
| 53 # | |
| 54 # once on each repository you wish to make available to Git. | |
| 55 | |
| 56 auto-export = always | |
| 57 # Whenever a repository is written to, export a Git copy of the repository, | |
| 58 # even if one doesn't exist yet. | |
| 59 | |
| 60 auto-export = never | |
| 61 # Never automatically export a Git copy of the repository, not even to update | |
| 62 # the existing export. The Git version will only be updated when you run | |
| 63 # hg git-export or otherwise interact with Git via hggit. | |
| 64 | |
| 65 Handling branches | |
| 66 ^^^^^^^^^^^^^^^^^ | |
| 67 | |
| 68 Git doesn't have an implicit ``tip`` revision like Mercurial does. | |
| 69 Instead, there is a HEAD reference which tells the client which version | |
| 70 to check out. | |
| 71 | |
| 72 ``hggit_serve`` will, by default, look in the following places to decide | |
| 73 what Git branch to use as the HEAD: | |
| 74 | |
| 75 #. The currently active Mercurial bookmark. | |
| 76 #. The bookmark named ``@``. (See :hg:`bookmarks` for details.) | |
| 77 #. The repository ``tip``. | |
| 78 | |
| 79 If ``@`` or the ``tip`` is used to select the active Git branch, | |
| 80 then ``hggit_serve`` needs to pick a branch name to use. | |
| 81 This can be configured with the ``default-branch`` setting. | |
| 82 | |
| 83 [hggit-serve] | |
| 84 | |
| 85 default-branch = main | |
| 86 # Set what the name of the default branch to check out will be. | |
| 87 # If unset, the name "default" will be used. | |
| 23 """ | 88 """ |
| 24 | 89 |
| 25 from __future__ import annotations | 90 from __future__ import annotations |
| 26 | 91 |
| 27 from ._export import uipopulate | 92 from ._export import uipopulate |
