William Stein <wst...@gmail.com> writes:
> Note that it is not obvious or documented how to effectively do this
> with the Sage library with other people, and still properly submit
> stuff for inclusion in Sage, but it should be possible.
>
> I setup something exactly like the above for trac #12545:
>     http://trac.sagemath.org/sage_trac/ticket/12545
>
> with my github repo here:
>     https://github.com/williamstein/sagelib/commits/lfun
>
> From memory, I basically did the following:
>
>   1. Got a git repo as follows:
>
> $ cd SAGE_ROOT/devel
> $ git clone git://github.com/williamstein/sagelib.git sage-git

Of course, other users should first fork the repo on github and then
replace "williamstein" with their github username.

> $ rm sage
> $ ln -s sage-git sage
> $ export MAKE="make -j4"
> $ sage -br       # wait an hour?
>
>    2. Branch my repo for this particular project:
>
> $ git branch lfun
> $ git checkout lfun   # switch to this branch

Before this, please checkout the version of Sage you are running. If
your SAGE_ROOT is an installation of Sage 4.8, for example, please do

$ git checkout 4.8
$ git checkout -b lfun # shorthand for `git branch lfun && git checkout
lfun`

If you do not do this, you may run into problems in Sage due to your
library being "too new" compared to the other SPKGs installed in Sage.
The best thing to do is to *always* be running the latest development
version, IMO. Then you don't need to worry about this stuff. Not to
mention that creating your patch will be easier - no rebasing necessary,
if you work fast enough and get your code done before Jeroen releases
the next development release!

>    3. Whenever I am doing with some work and do "git commit -a" (say),
> then I'll do this:
>
> # makes a flattened patch of everything I've done.
> git diff ecaff3a3d14614bd01a724c8b26bd874bb6bf483 >
> ~/patches/trac_12545-cumulative.patch

Note: ecaff3a3d14614bd01a724c8b26bd874bb6bf483 doesn't exist upstream
anymore. It was a commit I foolishly made to include a github-specific
README into the repo on github - from now on that README lives in the
wiki on the github project page, and I will no longer make any commits
to the github repo which aren't in Jeroen's SPKGs. Please instead do

$ git diff master > ~/patches/whatever.patch

This will produce a patch against whatever the latest development
release was when you created your fork on github (assuming you didn't do
anything to "master" in your local repo). If much time has passed since
then, you will need to rebase your patch, but I won't go into that here.

> # copies that flattened patch to the web -- there is a link to this
> patch on the trac ticket.
> scp ~/patches/trac_12545-cumulative.patch sage.math.washington.edu:patches/
>
> # pushes my repo to github
> git push was lfun

Note: William has done

$ git remote add was github.com:williamstein/sagelib

which creates "was" as a short name for a remote repository,
specifically his github fork of the Sage library. You can do something
similar.

> REMARKS:
>
> * So far I've failed to have anybody else collaborate with me on this
> code, but I hold out hope it will happen, so I can see if that would
> actually work.   I'm very optimistic though, given my recent
> experience with github.
>
> * I've tried using my sage-git "branch" and branching it in order to
> test out various trac tickets when refereeing, etc.,  It seems much
> more cumbersome than using Mercurial queues for this, but that may be
> because the patches are in hg format, etc., so this isn't so
> surprising.

What do you mean by "branching it"? `git branch`? Yes, it is pretty
terrible right now, but that's because we're using patches (not really
because they are in hg format). Fetching from other git repos to do
reviews is much, much easier :)

> Anyway, git is awesome.

Yup!

-Keshav

----
Join us in #sagemath on irc.freenode.net !

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to