7.1 Quick Mercurial tutorial for Sage

Mercurial is available by default since Sage version 1.3.7.3. It's confusingly called hg (the chemical symbol for mercury) at the command line. Do "sage -hg" to run it, or make a link to SAGE_ROOT/local/bin/hg

The file <SAGE_ROOT>/local/lib/python/site-packages/sage is just a symbolic link to

<SAGE_ROOT>/devel/sage/build/sage

Thus by changing what <SAGE_ROOT>/devel/sage points to, you can easily switch between running different versions of the Sage library. The "sage -b" command changes this symbolic link for you automatically. Without argument "sage -b" switches to where the symbolic link sage points to and builds Sage in this branch.

If you type sage -clone myver, say, then Sage will use hg to clone the current repository and call the result myver. The new repository is stored in <SAGE_ROOT>/devel/sage-myver

and when you clone the symlink sage --> sage-myver

is made. Creating clones of a repository should be fairly fast, e.g., about 30 seconds. You can also do, e.g.,

sage -clone -r 1250 oldver

to get a clone of Sage but as it was at revision 1250. Of course, dependency issues could make old versions not work (e.g., maybe an old Sage library won't compile with the latest Singular library, which is what is installed elsewhere in SAGE_ROOT). Type hg_sage.log() to see the revision history. Note: All the cython code is rebuilt if you clone an old version, since there is no easy way to know which files do and don't need rebuilding.

To switch to a different repository and build it, type, e.g., sage -b myver if the repository is stored in

<SAGE_ROOT>/devel/sage-myver

To switch back type sage -b main to the repository stored in <SAGE_ROOT>/devel/sage-main

You can also use hg directly from the command line instead of using it via the hg_sage object.

Use sage -hg [options] from within the repository. See hg(1) in the man pages for option details.

If you want to do a bunch of development, then make it available to others, here is how:

You can browse the official repositories for Sage with your web browser here: http://sagemath.org/sage/hg These are served using a cgi-bin script.

See About this document... for information on suggesting changes.