Implementing a repo-hook command to provide standardized repo hook script functionality for RBTools
Review Request #11492 — Created Feb. 26, 2021 and updated
High-Level Description
This feature is meant to give some hook script functionality for RBTools through a new command, repo-hook. Specifically, the repo-hook command allows users to call RBTools based pre-receive and post-receive hook script functionality from their own hook scripts.
The pre-receive functionality is focused on checking commits in the incoming push for review request IDs, and possibly cancelling the push if criteria are not met. This criteria depends on whether certain options are activated or left default (--dont-require-review-requests and --allow-unapproved-push). By default, the push will be cancelled if there are any commits without review requests, or if any review requests are not approved.
The post-receive functionality is based on closing any review requests referenced in commit messages in the current push. In this instance, a push cannot be cancelled, and warnings will be raised if there are commits with no review requests.
Initial Plans
Initial plans for this command were to have hook script functionality for multiple SCM systems, specifically starting with Git, Mercurial, and Subversion. At this point, only functionality for Git has been implemented, with skeleton code and empty classes being implemented for SVN and Mercurial.
How the Code Works Together
This functionality is performed by a RepoHook Command class. This class will perform all the SCM agnostic logic of the hook scripts. From this class, depending on the --repo-type option specified (again, currently only Git is an option), a SCMRepositoryHooks subclass representing the repository in --repo-type will be called to provide RepoHook with the information it needs in order to work, while performing all SCM specific code within it's own class.
Next Steps
Next steps would involve getting code reviews to confirm that the Git and RepoHook logic are bug-free, as well as implementing the SVN and Mercurial logic in their corresponding classes to allow more variety of SCMs.
Additionally, outside of initial scope, other hook types could be implemented. One that would prove useful is pre-commit functionality to ensure that a review request ID is included in the commit message. This would help avoid issues with using the pre-receive functionality, as the only issue that could arise would be that a review request is not approved.
Have done local testing with a local Git repository on my machine containing pre-receive and post-receive hook scripts that call the rbt repo-hook command to ensure that the code works.
Have created a suite of tests to test various options and how they would cause the RepoHook command to react. This includes testing all variations of --repo-type and --hook-type (allowed, un-implemented, no variant selected, and default value), default and specified server options, regex flag options, and both variations of all other toggle-able options.
Summary | ID |
---|---|
71f6f67374c30350d242432a46116d48618162e8 | |
9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb | |
ba3b42ca15f118cc032b924a791cb9683df93414 | |
f72a4ad674c91133e896a9b70e4b70b2e183f04c | |
43358669072fd7988138c5f471f56eb6198324d3 | |
52269579029e65a75628683428951bff3fe37f18 | |
63f7658e2b9031c546a4b520fc64da6a2c703e72 | |
55e914ec883c1fe8ae64d6737993396b298dad8c | |
85cb9226317a9d8d009789e76f0ebe8bded52396 | |
f12f498b5ff2e8b59f2830060213d51d2bdac974 | |
e1127d83acee2368c722df258c4b85171282fbe4 | |
005d94249b6f98b485f506ac8e949d81d7a841dd | |
f0903e5262699bf86eb5f3becaf85bf4dd8495b3 | |
46d45e305a396de7e67664529e2fea9dfc4e6897 | |
545a2942acc05c5bed4d1d02f46d7bdc0d7109ac | |
873fa7a5ff642af1291ebe1c12131d76c092e64b | |
b310e24a3c5cf7afb0a7f0c98cb97e83ff70b3dd | |
72eb9f5082f65cc8fba59cc346ed121964558f74 | |
03a5a7ea1187a0ffbbae88489714fbf2f5305e15 | |
48e9df0bdda435f1312dbdfcc97092cecf1f638d | |
19b303bb3ef1f48136ed87fcdedf812a6ebaa27f | |
761842443c320f0f4decd5be3cb71253fe797c2b | |
b6b0454774fc12048c77f9efaf16ab7371653e12 |
Description | From | Last Updated |
---|---|---|
E303 too many blank lines (3) |
reviewbot | |
E999 IndentationError: expected an indented block |
reviewbot | |
E303 too many blank lines (2) |
reviewbot | |
E303 too many blank lines (2) |
reviewbot | |
E303 too many blank lines (2) |
reviewbot | |
W292 no newline at end of file |
reviewbot | |
F401 'sys' imported but unused |
reviewbot | |
F401 'rbtools.clients.errors.InvalidRevisionSpecError' imported but unused |
reviewbot | |
F401 'rbtools.commands.CommandError' imported but unused |
reviewbot | |
F401 'six' imported but unused |
reviewbot | |
W291 trailing whitespace |
reviewbot | |
E501 line too long (82 > 79 characters) |
reviewbot | |
F821 undefined name 'REVIEWBOARD_URL' |
reviewbot | |
E303 too many blank lines (2) |
reviewbot | |
F821 undefined name 're' |
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 | |
W293 blank line contains whitespace |
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 | |
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 | |
W293 blank line contains whitespace |
reviewbot | |
W293 blank line contains whitespace |
reviewbot | |
F401 'logging' imported but unused |
reviewbot | |
F401 'subprocess' imported but unused |
reviewbot | |
E302 expected 2 blank lines, found 1 |
reviewbot | |
E251 unexpected spaces around keyword / parameter equals |
reviewbot | |
E251 unexpected spaces around keyword / parameter equals |
reviewbot | |
E303 too many blank lines (2) |
reviewbot | |
E501 line too long (82 > 79 characters) |
reviewbot | |
E501 line too long (82 > 79 characters) |
reviewbot | |
E128 continuation line under-indented for visual indent |
reviewbot | |
E303 too many blank lines (2) |
reviewbot | |
E501 line too long (82 > 79 characters) |
reviewbot | |
E128 continuation line under-indented for visual indent |
reviewbot | |
F821 undefined name 'get_excluded_branches' |
reviewbot | |
E303 too many blank lines (2) |
reviewbot | |
E501 line too long (83 > 79 characters) |
reviewbot | |
E501 line too long (80 > 79 characters) |
reviewbot | |
E303 too many blank lines (2) |
reviewbot | |
E303 too many blank lines (2) |
reviewbot | |
E303 too many blank lines (2) |
reviewbot | |
E501 line too long (80 > 79 characters) |
reviewbot | |
E128 continuation line under-indented for visual indent |
reviewbot | |
E501 line too long (81 > 79 characters) |
reviewbot | |
F821 undefined name 'get_branches_containing_commit' |
reviewbot | |
E501 line too long (82 > 79 characters) |
reviewbot | |
E303 too many blank lines (2) |
reviewbot | |
F821 undefined name 'subprocess' |
reviewbot | |
F821 undefined name 'subprocess' |
reviewbot | |
F821 undefined name 'logging' |
reviewbot | |
E501 line too long (82 > 79 characters) |
reviewbot | |
W292 no newline at end of file |
reviewbot | |
F401 'logging' imported but unused |
reviewbot | |
F401 'subprocess' imported but unused |
reviewbot | |
E302 expected 2 blank lines, found 1 |
reviewbot | |
E251 unexpected spaces around keyword / parameter equals |
reviewbot | |
E251 unexpected spaces around keyword / parameter equals |
reviewbot | |
E303 too many blank lines (2) |
reviewbot | |
E501 line too long (82 > 79 characters) |
reviewbot | |
E501 line too long (82 > 79 characters) |
reviewbot | |
E128 continuation line under-indented for visual indent |
reviewbot | |
E303 too many blank lines (2) |
reviewbot | |
E501 line too long (82 > 79 characters) |
reviewbot | |
E128 continuation line under-indented for visual indent |
reviewbot | |
F821 undefined name 'get_excluded_branches' |
reviewbot | |
E303 too many blank lines (2) |
reviewbot | |
E501 line too long (83 > 79 characters) |
reviewbot | |
E501 line too long (80 > 79 characters) |
reviewbot | |
E303 too many blank lines (2) |
reviewbot | |
E303 too many blank lines (2) |
reviewbot | |
E303 too many blank lines (2) |
reviewbot | |
E501 line too long (80 > 79 characters) |
reviewbot | |
E128 continuation line under-indented for visual indent |
reviewbot | |
F821 undefined name 'get_branches_containing_commit' |
reviewbot | |
E501 line too long (81 > 79 characters) |
reviewbot | |
E501 line too long (82 > 79 characters) |
reviewbot | |
E303 too many blank lines (2) |
reviewbot | |
F821 undefined name 'subprocess' |
reviewbot | |
F821 undefined name 'subprocess' |
reviewbot | |
F821 undefined name 'logging' |
reviewbot | |
E501 line too long (82 > 79 characters) |
reviewbot | |
W292 no newline at end of file |
reviewbot | |
E302 expected 2 blank lines, found 1 |
reviewbot | |
E303 too many blank lines (2) |
reviewbot | |
W291 trailing whitespace |
reviewbot | |
W291 trailing whitespace |
reviewbot | |
W291 trailing whitespace |
reviewbot | |
W291 trailing whitespace |
reviewbot | |
W291 trailing whitespace |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E126 continuation line over-indented for hanging indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E302 expected 2 blank lines, found 1 |
reviewbot | |
F401 'subprocess' imported but unused |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E502 the backslash is redundant between brackets |
reviewbot | |
E501 line too long (81 > 79 characters) |
reviewbot | |
E502 the backslash is redundant between brackets |
reviewbot | |
E502 the backslash is redundant between brackets |
reviewbot | |
E502 the backslash is redundant between brackets |
reviewbot | |
E502 the backslash is redundant between brackets |
reviewbot | |
E502 the backslash is redundant between brackets |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E502 the backslash is redundant between brackets |
reviewbot | |
E502 the backslash is redundant between brackets |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
W291 trailing whitespace |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
W291 trailing whitespace |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
F401 'logging' imported but unused |
reviewbot | |
F401 'subprocess' imported but unused |
reviewbot | |
F401 'logging' imported but unused |
reviewbot | |
F401 'subprocess' imported but unused |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
E127 continuation line over-indented for visual indent |
reviewbot | |
F401 'rbtools.clients.mercurial.MercurialClient' imported but unused |
reviewbot | |
F401 'rbtools.clients.svn.SVNClient' imported but unused |
reviewbot | |
E128 continuation line under-indented for visual indent |
reviewbot | |
E128 continuation line under-indented for visual indent |
reviewbot | |
W503 line break before binary operator |
reviewbot | |
W503 line break before binary operator |
reviewbot | |
W391 blank line at end of file |
reviewbot | |
W503 line break before binary operator |
reviewbot | |
W503 line break before binary operator |
reviewbot | |
W503 line break before binary operator |
reviewbot | |
W503 line break before binary operator |
reviewbot |
- Change Summary:
-
Brought basic functionality from git.py and common.py into RepoHook class, SCMRepositoryHooks class, and GitRespositoryHooks class. Will continue working on the functionality to improve it.
- Commits:
-
Summary ID 71f6f67374c30350d242432a46116d48618162e8 71f6f67374c30350d242432a46116d48618162e8 9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb ba3b42ca15f118cc032b924a791cb9683df93414 f72a4ad674c91133e896a9b70e4b70b2e183f04c 43358669072fd7988138c5f471f56eb6198324d3 52269579029e65a75628683428951bff3fe37f18 63f7658e2b9031c546a4b520fc64da6a2c703e72 - Groups:
-
- Diff:
Revision 2 (+1158 -294)
Checks run (1 failed, 1 succeeded)
flake8 failed.JSHint passed.flake8
-
Warning: Showing 30 of 132 failures.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Change Summary:
-
Brought remaining logic from existing Git hook scripts into repo-hook command
- Commits:
-
Summary ID 71f6f67374c30350d242432a46116d48618162e8 9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb ba3b42ca15f118cc032b924a791cb9683df93414 f72a4ad674c91133e896a9b70e4b70b2e183f04c 43358669072fd7988138c5f471f56eb6198324d3 52269579029e65a75628683428951bff3fe37f18 63f7658e2b9031c546a4b520fc64da6a2c703e72 71f6f67374c30350d242432a46116d48618162e8 9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb ba3b42ca15f118cc032b924a791cb9683df93414 f72a4ad674c91133e896a9b70e4b70b2e183f04c 43358669072fd7988138c5f471f56eb6198324d3 52269579029e65a75628683428951bff3fe37f18 63f7658e2b9031c546a4b520fc64da6a2c703e72 55e914ec883c1fe8ae64d6737993396b298dad8c 85cb9226317a9d8d009789e76f0ebe8bded52396 f12f498b5ff2e8b59f2830060213d51d2bdac974 e1127d83acee2368c722df258c4b85171282fbe4
Checks run (1 failed, 1 succeeded)
flake8
-
Warning: Showing 30 of 161 failures.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Change Summary:
-
Went through all flake8 errors from revision 1-3 and fixed them.
- Commits:
-
Summary ID 71f6f67374c30350d242432a46116d48618162e8 9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb ba3b42ca15f118cc032b924a791cb9683df93414 f72a4ad674c91133e896a9b70e4b70b2e183f04c 43358669072fd7988138c5f471f56eb6198324d3 52269579029e65a75628683428951bff3fe37f18 63f7658e2b9031c546a4b520fc64da6a2c703e72 55e914ec883c1fe8ae64d6737993396b298dad8c 85cb9226317a9d8d009789e76f0ebe8bded52396 f12f498b5ff2e8b59f2830060213d51d2bdac974 e1127d83acee2368c722df258c4b85171282fbe4 71f6f67374c30350d242432a46116d48618162e8 9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb ba3b42ca15f118cc032b924a791cb9683df93414 f72a4ad674c91133e896a9b70e4b70b2e183f04c 43358669072fd7988138c5f471f56eb6198324d3 52269579029e65a75628683428951bff3fe37f18 63f7658e2b9031c546a4b520fc64da6a2c703e72 55e914ec883c1fe8ae64d6737993396b298dad8c 85cb9226317a9d8d009789e76f0ebe8bded52396 f12f498b5ff2e8b59f2830060213d51d2bdac974 e1127d83acee2368c722df258c4b85171282fbe4 005d94249b6f98b485f506ac8e949d81d7a841dd
Checks run (1 failed, 1 succeeded)
flake8
-
Warning: Showing 30 of 128 failures.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Change Summary:
-
Fixed various flake8 issues. Altered code taken from pre-existing hook scrpits to match the new self.options.xxxxx locations for various variables.
- Commits:
-
Summary ID 71f6f67374c30350d242432a46116d48618162e8 9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb ba3b42ca15f118cc032b924a791cb9683df93414 f72a4ad674c91133e896a9b70e4b70b2e183f04c 43358669072fd7988138c5f471f56eb6198324d3 52269579029e65a75628683428951bff3fe37f18 63f7658e2b9031c546a4b520fc64da6a2c703e72 55e914ec883c1fe8ae64d6737993396b298dad8c 85cb9226317a9d8d009789e76f0ebe8bded52396 f12f498b5ff2e8b59f2830060213d51d2bdac974 e1127d83acee2368c722df258c4b85171282fbe4 005d94249b6f98b485f506ac8e949d81d7a841dd 71f6f67374c30350d242432a46116d48618162e8 9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb ba3b42ca15f118cc032b924a791cb9683df93414 f72a4ad674c91133e896a9b70e4b70b2e183f04c 43358669072fd7988138c5f471f56eb6198324d3 52269579029e65a75628683428951bff3fe37f18 63f7658e2b9031c546a4b520fc64da6a2c703e72 55e914ec883c1fe8ae64d6737993396b298dad8c 85cb9226317a9d8d009789e76f0ebe8bded52396 f12f498b5ff2e8b59f2830060213d51d2bdac974 e1127d83acee2368c722df258c4b85171282fbe4 005d94249b6f98b485f506ac8e949d81d7a841dd f0903e5262699bf86eb5f3becaf85bf4dd8495b3 46d45e305a396de7e67664529e2fea9dfc4e6897
Checks run (1 failed, 1 succeeded)
flake8
-
Warning: Showing 30 of 73 failures.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Commits:
-
Summary ID 71f6f67374c30350d242432a46116d48618162e8 9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb ba3b42ca15f118cc032b924a791cb9683df93414 f72a4ad674c91133e896a9b70e4b70b2e183f04c 43358669072fd7988138c5f471f56eb6198324d3 52269579029e65a75628683428951bff3fe37f18 63f7658e2b9031c546a4b520fc64da6a2c703e72 55e914ec883c1fe8ae64d6737993396b298dad8c 85cb9226317a9d8d009789e76f0ebe8bded52396 f12f498b5ff2e8b59f2830060213d51d2bdac974 e1127d83acee2368c722df258c4b85171282fbe4 005d94249b6f98b485f506ac8e949d81d7a841dd f0903e5262699bf86eb5f3becaf85bf4dd8495b3 46d45e305a396de7e67664529e2fea9dfc4e6897 71f6f67374c30350d242432a46116d48618162e8 9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb ba3b42ca15f118cc032b924a791cb9683df93414 f72a4ad674c91133e896a9b70e4b70b2e183f04c 43358669072fd7988138c5f471f56eb6198324d3 52269579029e65a75628683428951bff3fe37f18 63f7658e2b9031c546a4b520fc64da6a2c703e72 55e914ec883c1fe8ae64d6737993396b298dad8c 85cb9226317a9d8d009789e76f0ebe8bded52396 f12f498b5ff2e8b59f2830060213d51d2bdac974 e1127d83acee2368c722df258c4b85171282fbe4 005d94249b6f98b485f506ac8e949d81d7a841dd f0903e5262699bf86eb5f3becaf85bf4dd8495b3 46d45e305a396de7e67664529e2fea9dfc4e6897 545a2942acc05c5bed4d1d02f46d7bdc0d7109ac
Checks run (1 failed, 1 succeeded)
flake8
-
Warning: Showing 30 of 74 failures.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Change Summary:
-
Minor changes and final tweaks to refactoring to RepoHook class and SCMRepositoryHooks and its subclasses.
Posted this RR two weeks ago before lots of local testing happened, but forgot to publish it. - Commits:
-
Summary ID 71f6f67374c30350d242432a46116d48618162e8 9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb ba3b42ca15f118cc032b924a791cb9683df93414 f72a4ad674c91133e896a9b70e4b70b2e183f04c 43358669072fd7988138c5f471f56eb6198324d3 52269579029e65a75628683428951bff3fe37f18 63f7658e2b9031c546a4b520fc64da6a2c703e72 55e914ec883c1fe8ae64d6737993396b298dad8c 85cb9226317a9d8d009789e76f0ebe8bded52396 f12f498b5ff2e8b59f2830060213d51d2bdac974 e1127d83acee2368c722df258c4b85171282fbe4 005d94249b6f98b485f506ac8e949d81d7a841dd f0903e5262699bf86eb5f3becaf85bf4dd8495b3 46d45e305a396de7e67664529e2fea9dfc4e6897 545a2942acc05c5bed4d1d02f46d7bdc0d7109ac 71f6f67374c30350d242432a46116d48618162e8 9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb ba3b42ca15f118cc032b924a791cb9683df93414 f72a4ad674c91133e896a9b70e4b70b2e183f04c 43358669072fd7988138c5f471f56eb6198324d3 52269579029e65a75628683428951bff3fe37f18 63f7658e2b9031c546a4b520fc64da6a2c703e72 55e914ec883c1fe8ae64d6737993396b298dad8c 85cb9226317a9d8d009789e76f0ebe8bded52396 f12f498b5ff2e8b59f2830060213d51d2bdac974 e1127d83acee2368c722df258c4b85171282fbe4 005d94249b6f98b485f506ac8e949d81d7a841dd f0903e5262699bf86eb5f3becaf85bf4dd8495b3 46d45e305a396de7e67664529e2fea9dfc4e6897 545a2942acc05c5bed4d1d02f46d7bdc0d7109ac 873fa7a5ff642af1291ebe1c12131d76c092e64b b310e24a3c5cf7afb0a7f0c98cb97e83ff70b3dd 72eb9f5082f65cc8fba59cc346ed121964558f74 03a5a7ea1187a0ffbbae88489714fbf2f5305e15
Checks run (1 failed, 1 succeeded)
flake8
- Change Summary:
-
Added more tests, and have removed all references to pre_commit hook type from all files relating to the RepoHook command class.
- Summary:
-
[WIP] Implementing a repo-hook command to standardize how hooks for RBTools are usedImplementing a repo-hook command to standardize how hooks for RBTools are used
- Description:
-
~ Adding in-progress files.
~ Created repo-hook.py, which implements the most basic of functionality of a command, on which to build. ~ Have created all functionality for RepoHook class.
~ Have created support class SCMRepositoryHooks and subclasses for Git, SVN, and Mercurial. - This command also has had the code from rbtools/hook/common.py inserted in, though not much functionality is implemented. - Created scmrepositoryhooks.py as a base class for all the remaining repository classes. Include basic methods which are just passed over for implementation in the subclasses. - Created the gitrepositoryhooks.py sub-class, which inherits from scmrepositoryhooks.py. No implementation inside yet. - Altered setup.py to include repo-hook as a command to be part of the rbtools commands. - Testing Done:
-
~ No testing done, as code is not in a working state as of yet.
~ Have done testing with a local Git repository on my machine and pre-receive and post-receive hook scripts to ensure that the code works.
+ Have created a suite of tests to test various options and how they would cause the RepoHook command to react. - Commits:
-
Summary ID 71f6f67374c30350d242432a46116d48618162e8 9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb ba3b42ca15f118cc032b924a791cb9683df93414 f72a4ad674c91133e896a9b70e4b70b2e183f04c 43358669072fd7988138c5f471f56eb6198324d3 52269579029e65a75628683428951bff3fe37f18 63f7658e2b9031c546a4b520fc64da6a2c703e72 55e914ec883c1fe8ae64d6737993396b298dad8c 85cb9226317a9d8d009789e76f0ebe8bded52396 f12f498b5ff2e8b59f2830060213d51d2bdac974 e1127d83acee2368c722df258c4b85171282fbe4 005d94249b6f98b485f506ac8e949d81d7a841dd f0903e5262699bf86eb5f3becaf85bf4dd8495b3 46d45e305a396de7e67664529e2fea9dfc4e6897 545a2942acc05c5bed4d1d02f46d7bdc0d7109ac 873fa7a5ff642af1291ebe1c12131d76c092e64b b310e24a3c5cf7afb0a7f0c98cb97e83ff70b3dd 72eb9f5082f65cc8fba59cc346ed121964558f74 03a5a7ea1187a0ffbbae88489714fbf2f5305e15 71f6f67374c30350d242432a46116d48618162e8 9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb ba3b42ca15f118cc032b924a791cb9683df93414 f72a4ad674c91133e896a9b70e4b70b2e183f04c 43358669072fd7988138c5f471f56eb6198324d3 52269579029e65a75628683428951bff3fe37f18 63f7658e2b9031c546a4b520fc64da6a2c703e72 55e914ec883c1fe8ae64d6737993396b298dad8c 85cb9226317a9d8d009789e76f0ebe8bded52396 f12f498b5ff2e8b59f2830060213d51d2bdac974 e1127d83acee2368c722df258c4b85171282fbe4 005d94249b6f98b485f506ac8e949d81d7a841dd f0903e5262699bf86eb5f3becaf85bf4dd8495b3 46d45e305a396de7e67664529e2fea9dfc4e6897 545a2942acc05c5bed4d1d02f46d7bdc0d7109ac 873fa7a5ff642af1291ebe1c12131d76c092e64b b310e24a3c5cf7afb0a7f0c98cb97e83ff70b3dd 72eb9f5082f65cc8fba59cc346ed121964558f74 03a5a7ea1187a0ffbbae88489714fbf2f5305e15 48e9df0bdda435f1312dbdfcc97092cecf1f638d 19b303bb3ef1f48136ed87fcdedf812a6ebaa27f
- Summary:
-
Implementing a repo-hook command to standardize how hooks for RBTools are usedImplementing a repo-hook command to provide standardized repo hook script functionality for RBTools
- Description:
-
~ Have created all functionality for RepoHook class.
~ Have created support class SCMRepositoryHooks and subclasses for Git, SVN, and Mercurial. ~ High-Level Description
~ + This feature is meant to give some hook script functionality for RBTools through a new command, repo-hook. Specifically, the repo-hook command allows users to call RBTools based pre-receive and post-receive hook script functionality from their own hook scripts.
+ + The pre-receive functionality is focused on checking commits in the incoming push for review request IDs, and possibly cancelling the push if criteria are not met. This criteria depends on whether certain options are activated or left default (--dont-require-review-requests and --allow-unapproved-push). By default, the push will be cancelled if there are any commits without review requests, or if any review requests are not approved.
+ + The post-receive functionality is based on closing any review requests referenced in commit messages in the current push. In this instance, a push cannot be cancelled, and warnings will be raised if there are commits with no review requests.
+ + Initial Plans
+ + Initial plans for this command were to have hook script functionality for multiple SCM systems, specifically starting with Git, Mercurial, and Subversion. At this point, only functionality for Git has been implemented, with skeleton code and empty classes being implemented for SVN and Mercurial.
+ + How the Code Works Together
+ + This functionality is performed by a RepoHook Command class. This class will perform all the SCM agnostic logic of the hook scripts. From this class, depending on the --repo-type option specified (again, currently only Git is an option), a SCMRepositoryHooks subclass representing the repository in --repo-type will be called to provide RepoHook with the information it needs in order to work, while performing all SCM specific code within it's own class.
+ + Next Steps
+ + Next steps would involve getting code reviews to confirm that the Git and RepoHook logic are bug-free, as well as implementing the SVN and Mercurial logic in their corresponding classes to allow more variety of SCMs.
+ + Additionally, outside of initial scope, other hook types could be implemented. One that would prove useful is pre-commit functionality to ensure that a review request ID is included in the commit message. This would help avoid issues with using the pre-receive functionality, as the only issue that could arise would be that a review request is not approved.
- Testing Done:
-
~ Have done testing with a local Git repository on my machine and pre-receive and post-receive hook scripts to ensure that the code works.
~ Have created a suite of tests to test various options and how they would cause the RepoHook command to react. ~ Have done local testing with a local Git repository on my machine containing pre-receive and post-receive hook scripts that call the rbt repo-hook command to ensure that the code works.
~ + Have created a suite of tests to test various options and how they would cause the RepoHook command to react. This includes testing all variations of --repo-type and --hook-type (allowed, un-implemented, no variant selected, and default value), default and specified server options, regex flag options, and both variations of all other toggle-able options.
- Commits:
-
Summary ID 71f6f67374c30350d242432a46116d48618162e8 9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb ba3b42ca15f118cc032b924a791cb9683df93414 f72a4ad674c91133e896a9b70e4b70b2e183f04c 43358669072fd7988138c5f471f56eb6198324d3 52269579029e65a75628683428951bff3fe37f18 63f7658e2b9031c546a4b520fc64da6a2c703e72 55e914ec883c1fe8ae64d6737993396b298dad8c 85cb9226317a9d8d009789e76f0ebe8bded52396 f12f498b5ff2e8b59f2830060213d51d2bdac974 e1127d83acee2368c722df258c4b85171282fbe4 005d94249b6f98b485f506ac8e949d81d7a841dd f0903e5262699bf86eb5f3becaf85bf4dd8495b3 46d45e305a396de7e67664529e2fea9dfc4e6897 545a2942acc05c5bed4d1d02f46d7bdc0d7109ac 873fa7a5ff642af1291ebe1c12131d76c092e64b b310e24a3c5cf7afb0a7f0c98cb97e83ff70b3dd 72eb9f5082f65cc8fba59cc346ed121964558f74 03a5a7ea1187a0ffbbae88489714fbf2f5305e15 48e9df0bdda435f1312dbdfcc97092cecf1f638d 19b303bb3ef1f48136ed87fcdedf812a6ebaa27f 71f6f67374c30350d242432a46116d48618162e8 9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb ba3b42ca15f118cc032b924a791cb9683df93414 f72a4ad674c91133e896a9b70e4b70b2e183f04c 43358669072fd7988138c5f471f56eb6198324d3 52269579029e65a75628683428951bff3fe37f18 63f7658e2b9031c546a4b520fc64da6a2c703e72 55e914ec883c1fe8ae64d6737993396b298dad8c 85cb9226317a9d8d009789e76f0ebe8bded52396 f12f498b5ff2e8b59f2830060213d51d2bdac974 e1127d83acee2368c722df258c4b85171282fbe4 005d94249b6f98b485f506ac8e949d81d7a841dd f0903e5262699bf86eb5f3becaf85bf4dd8495b3 46d45e305a396de7e67664529e2fea9dfc4e6897 545a2942acc05c5bed4d1d02f46d7bdc0d7109ac 873fa7a5ff642af1291ebe1c12131d76c092e64b b310e24a3c5cf7afb0a7f0c98cb97e83ff70b3dd 72eb9f5082f65cc8fba59cc346ed121964558f74 03a5a7ea1187a0ffbbae88489714fbf2f5305e15 48e9df0bdda435f1312dbdfcc97092cecf1f638d 19b303bb3ef1f48136ed87fcdedf812a6ebaa27f 761842443c320f0f4decd5be3cb71253fe797c2b b6b0454774fc12048c77f9efaf16ab7371653e12