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:
sage -clone myver
).
hg_sage.status()
and
hg_sage.diff()
to see exactly what
you've done (you can pass options to diff to
see information about certain files).
-------------------------------------------------------- | SAGE Version 1.6.1, Build Date: 2007-01-14 | | Distributed under the GNU General Public License V2. | -------------------------------------------------------- Loading SAGE library. Current Mercurial branch is: myver sage: hg_sage.status() Getting status of modified or unknown files: cd "/home/jaap/sage/devel/sage" && hg status M sage/databases/sloane_functions.py --- Branch: myver sage: hg_sage.diff() cd "/home/jaap/sage/devel/sage" && hg diff | less
hg_sage.add([filenames])
to add new
files to your repository.
hg_sage.commit([optional filenames])
to commit the changes in files to the repository-if no filenames are given all
files are committed. First the output of hg diff is piped through less, look at
it or just enter "q". Then you are asked to give your comment on the changes.
Type "i", write some meaningful one liner, hit 'Escape' and type ":wq".
(Note: vi is the default editor. In bash, to make emacs the default, type
export EDITOR=emacs
.)
sage: hg_sage.commit() cd "/home/jaap/sage/devel/sage" && hg diff | less cd "/home/jaap/sage/devel/sage" && hg commit
sage -br main sage: hg_sage.pull('myver') #or hg_sage.pull('/home/jaap/sage/devel/sage-myver') cd "/home/jaap/sage/devel/sage" && hg status cd "/home/jaap/sage/devel/sage" && hg status cd "/home/jaap/sage/devel/sage" && hg pull -u /home/jaap/sage/devel/sage-myver pulling from /home/jaap/sage/devel/sage-myver searching for changes adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files 1 files updated, 0 files merged, 0 files removed, 0 files unresolved If it says use 'hg merge' above, then you should type hg_sage.merge(), where hg_sage is the name of the repository you are using. This might not work with the notebook yet. sage: hg_sage.update() cd "/home/jaap/sage/devel/sage" && hg update 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
hg_sage.bundle('mybundle')
(this
creates an hg bundle mybundle.hg
). Alternatively,
you can export any particular changeset as plain text patches by
typing hg_sage.export(...)
; note that each individual changeset
is recorded as a different patch.
hg_sage.export(...)
needs at least the argument
revs - integer or list of integers (revision numbers); use the hg_sage.log()
function to see them. An optional second argument is a 'patch_filename',
default is '(changeset_revision_number).patch'.
These can be applied to any other
repository using hg_sage.import_patch('patch_filename')
.
Besides hg_sage.diff(...)
, another way to see what
changes are contained in a patch bundle is to use the command
hg_sage.inspect('patchname.hg')
. This displays the
``diff file'' as plain text using less
.
Note that you don't get to ``cherry pick'' what you send in a bundle.
Everything you recorded is sent. Hence you might want to use the
cloning, etc. above to send only from your own sage-main repository.
Note also that if you have a repository, e.g., sage-mynewstuff
and it's all ready to use, you can do
sage -hg pull <SAGE_ROOT>/devel/sage-mynewstuff
from your <SAGE_ROOT>/devel/sage-main repository
, and you'll
get all the sage-mynewstuff merged in. NOTE: read the output!
After that you must type sage -hg update
.
sage: hg_sage.serve()
sage: hg_sage.ci() sage: hg_sage.send('patchname.hg')
Post the file 'patchname.hg' to the trac server. Note that 'ci()' is an alias for 'commit()'.
http://sagemath.org/sage/hg
These are served using a cgi-bin script.
See About this document... for information on suggesting changes.