summaryrefslogtreecommitdiff
path: root/doc/contribute.html
diff options
context:
space:
mode:
authorMichael Stapelberg <stapelberg@debian.org>2013-03-04 21:27:36 +0100
committerMichael Stapelberg <michael@stapelberg.de>2013-03-04 21:27:36 +0100
commit04b08da9af0c450d645ab7389d1467308cfc2db8 (patch)
treedb247935fa4f2f94408edc3acd5d0d4f997aa0d8 /doc/contribute.html
parent917c5fb8ec48e22459d77e3849e6d388f93d3260 (diff)
downloadgolang-upstream/1.1_hg20130304.tar.gz
Imported Upstream version 1.1~hg20130304upstream/1.1_hg20130304
Diffstat (limited to 'doc/contribute.html')
-rw-r--r--doc/contribute.html193
1 files changed, 144 insertions, 49 deletions
diff --git a/doc/contribute.html b/doc/contribute.html
index e1f39ae7e..72c936472 100644
--- a/doc/contribute.html
+++ b/doc/contribute.html
@@ -7,7 +7,7 @@
<p>
This document explains how to contribute changes to the Go project.
It assumes you have installed Go using the
-<a href="/doc/install">installation instructions</a> and
+<a href="/doc/install/source">installation instructions</a> and
have <a href="code.html">written and tested your code</a>.
(Note that the <code>gccgo</code> frontend lives elsewhere;
see <a href="gccgo_contribute.html">Contributing to gccgo</a>.)
@@ -46,24 +46,13 @@ tree to make sure the changes don't break other packages or programs:
<pre>
cd $GOROOT/src
-./all.bash
+./all.bash # On Windows, run all.bat
</pre>
<p>
-The final line printed by <code>make all</code> should be of the form:
+After running for a while, the command should print "<code>ALL TESTS PASSED</code>".
</p>
-<pre>
-<i>N</i> known bugs; 0 unexpected bugs
-</pre>
-
-<p>
-The value of <i>N</i> varies over time, but the line must
-say &ldquo;<code>0 unexpected bugs</code>&rdquo; and must not
-add &ldquo;<code>test output differs</code>.&rdquo;
-</p>
-
-
<h2 id="Code_review">Code review</h2>
<p>
@@ -104,41 +93,44 @@ the code review extension disables the standard <code>hg commit</code>
command.
</p>
-<p>
-Mercurial power users: if you prefer to use the Mercurial Queues extension, see
-<a href="codereview_with_mq.html">Using Mercurial Queues with Codereview</a>.
-</p>
-
<h3>Configure the extension</h3>
<p>Edit <code>$GOROOT/.hg/hgrc</code> to add:</p>
<pre>
[extensions]
-codereview = YOUR_GO_ROOT/lib/codereview/codereview.py
+codereview = $GOROOT/lib/codereview/codereview.py
[ui]
username = Your Name &lt;you@server.dom&gt;
</pre>
-<p>Replace YOUR_GO_ROOT with the value of <code>$GOROOT</code>.
-The Mercurial configuration file format does not allow environment variable substitution.
+<p>
The <code>username</code> information will not be used unless
you are a committer (see below), but Mercurial complains if it is missing.
</p>
+<p>
+After adding the extension, <code>hg help codereview</code>
+will show documentation for its commands. As the codereview extension is only
+enabled for your checkout in <code>$GOROOT</code>, the remainder of this
+document assumes you are inside <code>$GOROOT</code> when issuing commands.
+</p>
+
<h3>Log in to the code review site.</h3>
<p>
The code review server uses a Google Account to authenticate.
(If you can use the account to
<a href="https://www.google.com/accounts/Login?hl=en&amp;continue=http://www.google.com/">sign in at google.com</a>,
-you can use it to sign in to the code review server.
+you can use it to sign in to the code review server.)
The email address you use on the Code Review site
will be recorded in the <a href="http://code.google.com/p/go/source/list">Mercurial change log</a>
and in the <a href="/CONTRIBUTORS"><code>CONTRIBUTORS</code></a> file.
You can <a href="https://www.google.com/accounts/NewAccount">create a Google Account</a>
associated with any address where you receive email.
+If you've enabled the two-step verification feature, don't forget to generate an
+application-specific password and use that when prompted for a password.
</p>
<pre>
@@ -163,6 +155,19 @@ can use that nickname as a shorthand for naming reviewers and the CC list.
For example, <code>rsc</code> is an alias for <code>rsc@golang.org</code>.
</p>
+<h3>Switch to the default branch</h3>
+
+<p>
+Most Go installations use a release branch, but new changes should
+only be made to the default branch. (They may be applied later to a release
+branch as part of the release process.)
+Before making a change, make sure you use the default branch:
+</p>
+
+<pre>
+$ hg update default
+</pre>
+
<h3>Make a change</h3>
<p>
@@ -263,6 +268,8 @@ The special sentence &ldquo;Fixes issue 159.&rdquo; associates
the change with issue 159 in the <a href="http://code.google.com/p/go/issues/list">Go issue tracker</a>.
When this change is eventually submitted, the issue
tracker will automatically mark the issue as fixed.
+(These conventions are described in detail by the
+<a href="http://code.google.com/p/support/wiki/IssueTracker#Integration_with_version_control">Google Project Hosting Issue Tracker documentation</a>.)
</p>
<p>
@@ -277,15 +284,37 @@ which <code>hg change</code> will print, something like:
CL created: http://codereview.appspot.com/99999
</pre>
+<h3>Adding or removing files from an existing change</h3>
+
<p>
-If you need to re-edit the change description,
+If you need to re-edit the change description, or change the files included in the CL,
run <code>hg change 99999</code>.
</p>
<p>
-You can see a list of your pending changes by running <code>hg pending</code> (<code>hg p</code> for short).
+Alternatively, you can use
</p>
+<pre>
+$ hg file 99999 somefile
+</pre>
+
+<p>
+to add <code>somefile</code> to CL 99999, and
+</p>
+
+<pre>
+$ hg file -d 99999 somefile
+</pre>
+
+<p>
+to remove <code>somefile</code> from the CL.
+</p>
+
+<p>
+A file may only belong to a single active CL at a time. <code>hg file</code>
+will issue a warning if a file is moved between changes.
+</p>
<h3>Synchronize your client</h3>
@@ -378,6 +407,12 @@ changes, but you may still need to run
<h3>Mail the change for review</h3>
+<p>
+Creating or uploading the change uploads a copy of the diff to the code review server,
+but it does not notify anyone about it. To do that, you need to run <code>hg mail</code>
+(see below).
+</p>
+
<p>To send out a change for review, run <code>hg mail</code> using the change list number
assigned during <code>hg change</code>:</p>
@@ -399,6 +434,10 @@ $ hg mail -r golang-dev@googlegroups.com --cc math-nuts@swtch.com 99999
<p>Note that <code>-r</code> and <code>--cc</code> cannot be spelled <code>--r</code> or <code>-cc</code>.</p>
+<p>
+If your change relates to an open issue, please add a comment to the issue
+announcing your proposed fix, including a link to your CL.
+</p>
<h3>Reviewing code</h3>
@@ -412,7 +451,18 @@ to send comments back.
<h3>Revise and upload</h3>
-<p>You will probably revise your code in response to the reviewer comments.
+<p>
+You will probably revise your code in response to the reviewer comments. When
+you have done this, you can upload your change to the code review server
+without sending a notification by running <code>hg upload</code> using the change
+list number assigned during <code>hg change</code>
+</p>
+
+<pre>
+$ hg upload 99999
+</pre>
+
+<p>
When you have revised the code and are ready for another round of review, run
</p>
@@ -433,39 +483,59 @@ The reviewer approves the change by replying with a mail that says
<code>LGTM</code>: looks good to me.
</p>
-<h3>Submit the change after the review</h3>
+<p>
+You can see a list of your pending changes by running <code>hg pending</code> (<code>hg p</code> for short).
+</p>
+
+<h3>Reviewing code by others</h3>
<p>
-After the code has been <code>LGTM</code>'ed, it is time to submit
-it to the Mercurial repository.
-If you are a committer, you can run:
+You can import a CL proposed by someone else into your local Mercurial client
+by using the <code>hg clpatch</code> command. Running
</p>
<pre>
-$ hg submit 99999
+$ hg clpatch 99999
</pre>
<p>
-This checks the change into the repository.
-The change description will include a link to the code review,
-and the code review will be updated with a link to the change
-in the repository.
+will apply the latest diff for CL 99999 to your working copy. If any of the
+files referenced in CL 99999 have local modifications, <code>clpatch</code>
+will refuse to apply the whole diff. Once applied, CL 99999 will show up in
+the output of <code>hg pending</code> and others.
</p>
<p>
-If your local copy of the repository is out of date,
-<code>hg submit</code>
-will refuse the change:
+To revert a CL you have applied locally, use the <code>hg revert</code>
+command. Running
</p>
<pre>
-$ hg submit 99999
-local repository out of date; must sync before submit
+$ hg revert @99999
</pre>
<p>
+will revert any files mentioned on CL 99999 to their original state. This can
+be an effective way of reverting one CL revision and applying another.
+</p>
+
+<p>
+Once the CL has been submitted, the next time you run <code>hg sync</code>
+it will be removed from your local pending list. Occasionally the pending list
+can get out of sync leaving stale references to closed or abandoned CLs.
+You can use <code>hg change -D 99999</code> to remove the reference to CL 99999.
+</p>
+
+<h3>Submit the change after the review</h3>
+
+<p>
+After the code has been <code>LGTM</code>'ed, it is time to submit
+it to the Mercurial repository.
+</p>
+
+<p>
If you are not a committer, you cannot submit the change directly.
-Instead, a committer, usually the reviewer who said <code>LGTM</code>,
+Instead a committer, usually the reviewer who said <code>LGTM</code>,
will run:
</p>
@@ -474,19 +544,39 @@ $ hg clpatch 99999
$ hg submit 99999
</pre>
-<p>The <code>clpatch</code> command imports your change 99999 into
-the committer's local Mercurial client, at which point the committer
-can check or test the code more.
-(Anyone can run <code>clpatch</code> to try a change that
-has been uploaded to the code review server.)
+<p>
The <code>submit</code> command submits the code. You will be listed as the
author, but the change message will also indicate who the committer was.
Your local client will notice that the change has been submitted
when you next run <code>hg sync</code>.
</p>
+<p>
+If you are a committer, you can run:
+</p>
+
+<pre>
+$ hg submit 99999
+</pre>
+
+<p>
+This checks the change into the repository.
+The change description will include a link to the code review,
+and the code review will be updated with a link to the change
+in the repository.
+</p>
-<h3 id="copyright">Copyright</h3>
+<p>
+If your local copy of the repository is out of date,
+<code>hg submit</code> will refuse the change:
+</p>
+
+<pre>
+$ hg submit 99999
+local repository out of date; must sync before submit
+</pre>
+
+<h2 id="copyright">Copyright</h2>
<p>Files in the Go repository don't list author names,
both to avoid clutter and to avoid having to keep the lists up to date.
@@ -497,7 +587,7 @@ and perhaps the <a href="/AUTHORS"><code>AUTHORS</code></a> file.
<p>The <a href="/CONTRIBUTORS"><code>CONTRIBUTORS</code></a> file
defines who the Go contributors&mdash;the people&mdash;are;
-the <a href="/AUTHORS"><code>AUTHORS</code></a> file, which defines
+the <a href="/AUTHORS"><code>AUTHORS</code></a> file defines
who &ldquo;The Go Authors&rdquo;&mdash;the copyright holders&mdash;are.
The Go developers at Google will update these files when submitting
your first change.
@@ -525,7 +615,12 @@ This rigmarole needs to be done only for your first submission.
<p>Code that you contribute should use the standard copyright header:</p>
<pre>
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
</pre>
+
+<p>
+Files in the repository are copyright the year they are added. It is not
+necessary to update the copyright year on files that you change.
+</p>