hg serve for subrepos

926 views Asked by At

I have a repo with subrepos, and would like to do hg serve.

On other computer, I tried

hg clone http://address:8000/ new_repo

Scenario 1: when my original repo had, in .hgsub, lines of the form:

sub_repo_1 = sub_repo_1
sub_repo_2 = sub_repo_2

I got on other computer:

Requesting all changes
adding changesets
adding manifests
...
updating to branch default
abort: HTTP Error 404: Not Found

(the serve computer just waits after that)

(and only the sub_repo_1 inside new_repo. I have tried update, pull... with errors)

I have tried to actually clone separately sub_repo_2, and kept getting Error 404 (bot on sending and receiving computer).

Scenario 2: Same thing happened when I replaced in .hgsub the lines with

sub_repo_1 = http://address/sub_repo_1
sub_repo_2 = http://address/sub_repo_2

Is hg serve unable to serve subrepos ? Or - what am I doing wrong ?

Note: I have updated the hgrc files inside the subrepos to match the paths in the .hgsub, each time.

3

There are 3 answers

0
Denis Blanchette On

You can use TortoiseHG to host a mercurial server for a repository that has subrepositories. TortoiseHG actually calls hg serve with a different web.config file it creates.

To host using TortoiseHG, go to Repository -> Web Server... in TortoiseHG Workbench.

1
Luiggi Mendoza On

hg serve works with subrepos. The thing is that hg serve doesn't automagically recognize that your repo contains subrepos.

Supposing that there's the following folder structure

- repo
  - subrepo1
    + file1.txt
  - subrepo2
    + file2.txt
    + file3.txt

Where repo is the main repository and subrepo1 and subrepo2 are two subrepositories of repo:

  1. Create a web configuration file inside repo. Do not add it in version control. I called it .hgwebconf, you can change the name if you want.
  2. Configure all paths for subrepos in this file. Add the following content:

    [paths]
    /repo = ./* #all repos will be known by the url /repo
    /repo/subrepo1 = subrepo1 #adding subrepo1 to be available in hg serve
    /repo/subrepo2 = subrepo2 #similar to above
    
  3. Execute hg serve using --web-conf property to use the web configuration file created for the paths. Here's an example:

    hg serve --web-conf .hgwebconf <other configurations you use ...>
    

And that's it. Now you could access to your server vía http, clone your repo or any subrepo and work with it.

0
Keugyeol On

I am using HgService to host the repositories and it's the solution I found working.

If you are using HgService, you'll need to edit the web.config file and restart the service.

If the [paths] in the web.config is setup like this:

[paths]
remote_repo = "path/to/remote_repo"

Add the double star (**) to the path like this:

[paths]
remote_repo = "path/to/remote_repo/**"