Java – get a file from a remote mercurial repository

Is there a way to programmatically download a single file from a Java Remote mercurial repository? I asked a very similar question regulating git; Now I wish I could do something similar

>I prefer a solution that uses as little bandwidth as possible. It's best to download only a single file I don't need to browse the repository. I already have the path to the file. > I don't care about the history of the file. I just want the latest version. > Only the solution of printing files to output is also very good, of course - it doesn't really want to save files to disk, I can do it myself. > I prefer solutions that do not rely on other applications (such as installing a mercurial client on the machine) A Java library containing a mercurial client implementation itself would be optimal However, if there is no other method, I would be happy to call Hg

From what I know about how mercurial works - allowing only local knowledge bases to work - this may be problematic; However, since I can use a similar git SCM to do this, I hope to have a mercurial solution

Solution

The mercurial wire protocol does not have a command to read a single file from a remote repository This is why Hg command - line clients cannot do the same The idea is that you should always do a local clone for such things

However, various web interfaces usually have ways to obtain file content For example, for the bitbucket repository, the URL is as follows:

http://bitbucket.org/<user>/<project>/raw/<revision>/<filename>

For the Hg service web interface, the web address is as follows:

http://<host>:<port>/raw-file/<revision>/<filename>
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>