···11+# This is the list of CUE authors for copyright purposes.
22+#
33+# This does not necessarily list everyone who has contributed code, since in
44+# some cases, their employer may be the copyright holder. To see the full list
55+# of contributors, see the revision history in source control.
66+Google LLC
+30
CONTRIBUTING.md
···11+# Contributing to CUE
22+33+CUE is an open source project.
44+55+We'd love to accept your patches and contributions to this project. There are
66+just a few small guidelines you need to follow.
77+88+## Contributor License Agreement
99+1010+Contributions to this project must be accompanied by a Contributor License
1111+Agreement. You (or your employer) retain the copyright to your contribution;
1212+this simply gives us permission to use and redistribute your contributions as
1313+part of the project. Head over to <https://cla.developers.google.com/> to see
1414+your current agreements on file or to sign a new one.
1515+1616+You generally only need to submit a CLA once, so if you've already submitted one
1717+(even if it was for a different project), you probably don't need to do it
1818+again.
1919+2020+## Code reviews
2121+2222+All submissions, including submissions by project members, require review. We
2323+use Gerrit code reviews at https://cue-review.googlesource.com for this purpose.
2424+Please read the [Contributing Guidelines][./doc/contribute.html]
2525+before reading patches.
2626+2727+## Community Guidelines
2828+2929+This project follows [Google's Open Source Community
3030+Guidelines](https://opensource.google.com/conduct/).
+202
LICENSE
···11+22+ Apache License
33+ Version 2.0, January 2004
44+ http://www.apache.org/licenses/
55+66+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
77+88+ 1. Definitions.
99+1010+ "License" shall mean the terms and conditions for use, reproduction,
1111+ and distribution as defined by Sections 1 through 9 of this document.
1212+1313+ "Licensor" shall mean the copyright owner or entity authorized by
1414+ the copyright owner that is granting the License.
1515+1616+ "Legal Entity" shall mean the union of the acting entity and all
1717+ other entities that control, are controlled by, or are under common
1818+ control with that entity. For the purposes of this definition,
1919+ "control" means (i) the power, direct or indirect, to cause the
2020+ direction or management of such entity, whether by contract or
2121+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
2222+ outstanding shares, or (iii) beneficial ownership of such entity.
2323+2424+ "You" (or "Your") shall mean an individual or Legal Entity
2525+ exercising permissions granted by this License.
2626+2727+ "Source" form shall mean the preferred form for making modifications,
2828+ including but not limited to software source code, documentation
2929+ source, and configuration files.
3030+3131+ "Object" form shall mean any form resulting from mechanical
3232+ transformation or translation of a Source form, including but
3333+ not limited to compiled object code, generated documentation,
3434+ and conversions to other media types.
3535+3636+ "Work" shall mean the work of authorship, whether in Source or
3737+ Object form, made available under the License, as indicated by a
3838+ copyright notice that is included in or attached to the work
3939+ (an example is provided in the Appendix below).
4040+4141+ "Derivative Works" shall mean any work, whether in Source or Object
4242+ form, that is based on (or derived from) the Work and for which the
4343+ editorial revisions, annotations, elaborations, or other modifications
4444+ represent, as a whole, an original work of authorship. For the purposes
4545+ of this License, Derivative Works shall not include works that remain
4646+ separable from, or merely link (or bind by name) to the interfaces of,
4747+ the Work and Derivative Works thereof.
4848+4949+ "Contribution" shall mean any work of authorship, including
5050+ the original version of the Work and any modifications or additions
5151+ to that Work or Derivative Works thereof, that is intentionally
5252+ submitted to Licensor for inclusion in the Work by the copyright owner
5353+ or by an individual or Legal Entity authorized to submit on behalf of
5454+ the copyright owner. For the purposes of this definition, "submitted"
5555+ means any form of electronic, verbal, or written communication sent
5656+ to the Licensor or its representatives, including but not limited to
5757+ communication on electronic mailing lists, source code control systems,
5858+ and issue tracking systems that are managed by, or on behalf of, the
5959+ Licensor for the purpose of discussing and improving the Work, but
6060+ excluding communication that is conspicuously marked or otherwise
6161+ designated in writing by the copyright owner as "Not a Contribution."
6262+6363+ "Contributor" shall mean Licensor and any individual or Legal Entity
6464+ on behalf of whom a Contribution has been received by Licensor and
6565+ subsequently incorporated within the Work.
6666+6767+ 2. Grant of Copyright License. Subject to the terms and conditions of
6868+ this License, each Contributor hereby grants to You a perpetual,
6969+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
7070+ copyright license to reproduce, prepare Derivative Works of,
7171+ publicly display, publicly perform, sublicense, and distribute the
7272+ Work and such Derivative Works in Source or Object form.
7373+7474+ 3. Grant of Patent License. Subject to the terms and conditions of
7575+ this License, each Contributor hereby grants to You a perpetual,
7676+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
7777+ (except as stated in this section) patent license to make, have made,
7878+ use, offer to sell, sell, import, and otherwise transfer the Work,
7979+ where such license applies only to those patent claims licensable
8080+ by such Contributor that are necessarily infringed by their
8181+ Contribution(s) alone or by combination of their Contribution(s)
8282+ with the Work to which such Contribution(s) was submitted. If You
8383+ institute patent litigation against any entity (including a
8484+ cross-claim or counterclaim in a lawsuit) alleging that the Work
8585+ or a Contribution incorporated within the Work constitutes direct
8686+ or contributory patent infringement, then any patent licenses
8787+ granted to You under this License for that Work shall terminate
8888+ as of the date such litigation is filed.
8989+9090+ 4. Redistribution. You may reproduce and distribute copies of the
9191+ Work or Derivative Works thereof in any medium, with or without
9292+ modifications, and in Source or Object form, provided that You
9393+ meet the following conditions:
9494+9595+ (a) You must give any other recipients of the Work or
9696+ Derivative Works a copy of this License; and
9797+9898+ (b) You must cause any modified files to carry prominent notices
9999+ stating that You changed the files; and
100100+101101+ (c) You must retain, in the Source form of any Derivative Works
102102+ that You distribute, all copyright, patent, trademark, and
103103+ attribution notices from the Source form of the Work,
104104+ excluding those notices that do not pertain to any part of
105105+ the Derivative Works; and
106106+107107+ (d) If the Work includes a "NOTICE" text file as part of its
108108+ distribution, then any Derivative Works that You distribute must
109109+ include a readable copy of the attribution notices contained
110110+ within such NOTICE file, excluding those notices that do not
111111+ pertain to any part of the Derivative Works, in at least one
112112+ of the following places: within a NOTICE text file distributed
113113+ as part of the Derivative Works; within the Source form or
114114+ documentation, if provided along with the Derivative Works; or,
115115+ within a display generated by the Derivative Works, if and
116116+ wherever such third-party notices normally appear. The contents
117117+ of the NOTICE file are for informational purposes only and
118118+ do not modify the License. You may add Your own attribution
119119+ notices within Derivative Works that You distribute, alongside
120120+ or as an addendum to the NOTICE text from the Work, provided
121121+ that such additional attribution notices cannot be construed
122122+ as modifying the License.
123123+124124+ You may add Your own copyright statement to Your modifications and
125125+ may provide additional or different license terms and conditions
126126+ for use, reproduction, or distribution of Your modifications, or
127127+ for any such Derivative Works as a whole, provided Your use,
128128+ reproduction, and distribution of the Work otherwise complies with
129129+ the conditions stated in this License.
130130+131131+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132132+ any Contribution intentionally submitted for inclusion in the Work
133133+ by You to the Licensor shall be under the terms and conditions of
134134+ this License, without any additional terms or conditions.
135135+ Notwithstanding the above, nothing herein shall supersede or modify
136136+ the terms of any separate license agreement you may have executed
137137+ with Licensor regarding such Contributions.
138138+139139+ 6. Trademarks. This License does not grant permission to use the trade
140140+ names, trademarks, service marks, or product names of the Licensor,
141141+ except as required for reasonable and customary use in describing the
142142+ origin of the Work and reproducing the content of the NOTICE file.
143143+144144+ 7. Disclaimer of Warranty. Unless required by applicable law or
145145+ agreed to in writing, Licensor provides the Work (and each
146146+ Contributor provides its Contributions) on an "AS IS" BASIS,
147147+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148148+ implied, including, without limitation, any warranties or conditions
149149+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150150+ PARTICULAR PURPOSE. You are solely responsible for determining the
151151+ appropriateness of using or redistributing the Work and assume any
152152+ risks associated with Your exercise of permissions under this License.
153153+154154+ 8. Limitation of Liability. In no event and under no legal theory,
155155+ whether in tort (including negligence), contract, or otherwise,
156156+ unless required by applicable law (such as deliberate and grossly
157157+ negligent acts) or agreed to in writing, shall any Contributor be
158158+ liable to You for damages, including any direct, indirect, special,
159159+ incidental, or consequential damages of any character arising as a
160160+ result of this License or out of the use or inability to use the
161161+ Work (including but not limited to damages for loss of goodwill,
162162+ work stoppage, computer failure or malfunction, or any and all
163163+ other commercial damages or losses), even if such Contributor
164164+ has been advised of the possibility of such damages.
165165+166166+ 9. Accepting Warranty or Additional Liability. While redistributing
167167+ the Work or Derivative Works thereof, You may choose to offer,
168168+ and charge a fee for, acceptance of support, warranty, indemnity,
169169+ or other liability obligations and/or rights consistent with this
170170+ License. However, in accepting such obligations, You may act only
171171+ on Your own behalf and on Your sole responsibility, not on behalf
172172+ of any other Contributor, and only if You agree to indemnify,
173173+ defend, and hold each Contributor harmless for any liability
174174+ incurred by, or claims asserted against, such Contributor by reason
175175+ of your accepting any such warranty or additional liability.
176176+177177+ END OF TERMS AND CONDITIONS
178178+179179+ APPENDIX: How to apply the Apache License to your work.
180180+181181+ To apply the Apache License to your work, attach the following
182182+ boilerplate notice, with the fields enclosed by brackets "[]"
183183+ replaced with your own identifying information. (Don't include
184184+ the brackets!) The text should be enclosed in the appropriate
185185+ comment syntax for the file format. We also recommend that a
186186+ file or class name and description of purpose be included on the
187187+ same "printed page" as the copyright notice for easier
188188+ identification within third-party archives.
189189+190190+ Copyright [yyyy] [name of copyright owner]
191191+192192+ Licensed under the Apache License, Version 2.0 (the "License");
193193+ you may not use this file except in compliance with the License.
194194+ You may obtain a copy of the License at
195195+196196+ http://www.apache.org/licenses/LICENSE-2.0
197197+198198+ Unless required by applicable law or agreed to in writing, software
199199+ distributed under the License is distributed on an "AS IS" BASIS,
200200+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201201+ See the License for the specific language governing permissions and
202202+ limitations under the License.
+72
README.md
···11+# The CUE Configuration Language
22+33+_Configure, Unify, Execute_
44+55+CUE is an open source configuration language which aims
66+to make complex configurations more manageable and usable.
77+88+CUE is a constrained-based language.
99+Constraints provide a powerful yet simple alternative
1010+to inheritance, a common source of complexity
1111+with other languages.
1212+The CUE tooling also provides powerful integrated scripting
1313+aimed at improving the overall experience of putting
1414+configurations to good use.
1515+1616+Features highlights:
1717+1818+- JSON superset: get started quickly
1919+- convert existing YAML and JSON
2020+- reformatter
2121+- automatically simplify configurations
2222+- powerful scripting
2323+- rich APIs designed for automated tooling
2424+- a formalism conducive to automated reasoning
2525+- generate CUE templates from source code
2626+2727+2828+### Download and Install
2929+3030+#### Install From Source
3131+3232+If you already have Go installed, the short version is:
3333+3434+```
3535+go get -u cuelang.org/go/cmd/cue
3636+```
3737+3838+This will install the `cue` command line tool.
3939+4040+For more details see [Installing CUE][./doc/install.md].
4141+4242+4343+### Learning CUE
4444+4545+A demonstration of how to convert and restructure and existing
4646+set of Kubernetes configurations is available in
4747+[written form][./doc/demo/kubernetes/Readme.md] or as
4848+[video]().
4949+5050+### References
5151+5252+- [Language Specification][./doc/ref/spec.md]: official CUE Language specification.
5353+5454+- [API](https://godoc.org/cuelang.org/go/cue): the API on godoc.org
5555+5656+- [Builtin packages](https://godoc.org/cuelang.org/go/pkg): builtins available from CUE programs
5757+5858+- [`cue` Command line reference][./doc/cmd/cue.md]: the `cue` command
5959+6060+6161+### Contributing
6262+6363+Our canonical Git repository is located at https://cue.googlesource.com.
6464+6565+To contribute, please read the [Contribution Guidelines][./CONTRIBUTING.md]
6666+6767+##### Note that we do not accept pull requests and that we use the issue tracker for bug reports and proposals only.
6868+6969+Unless otherwise noted, the CUE source files are distributed
7070+under the Apache 2.0 license found in the LICENSE file.
7171+7272+
+1153
doc/contribute.md
···11+# Contribution Guide
22+33+<p>
44+The CUE project welcomes all contributors.
55+</p>
66+77+<p>
88+This document is a guide to help you through the process
99+of contributing to the CUE project, which is a little different
1010+from that used by other open source projects.
1111+We assume you have a basic understanding of Git and Go.
1212+</p>
1313+1414+<h2 id="contributor">Becoming a contributor</h2>
1515+1616+<h3>Overview</h3>
1717+1818+<p>
1919+The first step is registering as a CUE contributor and configuring your environment.
2020+Here is a checklist of the required steps to follow:
2121+</p>
2222+2323+<ul>
2424+<li>
2525+<b>Step 0</b>: Decide on a single Google Account you will be using to contribute to CUE.
2626+Use that account for all the following steps and make sure that <code>git</code>
2727+is configured to create commits with that account's e-mail address.
2828+</li>
2929+<li>
3030+<b>Step 1</b>: <a href="https://cla.developers.google.com/clas">Sign and submit</a> a
3131+CLA (Contributor License Agreement).
3232+</li>
3333+<li>
3434+<b>Step 2</b>: Configure authentication credentials for the CUE Git repository.
3535+Visit <a href="https://cue.googlesource.com/">cue.googlesource.com</a>, click
3636+on "Generate Password" (top right), and follow the instructions.
3737+</li>
3838+<li>
3939+<b>Step 3</b>: Register for Gerrit, the code review tool used by the CUE team,
4040+by <a href="https://cue-review.googlesource.com/login/">visiting this page</a>.
4141+The CLA and the registration need to be done only once for your account.
4242+</li>
4343+<li>
4444+<b>Step 4</b>: Install <code>git-codereview</code> by running
4545+<code>go get -u golang.org/x/review/git-codereview</code>
4646+</li>
4747+</ul>
4848+4949+<!-- TODO
5050+<p>
5151+If you prefer, there is an automated tool that walks through these steps.
5252+Just run:
5353+</p>
5454+5555+<pre>
5656+$ go get -u cuelang.org/x/tools/cmd/cue-contrib-init
5757+$ cd /code/to/edit
5858+$ cue-contrib-init
5959+</pre>
6060+--->
6161+6262+<p>
6363+The rest of this chapter elaborates on these instructions.
6464+If you have completed the steps above (either manually or through the tool), jump to
6565+<a href="#before_contributing">Before contributing code</a>.
6666+</p>
6767+6868+<h3 id="google_account">Step 0: Select a Google Account</h3>
6969+7070+<p>
7171+A contribution to CUE is made through a Google account with a specific
7272+e-mail address.
7373+Make sure to use the same account throughout the process and
7474+for all your subsequent contributions.
7575+You may need to decide whether to use a personal address or a corporate address.
7676+The choice will depend on who
7777+will own the copyright for the code that you will be writing
7878+and submitting.
7979+You might want to discuss this topic with your employer before deciding which
8080+account to use.
8181+</p>
8282+8383+<p>
8484+Google accounts can either be Gmail e-mail accounts, G Suite organization accounts, or
8585+accounts associated with an external e-mail address.
8686+For instance, if you need to use
8787+an existing corporate e-mail that is not managed through G Suite, you can create
8888+an account associated
8989+<a href="https://accounts.google.com/SignUpWithoutGmail">with your existing
9090+e-mail address</a>.
9191+</p>
9292+9393+<p>
9494+You also need to make sure that your Git tool is configured to create commits
9595+using your chosen e-mail address.
9696+You can either configure Git globally
9797+(as a default for all projects), or locally (for a single specific project).
9898+You can check the current configuration with this command:
9999+</p>
100100+101101+<pre>
102102+$ git config --global user.email # check current global config
103103+$ git config user.email # check current local config
104104+</pre>
105105+106106+<p>
107107+To change the configured address:
108108+</p>
109109+110110+<pre>
111111+$ git config --global user.email name@example.com # change global config
112112+$ git config user.email name@example.com # change local config
113113+</pre>
114114+115115+116116+<h3 id="cla">Step 1: Contributor License Agreement</h3>
117117+118118+<p>
119119+Before sending your first change to the CUE project
120120+you must have completed one of the following two CLAs.
121121+Which CLA you should sign depends on who owns the copyright to your work.
122122+</p>
123123+124124+<ul>
125125+<li>
126126+If you are the copyright holder, you will need to agree to the
127127+<a href="https://developers.google.com/open-source/cla/individual">individual
128128+contributor license agreement</a>, which can be completed online.
129129+</li>
130130+<li>
131131+If your organization is the copyright holder, the organization
132132+will need to agree to the
133133+<a href="https://developers.google.com/open-source/cla/corporate">corporate
134134+contributor license agreement</a>.<br>
135135+</li>
136136+</ul>
137137+138138+<p>
139139+You can check your currently signed agreements and sign new ones at
140140+the <a href="https://cla.developers.google.com/clas?pli=1&authuser=1">Google Developers
141141+Contributor License Agreements</a> website.
142142+If the copyright holder for your contribution has already completed the
143143+agreement in connection with another Google open source project,
144144+it does not need to be completed again.
145145+</p>
146146+147147+<p>
148148+If the copyright holder for the code you are submitting changes—for example,
149149+if you start contributing code on behalf of a new company—please send mail
150150+to the <a href="mailto:cue-dev@googlegroups.com"><code>cue-dev</code>
151151+mailing list</a>.
152152+This will let us know the situation so we can make sure an appropriate agreement is
153153+completed and update the <code>AUTHORS</code> file.
154154+</p>
155155+156156+157157+<h3 id="config_git_auth">Step 2: Configure git authentication</h3>
158158+159159+<p>
160160+The main CUE repository is located at
161161+<a href="https://cue.googlesource.com">cue.googlesource.com</a>,
162162+a Git server hosted by Google.
163163+Authentication on the web server is made through your Google account, but
164164+you also need to configure <code>git</code> on your computer to access it.
165165+Follow this steps:
166166+</p>
167167+168168+<ol>
169169+<li>
170170+Visit <a href="https://cue.googlesource.com">cue.googlesource.com</a>
171171+and click on "Generate Password" in the page's top right menu bar.
172172+You will be redirected to accounts.google.com to sign in.
173173+</li>
174174+<li>
175175+After signing in, you will be taken to a page with the title "Configure Git".
176176+This page contains a personalized script that when run locally will configure Git
177177+to hold your unique authentication key.
178178+This key is paired with one that is generated and stored on the server,
179179+analogous to how SSH keys work.
180180+</li>
181181+<li>
182182+Copy and run this script locally in your terminal to store your secret
183183+authentication token in a <code>.gitcookies</code> file.
184184+If you are using a Windows computer and running <code>cmd</code>,
185185+you should instead follow the instructions in the yellow box to run the command;
186186+otherwise run the regular script.
187187+</li>
188188+</ol>
189189+190190+<h3 id="auth">Step 3: Create a Gerrit account </h3>
191191+192192+<p>
193193+Gerrit is an open-source tool used by CUE maintainers to discuss and review
194194+code submissions.
195195+</p>
196196+197197+<p>
198198+To register your account, visit <a href="https://cue-review.googlesource.com/login/">
199199+cue-review.googlesource.com/login/</a> and sign in once using the same Google Account you used above.
200200+</p>
201201+202202+<h3 id="git-codereview_install">Step 4: Install the git-codereview command</h3>
203203+204204+<p>
205205+Changes to CUE must be reviewed before they are accepted, no matter who makes the change.
206206+A custom <code>git</code> command called <code>git-codereview</code>
207207+simplifies sending changes to Gerrit.
208208+</p>
209209+210210+<p>
211211+Install the <code>git-codereview</code> command by running,
212212+</p>
213213+214214+<pre>
215215+$ go get -u golang.org/x/review/git-codereview
216216+</pre>
217217+218218+<p>
219219+Make sure <code>git-codereview</code> is installed in your shell path, so that the
220220+<code>git</code> command can find it.
221221+Check that
222222+</p>
223223+224224+<pre>
225225+$ git codereview help
226226+</pre>
227227+228228+<p>
229229+prints help text, not an error.
230230+</p>
231231+232232+<p>
233233+On Windows, when using git-bash you must make sure that
234234+<code>git-codereview.exe</code> is in your <code>git</code> exec-path.
235235+Run <code>git --exec-path</code> to discover the right location then create a
236236+symbolic link or just copy the executable from $GOPATH/bin to this directory.
237237+</p>
238238+239239+240240+<h2 id="before_contributing">Before contributing code</h2>
241241+242242+<!--
243243+TODO
244244+<p>
245245+The project welcomes code patches, but to make sure things are well
246246+coordinated you should discuss any significant change before starting
247247+the work.
248248+It's recommended that you signal your intention to contribute in the
249249+issue tracker, either by <a href="https://cuelang.org/issue/new">filing
250250+a new issue</a> or by claiming
251251+an <a href="https://cuelang.org/issues">existing one</a>.
252252+</p>
253253+-->
254254+255255+<h3>Check the issue tracker</h3>
256256+257257+<p>
258258+Whether you already know what contribution to make, or you are searching for
259259+an idea, the <a href="https://github.com/cuelang/core/issues">issue tracker</a> is
260260+always the first place to go.
261261+Issues are triaged to categorize them and manage the workflow.
262262+</p>
263263+264264+<p>
265265+Most issues will be marked with one of the following workflow labels:
266266+</p>
267267+268268+<ul>
269269+ <li>
270270+ <b>NeedsInvestigation</b>: The issue is not fully understood
271271+ and requires analysis to understand the root cause.
272272+ </li>
273273+ <li>
274274+ <b>NeedsDecision</b>: the issue is relatively well understood, but the
275275+ CUE team hasn't yet decided the best way to address it.
276276+ It would be better to wait for a decision before writing code.
277277+ If you are interested on working on an issue in this state,
278278+ feel free to "ping" maintainers in the issue's comments
279279+ if some time has passed without a decision.
280280+ </li>
281281+ <li>
282282+ <b>NeedsFix</b>: the issue is fully understood and code can be written
283283+ to fix it.
284284+ </li>
285285+</ul>
286286+287287+<p>
288288+You can use GitHub's search functionality to find issues to help out with. Examples:
289289+</p>
290290+291291+<ul>
292292+ <li>
293293+ Issues that need investigation: <a href="https://github.com/cuelang/core/issues?q=is%3Aissue+is%3Aopen+label%3ANeedsInvestigation"><code>is:issue is:open label:NeedsInvestigation</code></a>
294294+ </li>
295295+ <li>
296296+ Issues that need a fix: <a href="https://github.com/cuelang/core/issues?q=is%3Aissue+is%3Aopen+label%3ANeedsFix"><code>is:issue is:open label:NeedsFix</code></a>
297297+ </li>
298298+ <li>
299299+ Issues that need a fix and have a CL: <a href="https://github.com/cuelang/core/issues?q=is%3Aissue+is%3Aopen+label%3ANeedsFix+%22golang.org%2Fcl%22"><code>is:issue is:open label:NeedsFix "cuelang.org/cl"</code></a>
300300+ </li>
301301+ <li>
302302+ Issues that need a fix and do not have a CL: <a href="https://github.com/cuelang/core/issues?q=is%3Aissue+is%3Aopen+label%3ANeedsFix+NOT+%22golang.org%2Fcl%22"><code>is:issue is:open label:NeedsFix NOT "cuelang.org/cl"</code></a>
303303+ </li>
304304+</ul>
305305+306306+<h3 id="design">Open an issue for any new problem</h3>
307307+308308+<p>
309309+Excluding very trivial changes, all contributions should be connected
310310+to an existing issue.
311311+Feel free to open one and discuss your plans.
312312+This process gives everyone a chance to validate the design,
313313+helps prevent duplication of effort,
314314+and ensures that the idea fits inside the goals for the language and tools.
315315+It also checks that the design is sound before code is written;
316316+the code review tool is not the place for high-level discussions.
317317+</p>
318318+319319+<!--
320320+TODO
321321+<p>
322322+When planning work, please note that the CUE project follows a <a
323323+href="https://cuelang.org/wiki/CUE-Release-Cycle">six-month development cycle</a>.
324324+The latter half of each cycle is a three-month feature freeze during
325325+which only bug fixes and documentation updates are accepted.
326326+New contributions can be sent during a feature freeze, but they will
327327+not be merged until the freeze is over.
328328+</p>
329329+330330+<p>
331331+Significant changes to the language, libraries, or tools must go
332332+through the
333333+<a href="https://cuelang.org/s/proposal-process">change proposal process</a>
334334+before they can be accepted.
335335+</p>
336336+337337+<p>
338338+Sensitive security-related issues (only!) should be reported to <a href="mailto:security@cuelang.org">security@cuelang.org</a>.
339339+</p>
340340+341341+<h2 id="sending_a_change_github">Sending a change via GitHub</h2>
342342+343343+<p>
344344+First-time contributors that are already familiar with the
345345+<a href="https://guides.github.com/introduction/flow/">GitHub flow</a>
346346+are encouraged to use the same process for CUE contributions.
347347+Even though CUE
348348+maintainers use Gerrit for code review, a bot called Gopherbot has been created to sync
349349+GitHub pull requests to Gerrit.
350350+</p>
351351+352352+<p>
353353+Open a pull request as you normally would.
354354+Gopherbot will create a corresponding Gerrit change and post a link to
355355+it on your GitHub pull request; updates to the pull request will also
356356+get reflected in the Gerrit change.
357357+When somebody comments on the change, their comment will be also
358358+posted in your pull request, so you will get a notification.
359359+</p>
360360+361361+<p>
362362+Some things to keep in mind:
363363+</p>
364364+365365+<ul>
366366+<li>
367367+To update the pull request with new code, just push it to the branch; you can either
368368+add more commits, or rebase and force-push (both styles are accepted).
369369+</li>
370370+<li>
371371+If the request is accepted, all commits will be squashed, and the final
372372+commit description will be composed by concatenating the pull request's
373373+title and description.
374374+The individual commits' descriptions will be discarded.
375375+See <a href="#commit_messages">Writing good commit messages</a> for some
376376+suggestions.
377377+</li>
378378+<li>
379379+Gopherbot is unable to sync line-by-line codereview into GitHub: only the
380380+contents of the overall comment on the request will be synced.
381381+Remember you can always visit Gerrit to see the fine-grained review.
382382+</li>
383383+</ul>
384384+-->
385385+386386+<h2 id="sending_a_change_gerrit">Sending a change via Gerrit</h2>
387387+388388+<p>
389389+It is not possible to fully sync Gerrit and GitHub, at least at the moment,
390390+so we recommend learning Gerrit.
391391+It's different but powerful and familiarity
392392+with help you understand the flow.
393393+</p>
394394+395395+<h3>Overview</h3>
396396+397397+<p>
398398+This is an overview of the overall process:
399399+</p>
400400+401401+<ul>
402402+<li>
403403+<b>Step 1:</b> Clone the CUE source code from cue.googlesource.com
404404+and make sure it's stable by compiling and testing it once:
405405+<pre>
406406+$ git clone https://cue.googlesource.com/core
407407+$ cd core
408408+$ go test ./...
409409+$ go install ./cmd/cue
410410+</pre>
411411+</li>
412412+413413+<li>
414414+<b>Step 2:</b> Prepare changes in a new branch, created from the master branch.
415415+To commit the changes, use <code>git</code> <code>codereview</code> <code>change</code>; that
416416+will create or amend a single commit in the branch.
417417+<pre>
418418+$ git checkout -b mybranch
419419+$ [edit files...]
420420+$ git add [files...]
421421+$ git codereview change # create commit in the branch
422422+$ [edit again...]
423423+$ git add [files...]
424424+$ git codereview change # amend the existing commit with new changes
425425+$ [etc.]
426426+</pre>
427427+</li>
428428+429429+<li>
430430+<b>Step 3:</b> Test your changes, re-running <code>go test</code>.
431431+<pre>
432432+$ go test ./... # recompile and test
433433+</pre>
434434+</li>
435435+436436+<li>
437437+<b>Step 4:</b> Send the changes for review to Gerrit using <code>git</code>
438438+<code>codereview</code> <code>mail</code> (which doesn't use e-mail, despite the name).
439439+<pre>
440440+$ git codereview mail # send changes to Gerrit
441441+</pre>
442442+</li>
443443+444444+<li>
445445+<b>Step 5:</b> After a review, apply changes to the same single commit
446446+and mail them to Gerrit again:
447447+<pre>
448448+$ [edit files...]
449449+$ git add [files...]
450450+$ git codereview change # update same commit
451451+$ git codereview mail # send to Gerrit again
452452+</pre>
453453+</li>
454454+</ul>
455455+456456+<p>
457457+The rest of this section describes these steps in more detail.
458458+</p>
459459+460460+461461+<h3 id="checkout_go">Step 1: Clone the CUE source code</h3>
462462+463463+<p>
464464+In addition to a recent CUE installation, you need to have a local copy of the source
465465+checked out from the correct repository.
466466+You can check out the CUE source repo onto your local file system anywhere
467467+you want as long as it's outside your <code>GOPATH</code>.
468468+Either clone from
469469+<code>cue.googlesource.com</code> or from GitHub:
470470+</p>
471471+472472+<pre>
473473+$ git clone https://github.com/cuelang/core # or https://cue.googlesource.com/core
474474+$ cd core
475475+$ go test ./...
476476+# go install ./cmd/cue
477477+</pre>
478478+479479+<h3 id="make_branch">Step 2: Prepare changes in a new branch</h3>
480480+481481+<p>
482482+Each CUE change must be made in a separate branch, created from the master branch.
483483+You can use
484484+the normal <code>git</code> commands to create a branch and add changes to the
485485+staging area:
486486+</p>
487487+488488+<pre>
489489+$ git checkout -b mybranch
490490+$ [edit files...]
491491+$ git add [files...]
492492+</pre>
493493+494494+<p>
495495+To commit changes, instead of <code>git commit</code>, use <code>git codereview change</code>.
496496+</p>
497497+498498+<pre>
499499+$ git codereview change
500500+(open $EDITOR)
501501+</pre>
502502+503503+<p>
504504+You can edit the commit description in your favorite editor as usual.
505505+The <code>git</code> <code>codereview</code> <code>change</code> command
506506+will automatically add a unique Change-Id line near the bottom.
507507+That line is used by Gerrit to match successive uploads of the same change.
508508+Do not edit or delete it.
509509+A Change-Id looks like this:
510510+</p>
511511+512512+<pre>
513513+Change-Id: I2fbdbffb3aab626c4b6f56348861b7909e3e8990
514514+</pre>
515515+516516+<p>
517517+The tool also checks that you've
518518+run <code>go</code> <code>fmt</code> over the source code, and that
519519+the commit message follows the <a href="#commit_messages">suggested format</a>.
520520+</p>
521521+522522+<p>
523523+If you need to edit the files again, you can stage the new changes and
524524+re-run <code>git</code> <code>codereview</code> <code>change</code>: each subsequent
525525+run will amend the existing commit while preserving the Change-Id.
526526+</p>
527527+528528+<p>
529529+Make sure that you always keep a single commit in each branch.
530530+If you add more
531531+commits by mistake, you can use <code>git</code> <code>rebase</code> to
532532+<a href="https://stackoverflow.com/questions/31668794/squash-all-your-commits-in-one-before-a-pull-request-in-github">squash them together</a>
533533+into a single one.
534534+</p>
535535+536536+537537+<h3 id="testing">Step 3: Test your changes</h3>
538538+539539+<p>
540540+You've <a href="code.html">written and tested your code</a>, but
541541+before sending code out for review, run <i>all the tests for the whole
542542+tree</i> to make sure the changes don't break other packages or programs:
543543+</p>
544544+545545+<pre>
546546+$ go test ./...
547547+</pre>
548548+549549+550550+<h3 id="mail">Step 4: Send changes for review</h3>
551551+552552+<p>
553553+Once the change is ready and tested over the whole tree, send it for review.
554554+This is done with the <code>mail</code> sub-command which, despite its name, doesn't
555555+directly mail anything; it just sends the change to Gerrit:
556556+</p>
557557+558558+<pre>
559559+$ git codereview mail
560560+</pre>
561561+562562+<p>
563563+Gerrit assigns your change a number and URL, which <code>git</code> <code>codereview</code> <code>mail</code> will print, something like:
564564+</p>
565565+566566+<pre>
567567+remote: New Changes:
568568+remote: https://cue-review.googlesource.com/99999 math: improved Sin, Cos and Tan precision for very large arguments
569569+</pre>
570570+571571+<p>
572572+If you get an error instead, check the
573573+<a href="#troubleshooting_mail">Troubleshooting mail errors</a> section.
574574+</p>
575575+576576+<p>
577577+If your change relates to an open GitHub issue and you have followed the <a href="#commit_messages">
578578+suggested commit message format</a>, the issue will be updated in a few minutes by a bot,
579579+linking your Gerrit change to it in the comments.
580580+</p>
581581+582582+583583+<h3 id="revise">Step 5: Revise changes after a review</h3>
584584+585585+<p>
586586+CUE maintainers will review your code on Gerrit, and you will get notifications via e-mail.
587587+You can see the review on Gerrit and comment on them there.
588588+You can also reply
589589+<a href="https://gerrit-review.googlesource.com/Documentation/intro-user.html#reply-by-email">using e-mail</a>
590590+if you prefer.
591591+</p>
592592+593593+<p>
594594+If you need to revise your change after the review, edit the files in
595595+the same branch you previously created, add them to the Git staging
596596+area, and then amend the commit with
597597+<code>git</code> <code>codereview</code> <code>change</code>:
598598+</p>
599599+600600+<pre>
601601+$ git codereview change # amend current commit
602602+(open $EDITOR)
603603+$ git codereview mail # send new changes to Gerrit
604604+</pre>
605605+606606+<p>
607607+If you don't need to change the commit description, just save and exit from the editor.
608608+Remember not to touch the special Change-Id line.
609609+</p>
610610+611611+<p>
612612+Again, make sure that you always keep a single commit in each branch.
613613+If you add more
614614+commits by mistake, you can use <code>git rebase</code> to
615615+<a href="https://stackoverflow.com/questions/31668794/squash-all-your-commits-in-one-before-a-pull-request-in-github">squash them together</a>
616616+into a single one.
617617+</p>
618618+619619+<h2 id="commit_messages">Good commit messages</h2>
620620+621621+<p>
622622+Commit messages in CUE follow a specific set of conventions,
623623+which we discuss in this section.
624624+</p>
625625+626626+<p>
627627+Here is an example of a good one:
628628+</p>
629629+630630+<pre>
631631+math: improve Sin, Cos and Tan precision for very large arguments
632632+633633+The existing implementation has poor numerical properties for
634634+large arguments, so use the McGillicutty algorithm to improve
635635+accuracy above 1e10.
636636+637637+The algorithm is described at https://wikipedia.org/wiki/McGillicutty_Algorithm
638638+639639+Fixes #159
640640+</pre>
641641+642642+<h3>First line</h3>
643643+644644+<p>
645645+The first line of the change description is conventionally a short one-line
646646+summary of the change, prefixed by the primary affected package.
647647+</p>
648648+649649+<p>
650650+A rule of thumb is that it should be written so to complete the sentence
651651+"This change modifies CUE to _____."
652652+That means it does not start with a capital letter, is not a complete sentence,
653653+and actually summarizes the result of the change.
654654+</p>
655655+656656+<p>
657657+Follow the first line by a blank line.
658658+</p>
659659+660660+<h3>Main content</h3>
661661+662662+<p>
663663+The rest of the description elaborates and should provide context for the
664664+change and explain what it does.
665665+Write in complete sentences with correct punctuation, just like
666666+for your comments in CUE.
667667+Don't use HTML, Markdown, or any other markup language.
668668+</p>
669669+670670+671671+<h3>Referencing issues</h3>
672672+673673+<p>
674674+The special notation "Fixes #12345" associates the change with issue 12345 in the
675675+<a href="https://cuelang.org/issue/12345">CUE issue tracker</a>.
676676+When this change is eventually applied, the issue
677677+tracker will automatically mark the issue as fixed.
678678+</p>
679679+680680+<p>
681681+If the change is a partial step towards the resolution of the issue,
682682+uses the notation "Updates #12345".
683683+This will leave a comment in the issue
684684+linking back to the change in Gerrit, but it will not close the issue
685685+when the change is applied.
686686+</p>
687687+688688+<p>
689689+If you are sending a change against a subrepository, you must use
690690+the fully-qualified syntax supported by GitHub to make sure the change is
691691+linked to the issue in the main repository, not the subrepository.
692692+All issues are tracked in the main repository's issue tracker.
693693+The correct form is "Fixes cuelang/core#159".
694694+</p>
695695+696696+697697+<h2 id="review">The review process</h2>
698698+699699+<p>
700700+This section explains the review process in detail and how to approach
701701+reviews after a change has been mailed.
702702+</p>
703703+704704+705705+<h3 id="mistakes">Common beginner mistakes</h3>
706706+707707+<p>
708708+When a change is sent to Gerrit, it is usually triaged within a few days.
709709+A maintainer will have a look and provide some initial review that for first-time
710710+contributors usually focuses on basic cosmetics and common mistakes.
711711+These include things like:
712712+</p>
713713+714714+<ul>
715715+<li>
716716+Commit message not following the <a href="#commit_messages">suggested
717717+format</a>.
718718+</li>
719719+720720+<li>
721721+The lack of a linked GitHub issue.
722722+The vast majority of changes
723723+require a linked issue that describes the bug or the feature that the change
724724+fixes or implements, and consensus should have been reached on the tracker
725725+before proceeding with it.
726726+Gerrit reviews do not discuss the merit of the change,
727727+just its implementation.
728728+<br>
729729+Only trivial or cosmetic changes will be accepted without an associated issue.
730730+</li>
731731+732732+<li>
733733+Change sent during the freeze phase of the development cycle, when the tree
734734+is closed for general changes.
735735+In this case,
736736+a maintainer might review the code with a line such as <code>R=go1.12</code>,
737737+which means that it will be reviewed later when the tree opens for a new
738738+development window.
739739+You can add <code>R=go1.XX</code> as a comment yourself
740740+if you know that it's not the correct time frame for the change.
741741+</li>
742742+</ul>
743743+744744+<!--
745745+TODO
746746+<h3 id="trybots">Trybots</h3>
747747+748748+<p>
749749+After an initial reading of your change, maintainers will trigger trybots,
750750+a cluster of servers that will run the full test suite on several different
751751+architectures.
752752+Most trybots complete in a few minutes, at which point a link will
753753+be posted in Gerrit where you can see the results.
754754+</p>
755755+756756+<p>
757757+If the trybot run fails, follow the link and check the full logs of the
758758+platforms on which the tests failed.
759759+Try to understand what broke, update your patch to fix it, and upload again.
760760+Maintainers will trigger a new trybot run to see
761761+if the problem was fixed.
762762+</p>
763763+764764+<p>
765765+Sometimes, the tree can be broken on some platforms for a few hours; if
766766+the failure reported by the trybot doesn't seem related to your patch, go to the
767767+<a href="https://build.cuelang.org">Build Dashboard</a> and check if the same
768768+failure appears in other recent commits on the same platform.
769769+In this case,
770770+feel free to write a comment in Gerrit to mention that the failure is
771771+unrelated to your change, to help maintainers understand the situation.
772772+</p>
773773+-->
774774+775775+<h3 id="reviews">Reviews</h3>
776776+777777+<p>
778778+The CUE community values very thorough reviews.
779779+Think of each review comment like a ticket: you are expected to somehow "close" it
780780+by acting on it, either by implementing the suggestion or convincing the
781781+reviewer otherwise.
782782+</p>
783783+784784+<p>
785785+After you update the change, go through the review comments and make sure
786786+to reply to every one.
787787+You can click the "Done" button to reply
788788+indicating that you've implemented the reviewer's suggestion; otherwise,
789789+click on "Reply" and explain why you have not, or what you have done instead.
790790+</p>
791791+792792+<p>
793793+It is perfectly normal for changes to go through several round of reviews,
794794+with one or more reviewers making new comments every time
795795+and then waiting for an updated change before reviewing again.
796796+This cycle happens even for experienced contributors, so
797797+don't be discouraged by it.
798798+</p>
799799+800800+<h3 id="votes">Voting conventions</h3>
801801+802802+<p>
803803+As they near a decision, reviewers will make a "vote" on your change.
804804+The Gerrit voting system involves an integer in the range -2 to +2:
805805+</p>
806806+807807+<ul>
808808+ <li>
809809+ <b>+2</b> The change is approved for being merged.
810810+ Only CUE maintainers can cast a +2 vote.
811811+ </li>
812812+ <li>
813813+ <b>+1</b> The change looks good, but either the reviewer is requesting
814814+ minor changes before approving it, or they are not a maintainer and cannot
815815+ approve it, but would like to encourage an approval.
816816+ </li>
817817+ <li>
818818+ <b>-1</b> The change is not good the way it is but might be fixable.
819819+ A -1 vote will always have a comment explaining why the change is unacceptable.
820820+ </li>
821821+ <li>
822822+ <b>-2</b> The change is blocked by a maintainer and cannot be approved.
823823+ Again, there will be a comment explaining the decision.
824824+ </li>
825825+</ul>
826826+827827+<h3 id="submit">Submitting an approved change</h3>
828828+829829+<p>
830830+After the code has been +2'ed, an approver will
831831+apply it to the master branch using the Gerrit user interface.
832832+This is called "submitting the change".
833833+</p>
834834+835835+<p>
836836+The two steps (approving and submitting) are separate because in some cases maintainers
837837+may want to approve it but not to submit it right away (for instance,
838838+the tree could be temporarily frozen).
839839+</p>
840840+841841+<p>
842842+Submitting a change checks it into the repository.
843843+The change description will include a link to the code review,
844844+which will be updated with a link to the change
845845+in the repository.
846846+Since the method used to integrate the changes is Git's "Cherry Pick",
847847+the commit hashes in the repository will be changed by
848848+the submit operation.
849849+</p>
850850+851851+<p>
852852+If your change has been approved for a few days without being
853853+submitted, feel free to write a comment in Gerrit requesting
854854+submission.
855855+</p>
856856+857857+858858+<!--
859859+860860+<h3 id="more_information">More information</h3>
861861+862862+TODO
863863+<p>
864864+In addition to the information here, the CUE community maintains a <a
865865+href="https://cuelang.org/wiki/CodeReview">CodeReview</a> wiki page.
866866+Feel free to contribute to this page as you learn more about the review process.
867867+</p>
868868+-->
869869+870870+871871+<h2 id="advanced_topics">Miscellaneous topics</h2>
872872+873873+<p>
874874+This section collects a number of other comments that are
875875+outside the issue/edit/code review/submit process itself.
876876+</p>
877877+878878+879879+<h3 id="copyright">Copyright headers</h3>
880880+881881+<p>
882882+Files in the CUE repository don't list author names, both to avoid clutter
883883+and to avoid having to keep the lists up to date.
884884+Instead, your name will appear in the
885885+<a href="https://cue.googlesource.com/core/+log">change log</a> and in the <a
886886+href="/CONTRIBUTORS"><code>CONTRIBUTORS</code></a> file and perhaps the <a
887887+href="/AUTHORS"><code>AUTHORS</code></a> file.
888888+These files are automatically generated from the commit logs periodically.
889889+The <a href="/AUTHORS"><code>AUTHORS</code></a> file defines who “The CUE
890890+Authors”—the copyright holders—are.
891891+</p>
892892+893893+<p>
894894+New files that you contribute should use the standard copyright header:
895895+</p>
896896+897897+<pre>
898898+// Copyright 2018 The CUE Authors
899899+//
900900+// Licensed under the Apache License, Version 2.0 (the "License");
901901+// you may not use this file except in compliance with the License.
902902+// You may obtain a copy of the License at
903903+//
904904+// http://www.apache.org/licenses/LICENSE-2.0
905905+//
906906+// Unless required by applicable law or agreed to in writing, software
907907+// distributed under the License is distributed on an "AS IS" BASIS,
908908+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
909909+// See the License for the specific language governing permissions and
910910+// limitations under the License.
911911+</pre>
912912+913913+<p>
914914+(Use the current year if you're reading this in 2019 or beyond.)
915915+Files in the repository are copyrighted the year they are added.
916916+Do not update the copyright year on files that you change.
917917+</p>
918918+919919+920920+921921+922922+<h3 id="troubleshooting_mail">Troubleshooting mail errors</h3>
923923+924924+<p>
925925+The most common way that the <code>git</code> <code>codereview</code> <code>mail</code>
926926+command fails is because the e-mail address in the commit does not match the one
927927+that you used during <a href="#google_account">the registration process</a>.
928928+929929+<br>
930930+If you see something like...
931931+</p>
932932+933933+<pre>
934934+remote: Processing changes: refs: 1, done
935935+remote:
936936+remote: ERROR: In commit ab13517fa29487dcf8b0d48916c51639426c5ee9
937937+remote: ERROR: author email address XXXXXXXXXXXXXXXXXXX
938938+remote: ERROR: does not match your user account.
939939+</pre>
940940+941941+<p>
942942+you need to configure Git for this repository to use the
943943+e-mail address that you registered with.
944944+To change the e-mail address to ensure this doesn't happen again, run:
945945+</p>
946946+947947+<pre>
948948+$ git config user.email email@address.com
949949+</pre>
950950+951951+<p>
952952+Then change the commit to use this alternative e-mail address with this command:
953953+</p>
954954+955955+<pre>
956956+$ git commit --amend --author="Author Name <email@address.com>"
957957+</pre>
958958+959959+<p>
960960+Then retry by running:
961961+</p>
962962+963963+<pre>
964964+$ git codereview mail
965965+</pre>
966966+967967+968968+<h3 id="quick_test">Quickly testing your changes</h3>
969969+970970+<p>
971971+Running <code>go test ./...</code> for every single change to the code tree
972972+is burdensome.
973973+Even though it is strongly suggested to run it before
974974+sending a change, during the normal development cycle you may want
975975+to compile and test only the package you are developing.
976976+</p>
977977+978978+<li>
979979+In this section, we'll call the directory into which you cloned the CUE repository <code>$CUEDIR</code>.
980980+As CUE uses Go modules, The <code>cue</code> tool built by
981981+<code>go install</code> will be installed in the <code>bin/go</code> in your
982982+home directory by default.
983983+</li>
984984+985985+<li>
986986+If you're changing the CUE APIs or code, you can test the results in just
987987+this package directory.
988988+989989+<pre>
990990+$ cd $CUEDIR/cue
991991+$ [make changes...]
992992+$ go test
993993+</pre>
994994+995995+You don't need to build a new cue tool to test it.
996996+Instead you can run the tests from the root.
997997+998998+<pre>
999999+$ cd $CUEDIR
10001000+$ go test ./...
10011001+</pre>
10021002+10031003+To use the new tool you would still need to build and install it.
10041004+</li>
10051005+10061006+10071007+<!--
10081008+TODO
10091009+<h3 id="subrepos">Contributing to subrepositories (cuelang.org/x/...)</h3>
10101010+10111011+<p>
10121012+If you are contributing a change to a subrepository, obtain the
10131013+CUE package using <code>go get</code>.
10141014+For example, to contribute
10151015+to <code>cuelang.org/x/editor/vscode</code>, check out the code by running:
10161016+</p>
10171017+10181018+<pre>
10191019+$ go get -d cuelang.org/editor/vscode
10201020+</pre>
10211021+10221022+<p>
10231023+Then, change your directory to the package's source directory
10241024+(<code>$GOPATH/src/cuelang.org/x/oauth2</code>), and follow the
10251025+normal contribution flow.
10261026+</p>
10271027+-->
10281028+10291029+<h3 id="cc">Specifying a reviewer / CCing others</h3>
10301030+10311031+<!--
10321032+TODO:
10331033+10341034+<p>
10351035+Unless explicitly told otherwise, such as in the discussion leading
10361036+up to sending in the change, it's better not to specify a reviewer.
10371037+All changes are automatically CC'ed to the
10381038+<a href="https://groups.google.com/group/cue-codereviews">cue-codereviews@googlegroups.com</a>
10391039+mailing list.
10401040+If this is your first ever change, there may be a moderation
10411041+delay before it appears on the mailing list, to prevent spam.
10421042+</p>
10431043+-->
10441044+10451045+<p>
10461046+You can specify a reviewer or CC interested parties
10471047+using the <code>-r</code> or <code>-cc</code> options.
10481048+Both accept a comma-separated list of e-mail addresses:
10491049+</p>
10501050+10511051+<pre>
10521052+$ git codereview mail -r joe@cuelang.org -cc mabel@example.com,math-nuts@swtch.com
10531053+</pre>
10541054+10551055+10561056+<h3 id="sync">Synchronize your client</h3>
10571057+10581058+<p>
10591059+While you were working, others might have submitted changes to the repository.
10601060+To update your local branch, run
10611061+</p>
10621062+10631063+<pre>
10641064+$ git codereview sync
10651065+</pre>
10661066+10671067+<p>
10681068+(Under the covers this runs
10691069+<code>git</code> <code>pull</code> <code>-r</code>.)
10701070+</p>
10711071+10721072+10731073+<h3 id="download">Reviewing code by others</h3>
10741074+10751075+<p>
10761076+As part of the review process reviewers can propose changes directly (in the
10771077+GitHub workflow this would be someone else attaching commits to a pull request).
10781078+10791079+You can import these changes proposed by someone else into your local Git repository.
10801080+On the Gerrit review page, click the "Download ▼" link in the upper right
10811081+corner, copy the "Checkout" command and run it from your local Git repo.
10821082+It will look something like this:
10831083+</p>
10841084+10851085+<pre>
10861086+$ git fetch https://cue.googlesource.com/review refs/changes/21/13245/1 && git checkout FETCH_HEAD
10871087+</pre>
10881088+10891089+<p>
10901090+To revert, change back to the branch you were working in.
10911091+</p>
10921092+10931093+10941094+<h3 id="git-config">Set up git aliases</h3>
10951095+10961096+<p>
10971097+The <code>git-codereview</code> command can be run directly from the shell
10981098+by typing, for instance,
10991099+</p>
11001100+11011101+<pre>
11021102+$ git codereview sync
11031103+</pre>
11041104+11051105+<p>
11061106+but it is more convenient to set up aliases for <code>git-codereview</code>'s own
11071107+subcommands, so that the above becomes,
11081108+</p>
11091109+11101110+<pre>
11111111+$ git sync
11121112+</pre>
11131113+11141114+<p>
11151115+The <code>git-codereview</code> subcommands have been chosen to be distinct from
11161116+Git's own, so it's safe to define these aliases.
11171117+To install them, copy this text into your
11181118+Git configuration file (usually <code>.gitconfig</code> in your home directory):
11191119+</p>
11201120+11211121+<pre>
11221122+[alias]
11231123+ change = codereview change
11241124+ gofmt = codereview gofmt
11251125+ mail = codereview mail
11261126+ pending = codereview pending
11271127+ submit = codereview submit
11281128+ sync = codereview sync
11291129+</pre>
11301130+11311131+11321132+<h3 id="multiple_changes">Sending multiple dependent changes</h3>
11331133+11341134+<p>
11351135+Advanced users may want to stack up related commits in a single branch.
11361136+Gerrit allows for changes to be dependent on each other, forming such a dependency chain.
11371137+Each change will need to be approved and submitted separately but the dependency
11381138+will be visible to reviewers.
11391139+</p>
11401140+11411141+<p>
11421142+To send out a group of dependent changes, keep each change as a different commit under
11431143+the same branch, and then run:
11441144+</p>
11451145+11461146+<pre>
11471147+$ git codereview mail HEAD
11481148+</pre>
11491149+11501150+<p>
11511151+Make sure to explicitly specify <code>HEAD</code>, which is usually not required when sending
11521152+single changes.
11531153+</p>