Using the Mercurial Forest extension for OpenSolaris onnv-gate
By Darren Moffat-Oracle on Sep 05, 2008
This is really only relevant to those people doing development on the OpenSolaris onnv-gate that are inside Sun, but it since there is nothing private about it I'm posting it publicly so google can find it.
With the transition from Teamware to Mercurial the onnv-gate source code is now held in two separate repositories. The main repository holding the overwhelming majority of the source code, which is opensourced under various licenses but mostly CDDL, is called "onnv-gate" the source code is in the mercurial repository in a subdirectory called usr/src. The much smaller closed source is in a separate repository that is nested inside the "onnv-gate" as the usr/closed subdirectory.
The usr/src part can be built either by using the downloadable (and redistributable) binaries which make up a proto area for the closed source bits, or the usr/closed part can be built from source along with usr/src. If building both from source then the usr/src and usr/closed mercurial repositories must be in sync otherwise there will be a high risk of either build failures or buggy binaries.The Mercurial forest extension provides a way to make sure that nested repositorys such as onnv and onnv-closed are always pulled/pushed at the same time.
Initial gate setup
$ hg clone ssh://onnv.sfbay.sun.com//export/onnv-clone myrepo $ cd myrepo/usr $ hg clone ssh://onnv.sfbay.sun.com//export/onnv-clone/usr/closed
Syncing with onnv-gate
$ cd path/to/myrepo $ hg fpull
You may find this a little slow as it has to traverse the whole workspace looking for nested repositories so it can build the definition of the forest. This can be speeded up using the "fsnap" command to create a snapshot file. Or you can create one by hand, that may look similar to this:
[tree1] root = . revision = tip path.default = ssh://onnv.sfbay.sun.com//export/onnv-clone [tree2] root = usr/closed revision = tip path.default = ssh://onnv.sfbay.sun.com//export/onnv-clone/usr/closed
To use the snapshot file we run fpull like this:
$ hg fpull --snapfile /path/to/mysnapfile
ONNV-gate push rules
The rules for pushing to the onnv-gate when a single set of fixes needs to span the usr/src and usr/closed trees is that usr/closed must be pushed first. This basically means that you should NOT use the forest extension for pushing. However the number of people that this impacts is very small most developers just need an up to date usr/closed for building.
For this reason I'm not showing how to push with the forest extension here.