Add support for Mercurial subrepos

David Carr avatarDavid Carr created an issue

A recent mailing list post by the Mercurial project leader on the topic of how to properly support subrepos in hosting solutions:

http://www.selenic.com/pipermail/mercurial-devel/2011-October/034728.html

Comments (26)

  1. Sebastian Sdorra

    I have done some tests with mercurial subrepos. I think the best way for scm-manager is to create a main repository and create a separate repository for each subrepo. For example:

    java -jar scm-cli-client.jar create-repository -t hg -n main
    java -jar scm-cli-client.jar create-repository -t hg -n module-1
    hg clone http://localhost:8081/scm/hg/main
    cd main
    echo 'module-1 = http://localhost:8081/scm/hg/module-1' > .hgsub
    hg add .hgsub
    hg commit -m 'added module-1 as submodule'
    hg push
    

    This works without any change to scm-manager. The only thing that does not work is the repository browser, it does not show the sub repositories.

  2. David Carr

    Note that to fully support subrepos, you need to be able to handle entries in .hgsub of the form:

    module-1 = module-1

    This means that when pushing to (for example) http://localhost:8081/scm/hg/main, mercurial will also attempt to push to http://localhost:8081/scm/hg/main/module-1. My expectation is that this currently will break with SCM Manager.

    Matt Mackall's suggestion in the mailing list post above is that hosting solutions support this by providing a way for users to configure aliases for repositories. So, for example, you might create a separate repository for the "module-1" repository in SCM Manager as you suggested, but then also somehow tell SCM Manager "main/module-1 is an alias for module-1". At that point, "hg push" with a trivial subrepo configuration should work.

  3. Sebastian Sdorra
    • changed version to 1.10

    I've thought about it and have come to the conclusion that the solution of comment 2 is the best for scm-manager. For those they have already "nested" repositories i will create a plugin. This plugin should give the user the possibility to define an alias for sub repositories, as you described in comment 3. I would like to outsource this function to a plugin, to keep the ui as simple as possible. I will also work on the repository browser to support sub repositories.

  4. Anonymous

    Is there a small tutorial out there on how to use subrepos with SCM-Manager? (My first steps were not crowned by success. :-( )

  5. Eugen Sl

    The plugin http://download.scm-manager.org/issues/67/scm-server-app.2011112801.zip does not work for nested subrepo with trivial links in the file .hgsub (subrepo = subrepo).

    SCM-server does not work with repositories that already invested subrepo. In my opinion you just do not scan the repository to have nested repositories.

    If possible, do so in the Mercurial Web Server (hg serv command). After you import the repository with subrepo want to see the following:

    main: repo1 repo2 ...

    repo1: subrepo1 subrepo2 ...

    repo1/subrepo2: subsubrepo1 subsubrepo2 ...

  6. Eugen Sl

    Can i make the following:

    java -jar scm-cli-client.jar create-repository -t hg -n main

    java -jar scm-cli-client.jar create-repository -t hg -n main/module-1

    java -jar scm-cli-client.jar create-repository -t hg -n main/module-2

    hg clone http://localhost:8081/scm/hg/main

    cd main

    echo 'module-1 = module-1' > .hgsub

    echo 'module-2 = module-2' >> .hgsub

    hg add .hgsub

    hg commit -m 'added module-1 and module-2 as subrepositories'

    hg push

  7. Sebastian Sdorra

    No, this is not possible but you can do the following:

    $ java -jar scm-cli-client.jar create-repository -t hg -n project/main
    $ java -jar scm-cli-client.jar create-repository -t hg -n project/module-1
    $ java -jar scm-cli-client.jar create-repository -t hg -n project/module-2
    $ hg clone http://localhost:8081/scm/hg/project/main
    $ cd main
    $ echo 'module-1 = http://localhost:8081/scm/hg/project/module-1'
    $ echo 'module-2 = http://localhost:8081/scm/hg/project/module-2'
    $ hg commit -m 'added module-1 and module-2 as subrepositories'
    $ hg push
    
  8. Eugen Sl

    All this is important for sequential synchronization of clones. In your example, is obtained only in parallel: all subrepo will refer to the same store.

  9. Eugen Sl

    Why can not the search process repositories have already found the repository as a folder? (Import Repositories)

    I think it would solve my problem.

  10. Sebastian Sdorra

    Structures like, the following are not allowed in scm-manager:

    This is not possible, because of some problems with permissions. But you can do the following:

    In that case your repository is at project/main and your sub repositories are at project/module-1 and project/module-2. This is a king of hierarchy view on the server. If you have more questions, please let us move this discussion to the mailing list (https://groups.google.com/forum/?fromgroups#!forum/scmmanager), because this is not the right place for a discusion.

  11. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.