Skip to content
millerjv edited this page Nov 7, 2012 · 22 revisions

jqplot hg git bridge

Purpose

This repository is part of a bridge between hg and git. jqplot uses Mercurial while the Slicer4 SuperBuild process supports git and not hg. This repository is a clone of the Mercurial repository forked from the master jqplot repository on BitBucket. This repository supports the Slicer4 build process and allow us to develop patches. Patches will be applied directly to the github version, then bridged back to Mercurial, pushed back to BitBucket, and offered back to the jqplot developers.

This strategy was chosen because

  1. SuperBuild is complicated enough without introducing a forth revision control system (svn, git, cvs) and new build tools (hg, ant, java).
  2. Slicer will utilize these patches to jqplot even if jqplot decides not to accept them
  3. Slicer's development timeline is asynchronous with jqplot's development timeline
  4. Patches are expected to be few and far between, so the manual bridging from git back to hg is a rare event

Design

This repository allows for Slicer developers to make modifications and changes to jqplot. However, the Slicer build process does not access this repository directory. Rather, once a developer has completed their modifications to jqplot, they will create a new tarball and place that tarball on the Downloads page. The developer will then need to update the Slicer\SuperBuild\External_jqPlot.cmake file with the new URL and MD5 hash.

This design was chosen so that the Slicer build process would not have to rely of Mercurial, Ant, and Java.

Tarballs

jqplot uses ant to build its tarballs. The ant target compress will build the jqplot distribution, concatenating files, minimizing the javascript code, and creating the tarballs. The build process also relies on Mercurial to get version and revision numbers for the tarballs. Therefore, to build the tarballs, a developer will need to access this repository using Mercurial and the Hg-Git mercurial plugin.

the Hg-Git mercurial plugin

The Hg-Git mercurial plugin allows for Mercurial to clone git repositories. If you want to be able to build new jqplot tarballs of the Slicer4 branch, then you will need Mercurial and the Hg-Git mercurial plugin.

Repositories

This bridge of hg and git requires a checkout to act as the intermediary between hg and git. This intermediary repository uses hg-git. See the directions there on how to configure hg to have a git bridge.

Branches, no I mean bookmarks

On the git repository for jqplot, we use git branches to manage development and release branches. The git branches are mapped to bookmarks on the mercurial repository.

The initial branch is named 1.0.4-Slicer4. This indicates that the branch is off of the 1.0.4 release of jqplot.

Pulling changes from the central Mercurial repository

$ hg clone git+ssh://git@github.com/Slicer/jqplot.git      # checkout from the git repo
$ cd jqplot
$ hg pull https://bitbucket.org/cleonello/jqplot           # pull in changes from the central hg repo
$ hg update tip       # Is the right way to jump to the head of the repository when pulling from a remote?

The main development from the central jqplot repository will be on the default branch. All Slicer based development will be on bookmarks such as 1.0.4-Slicer. When we update jqplot, we will create a new bookmark, for instance 1.0.5-Slicer, and merge our changes from the previous bookmark onto that new bookmark.

Pushing changes to github

$ hg push git+ssh://git@github.com/Slicer/jqplot.git

Pulling updates from github

$ hg pull git+ssh://git@github.com/Slicer/jqplot.git

Building the tarballs

Building the tarballs for jqplot requires Mercurial to get the version and revision numbers. (Note that Mercurial revision numbers are local to the checkout so they should not be used as a reference across checkouts.)

With hg-git installed, you can use hg to checkout Slicer's git version of the repository.

$ hg clone git+ssh://git@github.com/Slicer/jqplot.git
$ cd jqplot
$ hg update 1.0.4-Slicer4  # switch to the Slicer4 bookmark/branch
$ ant compress

The file dist/jquery-jqplot-1.0.4rXXXX.tar.gz can be uploaded to https://github.com/Slicer/jqPlot/downloads

Be careful when creating and uploading tarballs. Tarballs are named by the build script (build.xml) based on the jqplot version and jqplot revision. Revision numbers in hg are local to the repository. If multiple people generate tarballs, then multiple points in the history from different machines may have the same revision number and may generate tarballs with the same name. For now, this can be managed by being careful and perhaps manually modifying the name of the tarball when a conflict occurs. Ultimately, it would be better if the tarballs were named based on the hashes. We may do this on our branch.

Slicer4/SuperBuild/External_jqPlot.cmake then needs to reflect the tarball name and MD5.