Mercurial: get information about repositories without cloning them

后端 未结 1 813
野性不改
野性不改 2021-02-13 21:12

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

1条回答
  •  日久生厌
    2021-02-13 21:42

    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:

    $ hg id https://bitbucket.org/aragost/javahg/
    3b2711b26dbd
    

    To get hold of more information you can sometimes exploit the raw template for hgweb:

    $ wget -q -O - 'https://www.mercurial-scm.org/repo/hg/tags?style=raw' | head 
    tip     a3a36bcf122e2ea4edbbe4ac44da59446cf0ee07
    4.2.1   c850f0ed54c1d42f9aa079ad528f8127e5775217
    4.2     bb96d4a497432722623ae60d9bc734a1e360179e
    4.2-rc  616e788321cc4ae9975b7f0c54c849f36d82182b
    4.1.3   77eaf9539499a1b8be259ffe7ada787d07857f80
    4.1.2   ed5b25874d998ababb181a939dd37a16ea644435
    4.1.1   25703b624d27e3917d978af56d6ad59331e0464a
    4.1     e1526da1e6d84e03146151c9b6e6950fe9a83d7d
    4.1-rc  a1dd2c0c479e0550040542e392e87bc91262517e
    4.0.2   e69874dc1f4e142746ff3df91e678a09c6fc208c
    

    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.

    0 讨论(0)
提交回复
热议问题