My favorites | Sign in
Logo
                
Search
for

Send questions and feedback on this wiki page to the wave-protocol mailing list.

Updated Nov 10, 2009 by joe.gregorio
SubmittingCode  
Submitting code to the wave-protocol repository

The process for submitting a patch to the wave-protocol repository is:

  1. Clone or pull/update the wave-protocol mercurial repository
  2. Make changes
  3. Use the request_codereview script to set up a code review at http://codereview.waveprotocol.org
  4. Wait for reviewers' comments, address them, repeat until everybody is happy
  5. A maintainer will submit your patch (credited to you, of course)
  6. Before any contributions are accepted you will need to sign a Contributors License Agreement. The are two forms, one for Individual Contributors, and a separate one for Corporate Contributors.

Clone the wave-protocol repository

$ hg clone https://wave-protocol.googlecode.com/hg/ wave-protocol

Or

$ hg pull
$ hg update

Style

Take care to conform to the style of the file you're patching. If in doubt follow Sun's Java style guide. The following should also be observed when submitting code:

  • Keep lines to under 100 characters
  • Indentation is 2 spaces
  • Alphabetic ordering of imports (though IDEs do this automatically)

In addition, reading Effective Java it is strongly suggested.

Make changes

If you add files then remember to hg add them. You can check the status of important files using hg -arm and hg diff.

Use request_codereview script

We use the Rietveld code review tool to submit a code review. This looks at the difference between the tip of the repository (or a specific version with --rev) and its current state, and uploads it to http://codereview.waveprotocol.org for other people to comment on. We use this both as a mechanism for distributing patches, and as a way to ensure they are a suitably high quality.

$ ./request_codereview --send_mail -e me@gmail.com -m "Short description of patch"
  • --send_mail will automatically post to the wave-protocol-code-discuss@googlegroups.com group about your patch
  • -e example@gmail.com is your Google account email address
  • -m "Short description of patch" is a short summary of what the patch does (limited to 100 characters) -- if you need a longer description, use -d in addition to -m

You can view your patch at http://codereview.waveprotocol.org. Log in for a more detailed overview.

Wait for reviewers

Reviewers (probably the wave-protocol maintainers, though anybody is welcome) will comment on your patch, either inline or with an overall comment. Look out for the phrase LGTM ("Looks Good To Me").

You should revise the code if requested, and reply to the comments either with "Done." or a more detailed response if necessary.

Submitting your patch

After an LGTM or two, a maintainer will download your patch from Rietveld and submit it to the mainline repository.

Example

For an example, we change the client's scrolling keys to be [ and ] instead of { and }.

$ hg clone https://wave-protocol.googlecode.com/hg/ wave-protocol
$ cd wave-protocol
$ vim `find . -name ConsoleClient.java`
...
$ hg stat -arm
M src/org/waveprotocol/wave/examples/fedone/waveclient/console/ConsoleClient.java
$ hg diff
diff -r 9fb7aab3e2a9 src/org/waveprotocol/wave/examples/fedone/waveclient/console/ConsoleClient.java
--- a/src/org/waveprotocol/wave/examples/fedone/waveclient/console/ConsoleClient.java	Thu Aug 20 14:18:49 2009 +1000
+++ b/src/org/waveprotocol/wave/examples/fedone/waveclient/console/ConsoleClient.java	Sun Aug 23 12:29:51 2009 +1000
@@ -114,7 +114,7 @@
 
     // Set up scrolling -- these are the opposite to how you would expect because of the way that
     // the waves are scrolled (where the bottom is treated as the top)
-    reader.addTriggeredAction('}', new ActionListener() {
+    reader.addTriggeredAction(']', new ActionListener() {
       @Override public void actionPerformed(ActionEvent e) {
         if (isWaveOpen()) {
           openWave.scrollUp(scrollLines.get());
@@ -123,7 +123,7 @@
       }
     });
 
-    reader.addTriggeredAction('{', new ActionListener() {
+    reader.addTriggeredAction('[', new ActionListener() {
       @Override public void actionPerformed(ActionEvent e) {
         if (isWaveOpen()) {
           openWave.scrollDown(scrollLines.get());
$ ./request_codereview --send_mail -e example@gmail.com -m "Console client: use [ and ] rather than { and } to scroll"
Upload server: codereview.waveprotocol.org (change with -s/--server)
Loaded authentication cookies from /Users/example/.codereview_upload_cookies
Issue created. URL: http://codereview.waveprotocol.org/8002
Uploading base file for src/org/waveprotocol/wave/examples/fedone/waveclient/console/ConsoleClient.java