Few days ago I started experimenting with Mercurial, and everything went great, until I decided to try writting a small program, that gets the list of repositories and lists of changeset IDs for each repository from a remote server, allows the user to pick repository and changeset, clones it and updates to the chosen revision. This led to two questions:
- Is there a way to get a list of repositories from server (besides parsing HTML)?
- Is there a way to get information, such as tags, branches, etc. about one of the repositories, without actually cloning it first?
No, Mercurial is designed so that you need a local repository for almost all commands. The only built-in command that will give you information about a remote repository is
hg id
:To get hold of more information you can sometimes exploit the
raw
template forhgweb
:That requires that the host is running the
hgweb
CGI script that comes with Mercurial. For a site like Bitbucket you would need to use their API.Finally, if you can enable extensions on the remote repository, then it's possible to write an extension that exposes the information you want in a parsable format. I once wrote such an extension as a demo.