Quickest Way to Validate a Repository URL
Matt Mackall
mpm at selenic.com
Tue Jun 10 20:12:02 UTC 2014
On Tue, 2014-06-10 at 18:45 +0000, Jensen, Aaron wrote:
> What's the quickest way to validate that a URL points to a Mercurial repository? Using the Mercurial commands, the best I could find was the id command:
>
> > hg id https://example.com
>
> Is there a better/faster way?
>
> Another approach would be to make a capabilities request:
>
> > curl https://example.com?cmd=capabilities
>
> And check that it returned an HTTP 200 status.
That'll succeed on pages that don't care about query parameters.
Mercurial speaks two protocols over HTTP, dynamic and static. So our
process looks like:
# (httppeer.py: instance())
try:
# dynamic first
send capabilities request
parse response # _callstream
check content-type is text/plain, application/mercurial-*
...
except:
# fall back to static (statichttprepo.py)
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial
mailing list