Mercurial Support

Tags: mercurial

One of the major feature, implemented in EmForge-0.26 is No InterWiki reference defined in properties for Wiki called "ttp"! support. This project created here only for including demo of mercurial-based repository browser.

Mercurial support done as part of Extended Maven-SCM project by extending standard maven-scm-provider-hg with 4 extended "remote commands".

How to configure EmForge to use Mercurial

To be able to browse Mercurial repository from EmForge you need:
  1. Install latest version of EmForge (Mercurial Support added in EmForge-0.26)
  2. Have mercurial binaries be installed and correctly configured on same computer as EmForge is installed (EmForge used command-line hg command to work with repository). Look installation details here: http://www.selenic.com/mercurial/wiki/index.cgi/TutorialInstall
  3. Have local mercurial repository. EmForge is not able to work with remote repositories, only local repositories supported (repositories, placed on same computer where EmForge is installed). You can always clone remote repository to local computer.

As soon, as you will have everything installed, you can create new project and EmForge and set something like

scm:hg:/path/to/your/repository
as repository path in project settings. After it browser will be available from "Sources" link on project page, like it is available for this project: http://www.emforge.org/project/MercurialSupport/browser

Technical details of implementation

Here described how remote commands implemented

rlist

rlist command should return list of files under some folder in specified revision (optional, if missed - tip version is used) in remote repository.

To get list of files in specified revision manifest command it used:

hg manifest -rxxx 
manifest command returned ALL files in repository, so, we should filter returned list to get only files under specified folder.

Since for each file we need to return also information about it's latest revision (date, author, comment) we call

hg -rxxx -l1 path/to/file
to get latests revision information for each file.

This way looks not to be very optimal - but - I do not found way to get list of files in some revision under only some folder (not whole repository like manifest returned), as well as get latest revision information for bundle of files (not for each individual file)

rlog

for getting history for some path (folder or file) we call
hg log /some/path
and returns this information

rcat

for getting file contents we calls 2 commands:
  • first of all - hg cat command to get file content
  • additionally "hg log" called to get latest revision information
hg -rxxx cat /path/to/file
hg -rxxx -l1 /path/to/file

rinfo

to get information about some specific file we get file information (folder/normal file, name and so on) from file-system (since we are working with local repository), and call "hg log" to get latest revision info

This way looks not too good (I will prefer to get informatino about specific file by using hg commands) - but I do not found any way to do it via hg commands

0 Attachments 0 Attachments
3815 Views

Average (0 Votes)