summaryrefslogtreecommitdiffstats
path: root/SUBMITTING_PATCHES.md
diff options
context:
space:
mode:
Diffstat (limited to 'SUBMITTING_PATCHES.md')
-rw-r--r--SUBMITTING_PATCHES.md135
1 files changed, 135 insertions, 0 deletions
diff --git a/SUBMITTING_PATCHES.md b/SUBMITTING_PATCHES.md
new file mode 100644
index 00000000..07f76616
--- /dev/null
+++ b/SUBMITTING_PATCHES.md
@@ -0,0 +1,135 @@
1# Short Version
2
3 - Make small logical changes.
4 - Provide a meaningful commit message.
5 - Check for coding errors and style nits with pyflakes and flake8
6 - Make sure all code is under the Apache License, 2.0.
7 - Publish your changes for review.
8 - Make corrections if requested.
9 - Verify your changes on gerrit so they can be submitted.
10
11 `git push https://gerrit-review.googlesource.com/git-repo HEAD:refs/for/master`
12
13
14# Long Version
15
16I wanted a file describing how to submit patches for repo,
17so I started with the one found in the core Git distribution
18(Documentation/SubmittingPatches), which itself was based on the
19patch submission guidelines for the Linux kernel.
20
21However there are some differences, so please review and familiarize
22yourself with the following relevant bits.
23
24
25## Make separate commits for logically separate changes.
26
27Unless your patch is really trivial, you should not be sending
28out a patch that was generated between your working tree and your
29commit head. Instead, always make a commit with complete commit
30message and generate a series of patches from your repository.
31It is a good discipline.
32
33Describe the technical detail of the change(s).
34
35If your description starts to get too long, that's a sign that you
36probably need to split up your commit to finer grained pieces.
37
38
39## Check for coding errors and style nits with pyflakes and flake8
40
41### Coding errors
42
43Run `pyflakes` on changed modules:
44
45 pyflakes file.py
46
47Ideally there should be no new errors or warnings introduced.
48
49### Style violations
50
51Run `flake8` on changes modules:
52
53 flake8 file.py
54
55Note that repo generally follows [Google's python style guide]
56(https://google.github.io/styleguide/pyguide.html) rather than [PEP 8]
57(https://www.python.org/dev/peps/pep-0008/), so it's possible that
58the output of `flake8` will be quite noisy. It's not mandatory to
59avoid all warnings, but at least the maximum line length should be
60followed.
61
62If there are many occurrences of the same warning that cannot be
63avoided without going against the Google style guide, these may be
64suppressed in the included `.flake8` file.
65
66## Check the license
67
68repo is licensed under the Apache License, 2.0.
69
70Because of this licensing model *every* file within the project
71*must* list the license that covers it in the header of the file.
72Any new contributions to an existing file *must* be submitted under
73the current license of that file. Any new files *must* clearly
74indicate which license they are provided under in the file header.
75
76Please verify that you are legally allowed and willing to submit your
77changes under the license covering each file *prior* to submitting
78your patch. It is virtually impossible to remove a patch once it
79has been applied and pushed out.
80
81
82## Sending your patches.
83
84Do not email your patches to anyone.
85
86Instead, login to the Gerrit Code Review tool at:
87
88 https://gerrit-review.googlesource.com/
89
90Ensure you have completed one of the necessary contributor
91agreements, providing documentation to the project maintainers that
92they have right to redistribute your work under the Apache License:
93
94 https://gerrit-review.googlesource.com/#/settings/agreements
95
96Ensure you have obtained an HTTP password to authenticate:
97
98 https://gerrit-review.googlesource.com/new-password
99
100Ensure that you have the local commit hook installed to automatically
101add a ChangeId to your commits:
102
103 curl -Lo `git rev-parse --git-dir`/hooks/commit-msg https://gerrit-review.googlesource.com/tools/hooks/commit-msg
104 chmod +x `git rev-parse --git-dir`/hooks/commit-msg
105
106If you have already committed your changes you will need to amend the commit
107to get the ChangeId added.
108
109 git commit --amend
110
111Push your patches over HTTPS to the review server, possibly through
112a remembered remote to make this easier in the future:
113
114 git config remote.review.url https://gerrit-review.googlesource.com/git-repo
115 git config remote.review.push HEAD:refs/for/master
116
117 git push review
118
119You will be automatically emailed a copy of your commits, and any
120comments made by the project maintainers.
121
122
123## Make changes if requested
124
125The project maintainer who reviews your changes might request changes to your
126commit. If you make the requested changes you will need to amend your commit
127and push it to the review server again.
128
129
130## Verify your changes on gerrit
131
132After you receive a Code-Review+2 from the maintainer, select the Verified
133button on the gerrit page for the change. This verifies that you have tested
134your changes and notifies the maintainer that they are ready to be submitted.
135The maintainer will then submit your changes to the repository.