Make small logical changes.
Provide a meaningful commit message.
Check for coding errors and style nits with pyflakes and flake8
Make sure all code is under the Apache License, 2.0.
Publish your changes for review.
Make corrections if requested.
Verify your changes on gerrit so they can be submitted.
git push https://gerrit-review.googlesource.com/git-repo HEAD:refs/for/master
I wanted a file describing how to submit patches for repo, so I started with the one found in the core Git distribution (Documentation/SubmittingPatches), which itself was based on the patch submission guidelines for the Linux kernel.
However there are some differences, so please review and familiarize yourself with the following relevant bits.
Unless your patch is really trivial, you should not be sending out a patch that was generated between your working tree and your commit head. Instead, always make a commit with complete commit message and generate a series of patches from your repository. It is a good discipline.
Describe the technical detail of the change(s).
If your description starts to get too long, that's a sign that you probably need to split up your commit to finer grained pieces.
pyflakes on changed modules:
Ideally there should be no new errors or warnings introduced.
flake8 on changes modules:
Note that repo generally follows Google's python style guide rather than PEP 8, so it‘s possible that the output of
flake8 will be quite noisy. It’s not mandatory to avoid all warnings, but at least the maximum line length should be followed.
If there are many occurrences of the same warning that cannot be avoided without going against the Google style guide, these may be suppressed in the included
To run the full suite against all supported Python versions, simply execute:
$ tox -p auto
./run_tests which is a simple wrapper around
# Run the full suite against the default Python version. $ ./run_tests # List each test as it runs. $ ./run_tests -v # Run a specific unittest module (and all tests in it). $ ./run_tests tests/test_git_command.py # Run a specific testsuite in a specific unittest module. $ ./run_tests tests/test_editor.py::EditString # Run a single test. $ ./run_tests tests/test_editor.py::EditString::test_cat_editor # List all available tests. $ ./run_tests --collect-only # Run a single test using substring match. $ ./run_tests -k test_cat_editor
The coverage isn't great currently, but it should still be run for all commits. Adding more unittests for changes you make would be greatly appreciated :). Check out the tests/ subdirectory for more details.
repo is licensed under the Apache License, 2.0.
Because of this licensing model every file within the project must list the license that covers it in the header of the file. Any new contributions to an existing file must be submitted under the current license of that file. Any new files must clearly indicate which license they are provided under in the file header.
Please verify that you are legally allowed and willing to submit your changes under the license covering each file prior to submitting your patch. It is virtually impossible to remove a patch once it has been applied and pushed out.
Do not email your patches to anyone.
Instead, login to the Gerrit Code Review tool at:
Ensure you have completed one of the necessary contributor agreements, providing documentation to the project maintainers that they have right to redistribute your work under the Apache License:
Ensure you have obtained an HTTP password to authenticate:
Ensure that you have the local commit hook installed to automatically add a ChangeId to your commits:
curl -Lo `git rev-parse --git-dir`/hooks/commit-msg https://gerrit-review.googlesource.com/tools/hooks/commit-msg chmod +x `git rev-parse --git-dir`/hooks/commit-msg
If you have already committed your changes you will need to amend the commit to get the ChangeId added.
git commit --amend
Push your patches over HTTPS to the review server, possibly through a remembered remote to make this easier in the future:
git config remote.review.url https://gerrit-review.googlesource.com/git-repo git config remote.review.push HEAD:refs/for/master git push review
You will be automatically emailed a copy of your commits, and any comments made by the project maintainers.
The project maintainer who reviews your changes might request changes to your commit. If you make the requested changes you will need to amend your commit and push it to the review server again.
After you receive a Code-Review+2 from the maintainer, select the Verified button on the gerrit page for the change. This verifies that you have tested your changes and notifies the maintainer that they are ready to be submitted. The maintainer will then submit your changes to the repository.