wiki:en/patches
developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Version 5 (modified by laurentj, 10 years ago) (diff)

--

Proposing a patch

You have to follow this steps, in order to create a patch.

  1. retrieve the last version of jelix (trunk) from the repository (and not from the download area !)
  2. create the ini file for the build script
  3. modify the sources of jelix in order to fix the bug you want to correct, or to made improvements
  4. build Jelix and build testapp
  5. test your changes and launch unit tests in the testapp application
  6. if not ok, back to the third step.
  7. all is ok, you can create the patch.

Details about this steps are described here, except the last one. Let's explain it.

The content of your patch

Your patch should contain all the modifications in the code, but it must all contains modifications in the headers of all files you changed: your name, your copyright etc. You should also update the lib/jelix/CREDITS files.

Creating the patch

There are 3 ways to provide patch, depending of how you work and how you contribute.

You create occasionnaly a patch

The simplier way is to use "hg diff". In the directory of your local copy of the repository, you should have made all your changes. When your changes are ok, just type:

hg diff > mypatch.diff

Then you have a mypatch.diff file. Perhaps you should made same changes in other branches. Provide then a patch for these branches.

Submit the patch into a ticket on developer.jelix.org. The ticket can be an existant one, or perhaps you have to create it. Create/edit the ticket and attached the file. Then you have to request a review. See below.

You are an active contributor

If you provide often some patches (unrelated or not), the best way is to manage a queue of patch, with the "mq" extension of Mercurial. Having his own branch/fork of the repository for that is not recommended, as a reviewer can refused your commit. So you can have at the end several commit for a single "patch", and the problem is that we want to have a clear history (one commit per ticket, except for big changes).

You can host your queue only on your computer, or you can share your queue on bitbucket. If you don't use bitbucket, just attach your patches on corresponding tickets and then request a review (see below).

If you want to share your queue of patchs (and it can be useful for reviewer to see the history of changes on your patch, review after review), you can use bitbucket. Create an account on bitbucket.org, and follow this instructions (replace "jelix-trunk" by jelix-1.1.x or other branch name if you want to work with branches):

  • Go on http://bitbucket.org/jelix/jelix-trunk/
  • click on "patch queue", fill the form, by giving a name to your repository for the queue. Take "jelix-trunk-patches" for example
  • you can then clone your new repository which contains the patch (use qclone, and not clone !):
    hg qclone ssh://hg@bitbucket.org/your-login/jelix-trunk-patches
    
  • On your computer, you have now a jelix-trunk-patches directory, with a .hg/patches/ directory. Now fill the directory with the content of jelix-trunk, to have source code of jelix with your patchs queue
    cd jelix-trunk-patches
    hg pull -u ssh://hg@bitbucket.org/jelix/jelix-trunk
    

You can start now to work. Let's create a first patch:

# create the patch
hg qnew ticket123.patch

# do some modifications on files
...
# refresh the patch each time you made some modifications
hg qrefresh

# you can then commit modification '''in the patch queue''', not in the repository it self
hg qcommit -m "my first work on the patch for ticket 123"

You can repeat qrefresh, qcommit to improve your patch. You can create several patch with qnew. Remember that changes you make are for the last patch. If you want to change an older patch, you have to use qpop to remove top patchs. To apply again newer patch, use qpush.

Read the tutorial on queues to know more on queues.

Each time you want to update source code of jelix, do

hg qpop -a  # remove your patches from the source code
hg pull -u ssh://hg@bitbucket.org/jelix/jelix-trunk
hg qpush -a

If conflicts are detected during hg qpush, fix conflicts (don't forget to do hg qrefresh) and restart qpush until it is ok.

To publish your patches on bitbucket, go into the directory .hg/patches and:

hg push

When one of your patch is ready, go on the corresponding ticket on developer.jelix.org and ask a review, by indicating the URL of your queue repository on bitbucket and the name of the patch. See below to request a review.

When one of your patch is integrated in the official repository, delete it from your queue before updating the source code of jelix

hg qpop -a
hg qdelete ticket123.patch
hg qcommit -m "remove ticket123.patch"
cd .hg/patches/
hg push
cd ../..
hg pull -u ssh://hg@bitbucket.org/jelix/jelix-trunk
hg qpush -a

You want to propose some patches for a big change

Maintening a queue of patch can be tiring when you work on a big change (integration of a new big component for example). The best way in this case is to have your own branch, with your own commits, and this branch will be merge with the trunk at the end.

Bitbucket allow you to publish a clone of a repository, and to commit changes to it. Then you can use the feature "pull request" of bitbucket to inform the owner of the "official" repository, to integrate your commit into his repository.

So you can "fork" a jelix repository, commit into your clone, and request a pull. Add a comment on the corresponding ticket on developer.jelix.org to inform other contributors that you've made some changes.

Try to commit clear step, in order to have an understandable history. Each changeset should correspond to a specific step of the change. Don't hesitate to use the mq extension of Mercurial to track your changes before committing them into your clone on bitbucket. And of course, your messages of changset should be well formatted?.

Requesting a review

If your patch is not finished (because you haven't no more time to work on it for example), so add a comment on the corresponding ticket to explain the situation, and then this is the end for you.

But if it is a finished patch, you should ask a review by setting the "review" field of the ticket to "review?". Then a reviewer will verify your patch. If it is ok, he will set "review+". If your patch needs some improvements, he will set "review-" and then you will have to make improvements he asked and you will create a new patch, submit it on the ticket, ask "review?" and so on.

When you have "review+", you can commit the patch in the repository if you have write acces, or a "commiter" will do it for you.

See to know the 'commit styles'?.


summary