Simon King <simon.k...@uni-jena.de> writes:
> Hi Frederic,
>
> what I usually do is: 
>
>  * When I have a patch foo.patch that needs rebasing, then I take a
>    Sage installations with all required prerequisites (i.e.,
>    the dependencies of foo.patch).
>  * Then, I try to apply foo.patch (i.e., hg qimport foo.patch followed
>    by hg qpush).
>  * If applying the patch does work, then I complain on the ticket that
>    the patch does not need rebasing, from my perspective, and that the
>    release manager or the reviewer please state which other tickets need
>    to be applied to see the merge conflict.
>  * If applying the patch does *not* work (as expected), then mercurial
>    will automatically create some files that show the conflicts. Say, if
>    foo.patch shall modify groups.py, but one hunk of the patch does not
>    fit, then groups.py.rej is created.
>  * Now, I'd read groups.py.rej, to see what part of the patch did not
>    apply, and why. Note that every part of foo.patch that is not
>    mentioned in one of the ....rej files is fine, so, no need to worry
>    about them.
>  * I'd edit groups.py, so that the parts of groups.py mentioned in
>    groups.py.rej are as they are meant to be with foo.patch.
>  * hg qrefresh followed by hg export qtip > foo.patch
>  * Post the new version of foo.patch to trac, and don't forget to change
>    the state of the ticket back to "needs review" or post a comment (if
>    you just update the attachment, trac will not notify the reviewer)

Here's another way:

   * Turn on the rebase extension in your ~/.hgrc file
   * Set up a merge tool by means of some voodoo which I've now
     forgotten (this may even be handled automatically in newer versions
     of Mercurial)
   * Do `hg update -C foo` where foo is the version of Sage on which the
     patch is known to apply
   * Apply the patch
   * Do `hg heads` and note the ID of the commit which is the latest
     version of Sage (as opposed to the commit which is the patch you
     just applied)
   * Do `hg rebase -d ID` where ID is the ID previously noted
   * If a merge window pops up, resolve merge conflicts with the handy
     dandy merge tool you configured
   * Voila, the patch is now rebased

This is more complicated to set up but also allows you to avoid retyping
code and fixing up files manually. Often, a conflict that would have
caused .rej files to appear if you just tried to apply the patch will be
automatically handled by the logic of the `hg rebase` command, and even
if it isn't handled, you get to manipulate the hunks directly, hopefully
making sure you don't lose anything.

-Keshav

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

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To post to this group, send email to sage-combinat-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.

Reply via email to