Search code examples
urlmercurialmercurial-subrepos

Use Mercurial path as just part of URL


I am messing around with the paths section of my .hgrc, and have default and default:pushurl set. I am adding another path simply called def for now, that is essentially http://example.com/hg. Each repository, however, is a subdirectory of this site, i.e. http://example.com/hg/myrepo. Is there some way to push and pull using def as the first part of the URL? I'd imagine it would look something like hg pull def/myrepo, but this particular syntax doesn't work of course. Thanks in advance.


Solution

  • Yes, this is possible with the Schemes extension.

    Add the following to your .hgrc:

    [extensions]
    hgext.schemes=
    
    [schemes]
    def = http://example.com/hg/
    

    Then you'll be able to do hg push def://myrepo.