Is it possible to "read" mercury repositories from the browser using javascript?

I want to be able to list files and directories of a mercury repository in a web browser using javascript.

+2


source to share


1 answer


If you're looking for parsing the output of hgweb (a web interface for mercury repositories) try adding ?style=raw

to / file / URLs to get some easily parsed text output:

This url: http://hg.intevation.org/mercurial/crew/file/tip/?style=raw

Gets this output

drwxr-xr-x contrib
drwxr-xr-x doc
drwxr-xr-x help
drwxr-xr-x hgext
drwxr-xr-x i18n
drwxr-xr-x mercurial
drwxr-xr-x templates
drwxr-xr-x tests
-rw-r--r-- 565 .hgignore
-rw-r--r-- 2168 .hgsigs
-rw-r--r-- 1291 .hgtags
-rw-r--r-- 1663 CONTRIBUTORS
-rw-r--r-- 17992 COPYING
-rw-r--r-- 3330 Makefile
-rw-r--r-- 306 README
-rwxr-xr-x 787 hg
-rwxr-xr-x 1251 hgeditor
-rw-r--r-- 886 hgweb.cgi
-rw-r--r-- 2280 hgwebdir.cgi
-rw-r--r-- 9521 setup.py

      



which is the root of the mercury repo. To drop down a directory, just add it to the url, for example:

http://hg.intevation.org/mercurial/crew/file/tip/doc/?style=raw

You can get the contents of the files in the same way.

+1


source







All Articles