How I installed the Mercurial Forest extension on my windows test machine.

The source code for OpenJDK is now available in Mercurial repositories. These repositories are organized into mercurial forests. If you are eager to work on the OpenJDK code, you will want to install the forest extension for Mercurial. Here is how I did it on my windows test machine.

Disclaimer: this is a description of the steps I followed on my test machine: I can't guarantee that it will work for yours...

Installing Mercurial on Windows

Installing Mercurial on my Windows machine was quite easy. I got the Binary Packages from the selenic.com website and followed the instructions. I had already cygwin installed. I followed the easiest path which was to install Mercurial in c:\\Mercurial.

Installing the forest extension

I simply cloned the forest repository in c:\\Mercurial. In a cygwin terminal:

  cd c:/Mercurial
  hg clone http://hg.akoha.org/hgforest hgforest

Then I edited c:/Mercurial/Mercurial.ini and added the lines:

  [extensions]
  forest=c:/Mercurial/hgforest/forest.py

as documented in the Mercurial Wiki.

Choosing a merge tool

There are many merge tools that you can use with mercurial. Not knowing any of them I simply picked one, kdiff3, and I followed the instructions given in the wiki.

kdiff3 on windows

At the time I did this investigation, I got kdiff3 from sourceforge.net - where I chose to download KDiff3Setup_0.9.92-2.exe. Then I followed the instructions given on the Mercurial Wiki. I created a c:/Mercurial/kmerge.bat file in which I copy pasted:


@echo off
setlocal
:: Look in the registry for KDiff3 location
for /f "skip=2 tokens=3\*" %%A in (
    '"reg query "HKEY_CURRENT_USER\\SOFTWARE\\KDiff3" /ve 2> nul"' ) do set KDiff3Path=%%B
if "%KDiff3Path%"=="" (goto :notfound) else (goto :kdiff3)

:kdiff3
"%KDiff3Path%\\kdiff3.exe" --auto --L1 Base --L2 Local --L3 Other %2 %1 %3 -o %1
if not errorlevel 0 (exit /b 1) else (exit /b 0)

:notfound
echo hgmerge: cannot find KDiff3 location in the registry.
exit /b 1

as shown in the Mercurial Wiki.

Note: The code above is borrowed from the excellent Mercurial Wiki - I am not its author. Thanks to whoever provided this!
There's also some additional info on the Mercurial Wiki so you might want to look this up directly at the source.

Then I edited c:/Mercurial/Mercurial.ini and added the lines:

  [ui]
  merge = kmerge

I was then ready to test kdiff3 using my merge test case. It worked beautifully, except that if you interrupted the tool (e.g. exit without saving) - it left some temporary files in your repository working dir.

So if you're eager to work with OpenJDK sources, I hope this story will help you!

cheers
-- daniel

PS: whatever you do with openJDK, make sure to visit Kelly's excellent posts:

Update: Ted Neward has also written an excellent post on getting OpenJDK build environment for windows: Let the JDK Hacking Begin...

Update 2: Volker Simonis has also an excellent two parts post (part I) and (part II) on building and running the OpenJDK on Linux/x86.

Update 3: Lars Werstergren has also a very nice Beginner's Guide to OpenJDK. Thanks to Brad Wetmore for pointing this out.

Comments:

Hi Daniel --
I am trying to install the forest extension for Mercurial on Windows following your posted instructions -- they are GREAT - thanks!
But.... it seems that this link is dead
http://www.terminus.org/hg/hgforest
and I can't seem to find a replacement. Any ideas?

Posted by Celina on March 06, 2008 at 02:13 PM CET #

Hi Celina,

Thanks for the notice. Apparently the forest repository has moved here:
http://hg.akoha.org/hgforest/

-- daniel

Posted by daniel on March 06, 2008 at 04:12 PM CET #

The hgforest link is dead again. I found a clone at https://vogella@bitbucket.org/vogella/hgforest-crew

Is there any talk of switching from the dying hgforest (forest.py) to subrepositories?

\* http://www.vogella.de/articles/OpenJDK/article.html
\* http://mercurial.selenic.com/wiki/Subrepository

Posted by jla on February 23, 2011 at 01:01 PM CET #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Daniel Fuchs blogs on Scene Builder, JMX, SNMP, Java, etc...

The views expressed on this blog are those of the author and do not necessarily reflect the views of Oracle.

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today