Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Get the source code on your local drive using SVNgit. Most development is done on the "trunk":

Code Block
svngit checkoutclone https://svngit-wip-us.apache.org/repos/asf/zookeeper/trunk/ zookeeper-trunk.git

You may also want to develop against a specific release. To do so, visit https://svn.apache.org/repos/asf/zookeeper/tags/ and find the release that you are interested in developing against. To checkout this release, run:

Code Block
svn checkout https://svn.apache.org/repos/asf/zookeeper/tags/release-X.Y.Z/ zookeeper-X.Y.Z

...

You can list the release branches and checkout 3.4 by going into the zookeeper directory and running:

Code Block
git branch -la
git checkout remotes/origin/branch-3.4

Making Changes

Before you start, send a message to the ZooKeeper developer mailing list, or file a bug report in Jira. Describe your proposed changes and check that they fit in with what others are doing and have planned for the project. Be patient, it may take folks a while to understand your requirements.

You will want to create a local branch to work under. It's convenient to name it the JIRA number:

Code Block
git checkout -b ZOOKEEPER-1234 # this is the same as git branch ZOOKEEPER-1234 && git checkout ZOOKEEPER-1234

Modify the source code and add some (very) nice features using your favorite IDE.

...

ZooKeeper is built by Ant, a Java building tool. This section will eventually describe how Ant is used within ZooKeeper. To start, simply read a good Ant tutorial. The following is a good tutorial, though keep in mind that ZooKeeper isn't structured according to the ways outlined in the tutorial. Use the tutorial to get a basic understand of Ant but not to understand how Ant is used for Hadoop:

Good Ant tutorial: http://i-proving.com/2005/10/31/ant-tutorial

Generating a patch

Unit Tests

Please make sure that all unit tests succeed before constructing your patch and that no new javac compiler warnings are introduced by your patch.

...

Check to see what files you have modified with:

Code Block
svngit statstatus

Add any new files with:

Code Block
svngit add src/.../MyNewClass.java
svngit add src/.../TestMyNewClass.java

In order to create a patchCommit your changes, type:

Code Block
svngit diff >commit ZOOKEEPER-1234.patch
a

In the commit message should be one line of the form: JIRA: short description. For example 

ZOOKEEPER-1234: fixed the coolness factor calculation

You can ten create a patch with the following commandIf using git (via one of the available git-svn mirrors) create the patch as follows

Code Block
git diff --no-prefix show > ZOOKEEPER-1234.patch

This will report all modifications done on ZooKeeper sources on your local disk and save them into the ZOOKEEPER-1234.patch file. Read the patch file.
Make sure it includes ONLY the modifications required to fix a single issue.

...

  • try to adhere to the coding style of files you edit;
  • comment code whose function or rationale is not obvious;
  • update documentation (e.g., package.html files, this wiki, etc.)
  • name the patch file after the JIRA – ZOOKEEPER-<JIRA#>.patch

If you need to rename files in your patch:

...

  • .

...

  • patch

...

...

Testing your patch

Before submitting your patch, you are encouraged to run the same tools that the automated Jenkins CI system will run on your patch. This enables you to fix problems with your patch before you submit it. The test Ant target will run your patch through the same checks that Jenkins currently does.

To use this target, you must run it from a clean workspace (ie svn stat shows git status shows no modifications or additions). From your clean workspace, run:

...

To apply a patch either you generated or found from JIRA, you can issue

Code Block
patch -p0 < ZOOKEEPER-<JIRA#>.patch

if you just want to check whether the patch applies you can run patch with --dry-run option

Code Block
patch -p0 --dry-run < ZOOKEEPER-<JIRA#>.patch

...

Apply the patch uploaded by the user. Edit the CHANGES.txt file, adding a description of the change, including the bug number it fixes. Add it to the appropriate section - BUGFIXES, IMPROVEMENTS, NEW FEATURES. Please follow the format in CHANGES.txt file. While adding an entry please add it to the end of a section. Use the same entry for the svn commit git commit message.

Jira Guidelines

Please comment on issues in Jira, making their concerns known. Please also vote for issues that are a high priority for you.

...