annotate src/hgext3rd/hggit_serve/__init__.py @ 13:00bdfac5416c

Create Git SSH commands and add some documentation. Also cleanup. - Adds git-upload-pack and git-receive-pack as hg subcommands, to be run on the server side by git push/pull. - Starts on documentation. - Cleans up a lot of stuff.
author Paul Fisher <paul@pfish.zone>
date Thu, 19 Feb 2026 01:13:56 -0500
parents f630d9904ea7
children 959ef686193f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13
00bdfac5416c Create Git SSH commands and add some documentation. Also cleanup.
Paul Fisher <paul@pfish.zone>
parents: 12
diff changeset
1 r"""hg serve the Git world
00bdfac5416c Create Git SSH commands and add some documentation. Also cleanup.
Paul Fisher <paul@pfish.zone>
parents: 12
diff changeset
2
00bdfac5416c Create Git SSH commands and add some documentation. Also cleanup.
Paul Fisher <paul@pfish.zone>
parents: 12
diff changeset
3 This extension lets you serve Git users from a Mercurial world. After some
00bdfac5416c Create Git SSH commands and add some documentation. Also cleanup.
Paul Fisher <paul@pfish.zone>
parents: 12
diff changeset
4 very basic setup, Git users can pull from *and push to* your repository
00bdfac5416c Create Git SSH commands and add some documentation. Also cleanup.
Paul Fisher <paul@pfish.zone>
parents: 12
diff changeset
5 as if it were any other Git repository.
00bdfac5416c Create Git SSH commands and add some documentation. Also cleanup.
Paul Fisher <paul@pfish.zone>
parents: 12
diff changeset
6
00bdfac5416c Create Git SSH commands and add some documentation. Also cleanup.
Paul Fisher <paul@pfish.zone>
parents: 12
diff changeset
7 For a quick example::
00bdfac5416c Create Git SSH commands and add some documentation. Also cleanup.
Paul Fisher <paul@pfish.zone>
parents: 12
diff changeset
8
00bdfac5416c Create Git SSH commands and add some documentation. Also cleanup.
Paul Fisher <paul@pfish.zone>
parents: 12
diff changeset
9 $ hg git-export
00bdfac5416c Create Git SSH commands and add some documentation. Also cleanup.
Paul Fisher <paul@pfish.zone>
parents: 12
diff changeset
10 $ hg serve
00bdfac5416c Create Git SSH commands and add some documentation. Also cleanup.
Paul Fisher <paul@pfish.zone>
parents: 12
diff changeset
11
00bdfac5416c Create Git SSH commands and add some documentation. Also cleanup.
Paul Fisher <paul@pfish.zone>
parents: 12
diff changeset
12 then in another terminal::
00bdfac5416c Create Git SSH commands and add some documentation. Also cleanup.
Paul Fisher <paul@pfish.zone>
parents: 12
diff changeset
13
00bdfac5416c Create Git SSH commands and add some documentation. Also cleanup.
Paul Fisher <paul@pfish.zone>
parents: 12
diff changeset
14 $ git clone http://localhost:8000/ # or wherever 'hg serve' ran
00bdfac5416c Create Git SSH commands and add some documentation. Also cleanup.
Paul Fisher <paul@pfish.zone>
parents: 12
diff changeset
15
00bdfac5416c Create Git SSH commands and add some documentation. Also cleanup.
Paul Fisher <paul@pfish.zone>
parents: 12
diff changeset
16 This works atop the ``hggit`` extension, and (unlike ``hggit``) requires that
00bdfac5416c Create Git SSH commands and add some documentation. Also cleanup.
Paul Fisher <paul@pfish.zone>
parents: 12
diff changeset
17 you have Git installed (maybe this will go away in a future version?).
00bdfac5416c Create Git SSH commands and add some documentation. Also cleanup.
Paul Fisher <paul@pfish.zone>
parents: 12
diff changeset
18
00bdfac5416c Create Git SSH commands and add some documentation. Also cleanup.
Paul Fisher <paul@pfish.zone>
parents: 12
diff changeset
19 Setup
00bdfac5416c Create Git SSH commands and add some documentation. Also cleanup.
Paul Fisher <paul@pfish.zone>
parents: 12
diff changeset
20 -----
00bdfac5416c Create Git SSH commands and add some documentation. Also cleanup.
Paul Fisher <paul@pfish.zone>
parents: 12
diff changeset
21
00bdfac5416c Create Git SSH commands and add some documentation. Also cleanup.
Paul Fisher <paul@pfish.zone>
parents: 12
diff changeset
22 TODO
00bdfac5416c Create Git SSH commands and add some documentation. Also cleanup.
Paul Fisher <paul@pfish.zone>
parents: 12
diff changeset
23 """
00bdfac5416c Create Git SSH commands and add some documentation. Also cleanup.
Paul Fisher <paul@pfish.zone>
parents: 12
diff changeset
24
1
a39dd69b8972 Create a more-or-less real package and make it work (?)
Paul Fisher <paul@pfish.zone>
parents: 0
diff changeset
25 from __future__ import annotations
a39dd69b8972 Create a more-or-less real package and make it work (?)
Paul Fisher <paul@pfish.zone>
parents: 0
diff changeset
26
13
00bdfac5416c Create Git SSH commands and add some documentation. Also cleanup.
Paul Fisher <paul@pfish.zone>
parents: 12
diff changeset
27 from ._export import uipopulate
00bdfac5416c Create Git SSH commands and add some documentation. Also cleanup.
Paul Fisher <paul@pfish.zone>
parents: 12
diff changeset
28 from ._http import uisetup
00bdfac5416c Create Git SSH commands and add some documentation. Also cleanup.
Paul Fisher <paul@pfish.zone>
parents: 12
diff changeset
29 from ._ssh import cmdtable
1
a39dd69b8972 Create a more-or-less real package and make it work (?)
Paul Fisher <paul@pfish.zone>
parents: 0
diff changeset
30
8
fe3c9fae4d4d Add support for pushes, and improve authentication.
Paul Fisher <paul@pfish.zone>
parents: 7
diff changeset
31 #
1
a39dd69b8972 Create a more-or-less real package and make it work (?)
Paul Fisher <paul@pfish.zone>
parents: 0
diff changeset
32 # Interfacing with Mercurial
8
fe3c9fae4d4d Add support for pushes, and improve authentication.
Paul Fisher <paul@pfish.zone>
parents: 7
diff changeset
33 #
1
a39dd69b8972 Create a more-or-less real package and make it work (?)
Paul Fisher <paul@pfish.zone>
parents: 0
diff changeset
34
13
00bdfac5416c Create Git SSH commands and add some documentation. Also cleanup.
Paul Fisher <paul@pfish.zone>
parents: 12
diff changeset
35 __version__ = '0.3.0'
6
7113e0ac3662 fix refs on git-export; clean up how gitserve export works.
Paul Fisher <paul@pfish.zone>
parents: 5
diff changeset
36 testedwith = b'7.1 7.2'
8
fe3c9fae4d4d Add support for pushes, and improve authentication.
Paul Fisher <paul@pfish.zone>
parents: 7
diff changeset
37 minimumhgversion = b'7.1'
1
a39dd69b8972 Create a more-or-less real package and make it work (?)
Paul Fisher <paul@pfish.zone>
parents: 0
diff changeset
38
a39dd69b8972 Create a more-or-less real package and make it work (?)
Paul Fisher <paul@pfish.zone>
parents: 0
diff changeset
39
6
7113e0ac3662 fix refs on git-export; clean up how gitserve export works.
Paul Fisher <paul@pfish.zone>
parents: 5
diff changeset
40 __all__ = (
7113e0ac3662 fix refs on git-export; clean up how gitserve export works.
Paul Fisher <paul@pfish.zone>
parents: 5
diff changeset
41 '__version__',
13
00bdfac5416c Create Git SSH commands and add some documentation. Also cleanup.
Paul Fisher <paul@pfish.zone>
parents: 12
diff changeset
42 'cmdtable',
8
fe3c9fae4d4d Add support for pushes, and improve authentication.
Paul Fisher <paul@pfish.zone>
parents: 7
diff changeset
43 'minimumhgversion',
6
7113e0ac3662 fix refs on git-export; clean up how gitserve export works.
Paul Fisher <paul@pfish.zone>
parents: 5
diff changeset
44 'testedwith',
7113e0ac3662 fix refs on git-export; clean up how gitserve export works.
Paul Fisher <paul@pfish.zone>
parents: 5
diff changeset
45 'uipopulate',
7113e0ac3662 fix refs on git-export; clean up how gitserve export works.
Paul Fisher <paul@pfish.zone>
parents: 5
diff changeset
46 'uisetup',
7113e0ac3662 fix refs on git-export; clean up how gitserve export works.
Paul Fisher <paul@pfish.zone>
parents: 5
diff changeset
47 )