Making it easy to write pre/post-commit hooks
Review Request #9236 — Created Sept. 29, 2017 and discarded
Applies the 0001-WIP-Repository-hooks-support.patch that Christian Hammond
created.Adds the repo-hook command to make it easy to use pre and post commit hooks. The
supported repositories are Git, Mercurial and SVN.
Ran nosetests -v; all tests pass with patch applied.
Created unit tests for all functions.
Ran nosetests -v; all tests passed.
Description | From | Last Updated |
---|---|---|
F401 'json' imported but unused |
reviewbot | |
F401 'six.moves.urllib.request.urlopen' imported but unused |
reviewbot | |
F401 'rbtools.api.tests.MockResponse' imported but unused |
reviewbot | |
F401 'rbtools.clients.svn.SVNClient' imported but unused |
reviewbot | |
E265 block comment should start with '# ' |
reviewbot | |
E265 block comment should start with '# ' |
reviewbot | |
E265 block comment should start with '# ' |
reviewbot | |
E265 block comment should start with '# ' |
reviewbot | |
F811 redefinition of unused 'RepositoryInfo' from line 10 |
reviewbot | |
F811 redefinition of unused 'SCMClient' from line 10 |
reviewbot | |
F811 redefinition of unused 'PatchResult' from line 10 |
reviewbot | |
E302 expected 2 blank lines, found 1 |
reviewbot | |
F811 redefinition of unused 'PatchResult' from line 10 |
reviewbot | |
F811 redefinition of unused 'RepositoryInfo' from line 10 |
reviewbot | |
F811 redefinition of unused 'SCMClient' from line 10 |
reviewbot | |
F401 'rbtools.hooks.common.get_review_request_id' imported but unused |
reviewbot | |
E302 expected 2 blank lines, found 1 |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E128 continuation line under-indented for visual indent |
reviewbot | |
W391 blank line at end of file |
reviewbot | |
E226 missing whitespace around arithmetic operator |
reviewbot | |
E303 too many blank lines (2) |
reviewbot | |
Have you checked what happens when the commit message contains a colon+space separator (:)? The regex looks like it would … |
bleblan2 | |
E226 missing whitespace around arithmetic operator |
reviewbot | |
E226 missing whitespace around arithmetic operator |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
run_from_argv now returns the exit code, as opposed to calling sys.exit(exit_code). I'd consider adding what it returns to the function's … |
NI nicho |
- Description:
-
~ Applies the 0001-WIP-Repository-hooks-support.patch that Christian Hammond gave me as a skeleton to start with. No other changes have been made yet, as I'm still going through the code.
~ Applies the 0001-WIP-Repository-hooks-support.patch that Christian Hammond gave
+ me as a skeleton to start with. No other changes have been made yet, as I'm + still going through the code. + + Oct 1 - 8
+ Fixed common.py to make the old hook method work so I could test it and learn + how it works. Found the common.py fix in https://reviews.reviewboard.org/r/9198/ + Started working through repo_hook.py and learned that the code Christian Hammond + gave me comes with working git functionality. - Testing Done:
-
Ran nosetests -v; all tests pass with patch applied.
+ + Oct 1 - 8
+ Manually tested the repo-hook command by making hooks for pre-receive and + post-receive in a local remote repository. I made changes and pushed the changes + to test the pre-receive hook, it denied the push as expected because the review + request was not marked "Ship It". Allowing the push to succeed caused the + post-receive code close the review-request. - Commit:
-
39f4e50ab9c9271572eab66b55b0cd2f2add64151ea1b5644830abc5a0f1a7caf72d5bf2e7c9333f
- Change Summary:
-
Working on SVN command
- Commit:
-
1ea1b5644830abc5a0f1a7caf72d5bf2e7c9333fbd3308235b7a6559c0dd3bea714f8c2c3ce0783b
Checks run (2 succeeded)
- Change Summary:
-
SVN repo basic functionalty added. Messy but working, need to change to be consistent with Git.
- Commit:
-
bd3308235b7a6559c0dd3bea714f8c2c3ce0783bd76a380ab6e7560b4b7e6bb042cbe6aebc307c01
Checks run (2 succeeded)
- Change Summary:
-
Started svn repository hooks unit tests and added basics to Mercurial.
- Commit:
-
d76a380ab6e7560b4b7e6bb042cbe6aebc307c01c97ca4a0b39aff638a2ad0ab3f56befd41c5d37d
- Commit:
-
c97ca4a0b39aff638a2ad0ab3f56befd41c5d37dba97b9f4c0ba14ed0b9559eefdf10072c8a3c9ed
Checks run (1 failed, 1 succeeded)
flake8
- Change Summary:
-
Working Mercurial pre-commit hooks. Fixed Flake8 errors.
- Commit:
-
ba97b9f4c0ba14ed0b9559eefdf10072c8a3c9ed1a4d2395433934d6f0ac781bc96a4e406c8c71a3
- Change Summary:
-
Added Mercurial tests, Changed SVN to make Post-commit work, still not working atm. Changed Repo_hook to use command arguments for input
- Commit:
-
1a4d2395433934d6f0ac781bc96a4e406c8c71a3769cf363965c7c286c9da5893d9b53bf807fa23b
-
Just a note about the regex being used for parsing the mercurial logs.
-
Have you checked what happens when the commit message contains a colon+space separator (
:
)? The regex looks like it would end up splitting a commit message if it is there.I'm also guessing the regex would split multiline commit messages at the newline.
- Change Summary:
-
Removed debuggin code. Fixed flake8 errors. Corrected Mercurial based on feedback
- Commit:
-
769cf363965c7c286c9da5893d9b53bf807fa23bf8879b38170101b908ddff0cf96adb46c87398f1
Checks run (2 succeeded)
- Change Summary:
-
Added docstrings to functions and classes. Should be good, just need to finish the RST doc.
- Summary:
-
[WIP] Making it easy to write pre/post-commit hooksMaking it easy to write pre/post-commit hooks
- Description:
-
~ Applies the 0001-WIP-Repository-hooks-support.patch that Christian Hammond gave
~ me as a skeleton to start with. No other changes have been made yet, as I'm ~ Applies the 0001-WIP-Repository-hooks-support.patch that Christian Hammond
~ created. - still going through the code. ~ Oct 1 - 8
~ Fixed common.py to make the old hook method work so I could test it and learn ~ Adds the repo-hook command to make it easy to use pre and post commit hooks. The
~ supported repositories are Git, Mercurial and SVN. - how it works. Found the common.py fix in https://reviews.reviewboard.org/r/9198/ - Started working through repo_hook.py and learned that the code Christian Hammond - gave me comes with working git functionality. - Testing Done:
-
Ran nosetests -v; all tests pass with patch applied.
~ Oct 1 - 8
~ Manually tested the repo-hook command by making hooks for pre-receive and ~ post-receive in a local remote repository. I made changes and pushed the changes ~ Created unit tests for all functions.
~ ~ Ran nosetests -v; all tests passed.
- to test the pre-receive hook, it denied the push as expected because the review - request was not marked "Ship It". Allowing the push to succeed caused the - post-receive code close the review-request. - Commit:
-
f8879b38170101b908ddff0cf96adb46c87398f15389c2a7fde0d8bd870d43aecad9e328fcc63c94
Checks run (2 succeeded)
- Change Summary:
-
Added repo-hook.rst documentation and forced api-token for repo-hook command to work
- Commit:
-
5389c2a7fde0d8bd870d43aecad9e328fcc63c94caf11f32eeda8b866c7b0dde79d1982030178579
Checks run (2 succeeded)
- Change Summary:
-
Added return value to the docstring for run_from_argv function
- Commit:
-
caf11f32eeda8b866c7b0dde79d1982030178579896d777e4482f97d8b17bf0d6ec4568f69dcdc69