Mercurial 1.7+ Forest Extension vs subrepos

Dr Andrew John Hughes gnu_andrew at member.fsf.org
Mon Nov 8 05:12:32 PST 2010


On 7 November 2010 19:22, John Patrick <nhoj.patrick at gmail.com> wrote:
> Today I thought I would try to build openjdk from source. Following the
> guide it says to install Mercurial 0.9.4 or newer, and also install the
> Forest Extension. The initial link for forest has a broken link for
> download, and a email to the maintainer bounced with unknown domain. The
> alternative link for a version post-1.0 release, does work, but the
> extension fails on Mercurial 1.7.
>
> I've supplied a patch to that version
> [http://bitbucket.org/pmezard/hgforest-crew/overview/] and hopefully the
> openjdk documentation will work as currently document shortly.
>
> Whilst trying to get the Forest Extension working, it appears the preferred
> solution from Mercurial 1.7 onwards is to use subrepos which will be
> maintained by mercurial instead of via a plugin.
>
> So openjdk might need to switch to using subrepos and/or change the
> documentation too.
>
> I thought I'd let people know as I thought building from source might have
> issues, but I never thought getting the source in the 1st place would be the
> issue, which might put people off who want to help.
>
> John
>
>

Hi John,

Sadly, this issue doesn't seem to have been discussed much on the
OpenJDK lists.  The forest extension was a non-standard addon to
Mercurial to begin with, and support only seems to have become worse
as time has passed.  Like most of the build documentation, the
instructions still pertain to the time of the initial OpenJDK release.

You actually can checkout just fine without the forest extension (and
commit, etc. for those who have the rights).  The lack of the forest
extension just means that you have to check out each tree rather than
the forest extension detecting them for you.

The following script:

    for trees in "" jdk hotspot langtools corba jaxp jaxws
    do
	echo Tree $trees
	dir=$ROOT/$forest/$trees
	parent=$(dirname $dir)
	if [ ! -e $dir/.hg ] ; then
	    echo Creating $parent
	    mkdir -p $parent
	    echo Entering $parent
	    cd $parent
	    echo Cloning root from $URL/$forest/$trees
	    hg clone $URL/$forest/$trees
	else
	    echo Entering $dir
	    cd $dir
	    echo Updating $trees
	    hg pull -u
	fi
    done

will either checkout or update the given forest $forest in the
directory $ROOT.  Which action is taken depends on whether the tree
already exists or not.

A simpler script:

#!/bin/bash

TREE=$1
COMMAND=$2

if test "x$COMMAND" = x; then
    COMMAND="pull -u"
fi

for dirs in . corba jaxp jaxws langtools hotspot jdk
do
  hg -R $1/$dirs $COMMAND
done

will handle any Mercurial command over an existing forest checkout.

This method has the disadvantage that the subdirectories are hardcoded
(though I doubt they are going to change), but has the advantage that
there is no need for the forest extension and it's noticeably faster
as there is no search for directories.
-- 
Andrew :-)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

Support Free Java!
Contribute to GNU Classpath and the OpenJDK
http://www.gnu.org/software/classpath
http://openjdk.java.net

PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint: F8EF F1EA 401E 2E60 15FA  7927 142C 2591 94EF D9D8


More information about the web-discuss mailing list