Implementing a repo-hook command to provide standardized repo hook script functionality for RBTools

Review Request #11492 — Created Feb. 26, 2021 and updated

Information

RBTools
master

Reviewers

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
Adding in-progress files.
Created repo-hook.py, which implements the most basic of functionality of a command, on which to build. 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.
71f6f67374c30350d242432a46116d48618162e8
Added new options to repo-hook command based on the functionality in contrib\tools\git-hook-set-submitted and contrib\tools\git-hook-check-approval. Followed same default values as found in these two hook scripts.
9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb
Fixed a few flake8 failure, and added in standard regex flag from contrib\tools\git-hook-set-submitted\n and contrib\tools\git-hook-check-approval as an option in the repo-hook command
ba3b42ca15f118cc032b924a791cb9683df93414
Brought functionality from git.py over to the GitRepositoryHooks class. This may change, but this is a starting point
f72a4ad674c91133e896a9b70e4b70b2e183f04c
Changed the wording and working of a few commands, so that the default is standard and it lexically makes sense for the user to add the option as a way to enable the function (e.g. --require-review-requests changed to dont-require-review-requests, and changed the default from True to False). As well, a few minor tab and line length errors were corrected
43358669072fd7988138c5f471f56eb6198324d3
This commit was an error fixing commit. Fixed some missed commas in the Options section, fixed a mispelling of store_true, fixed an error of using ! instead of not.
52269579029e65a75628683428951bff3fe37f18
Added option for specifying the type of repository repository being used (--repo-type).
Changed --type to be --hook-type to reduce confusion with --repo-type Moved execute() and get_review_request_id() from repo_hook.py to scmrepositoryhooks.py, as they were not used in repo_hook.py, and only needed in SCMRepositoryHooks and its subclasses. Other minor fixes, such as rearranging the imports and putting missing imports that were not brought over.
63f7658e2b9031c546a4b520fc64da6a2c703e72
Minor change, adding self variable to a class method inside SECRepositoryHooks class
Functionality brought from rbtools/hooks/common.py to rbtools/commands/repo_hook.py used to be outside the RepoHook class. These methods were brought into the RepoHook class to keep things clean.
55e914ec883c1fe8ae64d6737993396b298dad8c
Added the common lines between /contrib/tools/git-hook-set-submitted and /contrib/tools/git-hook-check-approval to rbtools/commands/repo_hook.py in the RepoHook Command subclass as the default behaviour before hook-type specific behaviour is taken
85cb9226317a9d8d009789e76f0ebe8bded52396
Removed unnecessary debug code from RepoHook class and its helper classes, and cleaned up the code a little.
f12f498b5ff2e8b59f2830060213d51d2bdac974
Brought logic for the pre-receive and post-receive functionality from /contrib/tools/git-hook-check-approval and /contrib/tools/git-hook-set-submitted into the pre_receive() and post_receive() methods of the RepoHook class.
Also implemented minor formatting fixes, as well as implementing Warning messages if the tool is given an unsupported SCM tool as a --repo-type option (currently Git is the only SCM supported
e1127d83acee2368c722df258c4b85171282fbe4
Went through all flake8 errors that occured throughout the first 3 posts to ReviewBoard
and fixed them
005d94249b6f98b485f506ac8e949d81d7a841dd
More flake8 issue fixing.
f0903e5262699bf86eb5f3becaf85bf4dd8495b3
Review Request #11492
Removed 'continue on next line' characters from unnecessary locations in repo-hook command. Corrected lines being too long in some files.
46d45e305a396de7e67664529e2fea9dfc4e6897
Altered how repo_hook command accesses SCMRepositoryHooks subclasses. Now, repo_hook will call on the correcponsing SCM client, of which each now has a repository_hooks_class class attribute. The repo_hook command can access the corresponsing SCMRepositoryHooks subclass depending on the --repo-type supplied in the command. Skeleton code for the SVNRepositoryHooks and MercurialRepositoryHooks classes have been created to make sure all functionality is working. Also changed the GitRepositoryHooks class to no longer need to be supplied a copy of the RepoHook class (incorrect idea about code layout. Review Request #11492.
545a2942acc05c5bed4d1d02f46d7bdc0d7109ac
Fixed all current flake8 errors via local version of flake8
873fa7a5ff642af1291ebe1c12131d76c092e64b
Minor changes, added sys.exit(1) for bad result in order for pre-receive hook to know what happened. Fixed some uncaught name spelling errors and other issues. Review Request #11492
b310e24a3c5cf7afb0a7f0c98cb97e83ff70b3dd
Reorganized how rbtools/command/repo-hook.py and rbtools/clients/scmrepositoryhooks.py and all it's subclasses functioned. Previously, RepoHook called the functionality it needed from methods in the SCMRepositoryHooks directly. Now, depending on the hook-type passed in (pre-receive, post-receive, etc), RepoHook will call the corresponding method in the SCMRepositoryHooks subclass (e.g. SCMRepositoryHooks.pre_receive()) in order to get the stuff it needs. This is done so that the method calls will be the same, regardless of what SCM the hook is being used for.
Changed all instances of post_commit() to post_receive() in SCMRepositoryHooks class and it's subclasses. This was a typo, as post-commit hooks is not something currently planned to the repo-hook command. Other minor refactoring of the RepoHook class, such as moving bulky if/else statements for determining the SCMRepositoryHook subclass to be grabbed into a method of its own to clean up main(). As well, moved some code that would not neccesarily be used for hooks besides post-receive and pre-receive into their respective methods, instead of keeping them in main(). Also finished testing the pre-receive hook, before and after the refactoring. Review Request #11492
72eb9f5082f65cc8fba59cc346ed121964558f74
Minor tweaks to some method calls for the post-receive hook side of repo-hook. Errors found with passing too many arguments or passing arguments the incorrect way.
03a5a7ea1187a0ffbbae88489714fbf2f5305e15
Added tests for RepoHook command, including checking proper fetching of GitRepositoryHooks class, exit from system in case of calling 'svn', 'mercurial' or an invalid repo type for repo-type, saving of server options, properly setting regex flags, and testing for exiting when given invalid hook-type.
Removed all references to pre-commit hooks withing the RepoHook command, as this is not a currently planned functionality. Will be removing pre-commit references from everywhere else in the next commit Review Request #11492
48e9df0bdda435f1312dbdfcc97092cecf1f638d
Added tests for valid --hook-types, the default hook_type, default repo_type, the default values for server options, and the default and activated states of calling --require-approval, --dont-require-review-requests, and --allow-unapproved-push.
Removed all (empty) methods for pre-receive in the SCMRepositoryHooks class and it's subclasses. Review Request #11492
19b303bb3ef1f48136ed87fcdedf812a6ebaa27f
Added documentation where needed, and fixed bad/non-compliant documentation
Changed all instances of sys.exit(x) to instead by raisings of HookError, and changed testing to correspond to this change Changed REGEX_FLAGS to be regex_flags in rbtools/commands/repo_hook.py, as it is not a constant Removed all debugging print() statements from rbtools/commands/repo_hook.py. Review request#11492
761842443c320f0f4decd5be3cb71253fe797c2b
Fixed a minor flake8 error in rbtools/clients/scmrepositoryhooks.py. Review request #11492
b6b0454774fc12048c77f9efaf16ab7371653e12
Description From Last Updated

E303 too many blank lines (3)

reviewbotreviewbot

E999 IndentationError: expected an indented block

reviewbotreviewbot

E303 too many blank lines (2)

reviewbotreviewbot

E303 too many blank lines (2)

reviewbotreviewbot

E303 too many blank lines (2)

reviewbotreviewbot

W292 no newline at end of file

reviewbotreviewbot

F401 'sys' imported but unused

reviewbotreviewbot

F401 'rbtools.clients.errors.InvalidRevisionSpecError' imported but unused

reviewbotreviewbot

F401 'rbtools.commands.CommandError' imported but unused

reviewbotreviewbot

F401 'six' imported but unused

reviewbotreviewbot

W291 trailing whitespace

reviewbotreviewbot

E501 line too long (82 > 79 characters)

reviewbotreviewbot

F821 undefined name 'REVIEWBOARD_URL'

reviewbotreviewbot

E303 too many blank lines (2)

reviewbotreviewbot

F821 undefined name 're'

reviewbotreviewbot

E265 block comment should start with '# '

reviewbotreviewbot

E265 block comment should start with '# '

reviewbotreviewbot

E265 block comment should start with '# '

reviewbotreviewbot

E265 block comment should start with '# '

reviewbotreviewbot

W293 blank line contains whitespace

reviewbotreviewbot

E265 block comment should start with '# '

reviewbotreviewbot

E265 block comment should start with '# '

reviewbotreviewbot

E265 block comment should start with '# '

reviewbotreviewbot

E265 block comment should start with '# '

reviewbotreviewbot

E265 block comment should start with '# '

reviewbotreviewbot

E265 block comment should start with '# '

reviewbotreviewbot

E265 block comment should start with '# '

reviewbotreviewbot

E265 block comment should start with '# '

reviewbotreviewbot

W293 blank line contains whitespace

reviewbotreviewbot

W293 blank line contains whitespace

reviewbotreviewbot

F401 'logging' imported but unused

reviewbotreviewbot

F401 'subprocess' imported but unused

reviewbotreviewbot

E302 expected 2 blank lines, found 1

reviewbotreviewbot

E251 unexpected spaces around keyword / parameter equals

reviewbotreviewbot

E251 unexpected spaces around keyword / parameter equals

reviewbotreviewbot

E303 too many blank lines (2)

reviewbotreviewbot

E501 line too long (82 > 79 characters)

reviewbotreviewbot

E501 line too long (82 > 79 characters)

reviewbotreviewbot

E128 continuation line under-indented for visual indent

reviewbotreviewbot

E303 too many blank lines (2)

reviewbotreviewbot

E501 line too long (82 > 79 characters)

reviewbotreviewbot

E128 continuation line under-indented for visual indent

reviewbotreviewbot

F821 undefined name 'get_excluded_branches'

reviewbotreviewbot

E303 too many blank lines (2)

reviewbotreviewbot

E501 line too long (83 > 79 characters)

reviewbotreviewbot

E501 line too long (80 > 79 characters)

reviewbotreviewbot

E303 too many blank lines (2)

reviewbotreviewbot

E303 too many blank lines (2)

reviewbotreviewbot

E303 too many blank lines (2)

reviewbotreviewbot

E501 line too long (80 > 79 characters)

reviewbotreviewbot

E128 continuation line under-indented for visual indent

reviewbotreviewbot

E501 line too long (81 > 79 characters)

reviewbotreviewbot

F821 undefined name 'get_branches_containing_commit'

reviewbotreviewbot

E501 line too long (82 > 79 characters)

reviewbotreviewbot

E303 too many blank lines (2)

reviewbotreviewbot

F821 undefined name 'subprocess'

reviewbotreviewbot

F821 undefined name 'subprocess'

reviewbotreviewbot

F821 undefined name 'logging'

reviewbotreviewbot

E501 line too long (82 > 79 characters)

reviewbotreviewbot

W292 no newline at end of file

reviewbotreviewbot

F401 'logging' imported but unused

reviewbotreviewbot

F401 'subprocess' imported but unused

reviewbotreviewbot

E302 expected 2 blank lines, found 1

reviewbotreviewbot

E251 unexpected spaces around keyword / parameter equals

reviewbotreviewbot

E251 unexpected spaces around keyword / parameter equals

reviewbotreviewbot

E303 too many blank lines (2)

reviewbotreviewbot

E501 line too long (82 > 79 characters)

reviewbotreviewbot

E501 line too long (82 > 79 characters)

reviewbotreviewbot

E128 continuation line under-indented for visual indent

reviewbotreviewbot

E303 too many blank lines (2)

reviewbotreviewbot

E501 line too long (82 > 79 characters)

reviewbotreviewbot

E128 continuation line under-indented for visual indent

reviewbotreviewbot

F821 undefined name 'get_excluded_branches'

reviewbotreviewbot

E303 too many blank lines (2)

reviewbotreviewbot

E501 line too long (83 > 79 characters)

reviewbotreviewbot

E501 line too long (80 > 79 characters)

reviewbotreviewbot

E303 too many blank lines (2)

reviewbotreviewbot

E303 too many blank lines (2)

reviewbotreviewbot

E303 too many blank lines (2)

reviewbotreviewbot

E501 line too long (80 > 79 characters)

reviewbotreviewbot

E128 continuation line under-indented for visual indent

reviewbotreviewbot

F821 undefined name 'get_branches_containing_commit'

reviewbotreviewbot

E501 line too long (81 > 79 characters)

reviewbotreviewbot

E501 line too long (82 > 79 characters)

reviewbotreviewbot

E303 too many blank lines (2)

reviewbotreviewbot

F821 undefined name 'subprocess'

reviewbotreviewbot

F821 undefined name 'subprocess'

reviewbotreviewbot

F821 undefined name 'logging'

reviewbotreviewbot

E501 line too long (82 > 79 characters)

reviewbotreviewbot

W292 no newline at end of file

reviewbotreviewbot

E302 expected 2 blank lines, found 1

reviewbotreviewbot

E303 too many blank lines (2)

reviewbotreviewbot

W291 trailing whitespace

reviewbotreviewbot

W291 trailing whitespace

reviewbotreviewbot

W291 trailing whitespace

reviewbotreviewbot

W291 trailing whitespace

reviewbotreviewbot

W291 trailing whitespace

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E126 continuation line over-indented for hanging indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E302 expected 2 blank lines, found 1

reviewbotreviewbot

F401 'subprocess' imported but unused

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E502 the backslash is redundant between brackets

reviewbotreviewbot

E501 line too long (81 > 79 characters)

reviewbotreviewbot

E502 the backslash is redundant between brackets

reviewbotreviewbot

E502 the backslash is redundant between brackets

reviewbotreviewbot

E502 the backslash is redundant between brackets

reviewbotreviewbot

E502 the backslash is redundant between brackets

reviewbotreviewbot

E502 the backslash is redundant between brackets

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E502 the backslash is redundant between brackets

reviewbotreviewbot

E502 the backslash is redundant between brackets

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

W291 trailing whitespace

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

W291 trailing whitespace

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

F401 'logging' imported but unused

reviewbotreviewbot

F401 'subprocess' imported but unused

reviewbotreviewbot

F401 'logging' imported but unused

reviewbotreviewbot

F401 'subprocess' imported but unused

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

E127 continuation line over-indented for visual indent

reviewbotreviewbot

F401 'rbtools.clients.mercurial.MercurialClient' imported but unused

reviewbotreviewbot

F401 'rbtools.clients.svn.SVNClient' imported but unused

reviewbotreviewbot

E128 continuation line under-indented for visual indent

reviewbotreviewbot

E128 continuation line under-indented for visual indent

reviewbotreviewbot

W503 line break before binary operator

reviewbotreviewbot

W503 line break before binary operator

reviewbotreviewbot

W391 blank line at end of file

reviewbotreviewbot

W503 line break before binary operator

reviewbotreviewbot

W503 line break before binary operator

reviewbotreviewbot

W503 line break before binary operator

reviewbotreviewbot

W503 line break before binary operator

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

TheArcticGiraffe
Review request changed

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
Adding in-progress files.
Created repo-hook.py, which implements the most basic of functionality of a command, on which to build. 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.
71f6f67374c30350d242432a46116d48618162e8
Adding in-progress files.
Created repo-hook.py, which implements the most basic of functionality of a command, on which to build. 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.
71f6f67374c30350d242432a46116d48618162e8
Added new options to repo-hook command based on the functionality in contrib\tools\git-hook-set-submitted and contrib\tools\git-hook-check-approval. Followed same default values as found in these two hook scripts.
9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb
Fixed a few flake8 failure, and added in standard regex flag from contrib\tools\git-hook-set-submitted\n and contrib\tools\git-hook-check-approval as an option in the repo-hook command
ba3b42ca15f118cc032b924a791cb9683df93414
Brought functionality from git.py over to the GitRepositoryHooks class. This may change, but this is a starting point
f72a4ad674c91133e896a9b70e4b70b2e183f04c
Changed the wording and working of a few commands, so that the default is standard and it lexically makes sense for the user to add the option as a way to enable the function (e.g. --require-review-requests changed to dont-require-review-requests, and changed the default from True to False). As well, a few minor tab and line length errors were corrected
43358669072fd7988138c5f471f56eb6198324d3
This commit was an error fixing commit. Fixed some missed commas in the Options section, fixed a mispelling of store_true, fixed an error of using ! instead of not.
52269579029e65a75628683428951bff3fe37f18
Added option for specifying the type of repository repository being used (--repo-type).
Changed --type to be --hook-type to reduce confusion with --repo-type Moved execute() and get_review_request_id() from repo_hook.py to scmrepositoryhooks.py, as they were not used in repo_hook.py, and only needed in SCMRepositoryHooks and its subclasses. Other minor fixes, such as rearranging the imports and putting missing imports that were not brought over.
63f7658e2b9031c546a4b520fc64da6a2c703e72

Groups:

-rbtools
+students

Diff:

Revision 2 (+1158 -294)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

TheArcticGiraffe
Review request changed

Change Summary:

Brought remaining logic from existing Git hook scripts into repo-hook command

Commits:

Summary ID
Adding in-progress files.
Created repo-hook.py, which implements the most basic of functionality of a command, on which to build. 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.
71f6f67374c30350d242432a46116d48618162e8
Added new options to repo-hook command based on the functionality in contrib\tools\git-hook-set-submitted and contrib\tools\git-hook-check-approval. Followed same default values as found in these two hook scripts.
9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb
Fixed a few flake8 failure, and added in standard regex flag from contrib\tools\git-hook-set-submitted\n and contrib\tools\git-hook-check-approval as an option in the repo-hook command
ba3b42ca15f118cc032b924a791cb9683df93414
Brought functionality from git.py over to the GitRepositoryHooks class. This may change, but this is a starting point
f72a4ad674c91133e896a9b70e4b70b2e183f04c
Changed the wording and working of a few commands, so that the default is standard and it lexically makes sense for the user to add the option as a way to enable the function (e.g. --require-review-requests changed to dont-require-review-requests, and changed the default from True to False). As well, a few minor tab and line length errors were corrected
43358669072fd7988138c5f471f56eb6198324d3
This commit was an error fixing commit. Fixed some missed commas in the Options section, fixed a mispelling of store_true, fixed an error of using ! instead of not.
52269579029e65a75628683428951bff3fe37f18
Added option for specifying the type of repository repository being used (--repo-type).
Changed --type to be --hook-type to reduce confusion with --repo-type Moved execute() and get_review_request_id() from repo_hook.py to scmrepositoryhooks.py, as they were not used in repo_hook.py, and only needed in SCMRepositoryHooks and its subclasses. Other minor fixes, such as rearranging the imports and putting missing imports that were not brought over.
63f7658e2b9031c546a4b520fc64da6a2c703e72
Adding in-progress files.
Created repo-hook.py, which implements the most basic of functionality of a command, on which to build. 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.
71f6f67374c30350d242432a46116d48618162e8
Added new options to repo-hook command based on the functionality in contrib\tools\git-hook-set-submitted and contrib\tools\git-hook-check-approval. Followed same default values as found in these two hook scripts.
9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb
Fixed a few flake8 failure, and added in standard regex flag from contrib\tools\git-hook-set-submitted\n and contrib\tools\git-hook-check-approval as an option in the repo-hook command
ba3b42ca15f118cc032b924a791cb9683df93414
Brought functionality from git.py over to the GitRepositoryHooks class. This may change, but this is a starting point
f72a4ad674c91133e896a9b70e4b70b2e183f04c
Changed the wording and working of a few commands, so that the default is standard and it lexically makes sense for the user to add the option as a way to enable the function (e.g. --require-review-requests changed to dont-require-review-requests, and changed the default from True to False). As well, a few minor tab and line length errors were corrected
43358669072fd7988138c5f471f56eb6198324d3
This commit was an error fixing commit. Fixed some missed commas in the Options section, fixed a mispelling of store_true, fixed an error of using ! instead of not.
52269579029e65a75628683428951bff3fe37f18
Added option for specifying the type of repository repository being used (--repo-type).
Changed --type to be --hook-type to reduce confusion with --repo-type Moved execute() and get_review_request_id() from repo_hook.py to scmrepositoryhooks.py, as they were not used in repo_hook.py, and only needed in SCMRepositoryHooks and its subclasses. Other minor fixes, such as rearranging the imports and putting missing imports that were not brought over.
63f7658e2b9031c546a4b520fc64da6a2c703e72
Minor change, adding self variable to a class method inside SECRepositoryHooks class
Functionality brought from rbtools/hooks/common.py to rbtools/commands/repo_hook.py used to be outside the RepoHook class. These methods were brought into the RepoHook class to keep things clean.
55e914ec883c1fe8ae64d6737993396b298dad8c
Added the common lines between /contrib/tools/git-hook-set-submitted and /contrib/tools/git-hook-check-approval to rbtools/commands/repo_hook.py in the RepoHook Command subclass as the default behaviour before hook-type specific behaviour is taken
85cb9226317a9d8d009789e76f0ebe8bded52396
Removed unnecessary debug code from RepoHook class and its helper classes, and cleaned up the code a little.
f12f498b5ff2e8b59f2830060213d51d2bdac974
Brought logic for the pre-receive and post-receive functionality from /contrib/tools/git-hook-check-approval and /contrib/tools/git-hook-set-submitted into the pre_receive() and post_receive() methods of the RepoHook class.
Also implemented minor formatting fixes, as well as implementing Warning messages if the tool is given an unsupported SCM tool as a --repo-type option (currently Git is the only SCM supported
e1127d83acee2368c722df258c4b85171282fbe4

Diff:

Revision 3 (+1357 -433)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

TheArcticGiraffe
TheArcticGiraffe
Review request changed

Change Summary:

Went through all flake8 errors from revision 1-3 and fixed them.

Commits:

Summary ID
Adding in-progress files.
Created repo-hook.py, which implements the most basic of functionality of a command, on which to build. 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.
71f6f67374c30350d242432a46116d48618162e8
Added new options to repo-hook command based on the functionality in contrib\tools\git-hook-set-submitted and contrib\tools\git-hook-check-approval. Followed same default values as found in these two hook scripts.
9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb
Fixed a few flake8 failure, and added in standard regex flag from contrib\tools\git-hook-set-submitted\n and contrib\tools\git-hook-check-approval as an option in the repo-hook command
ba3b42ca15f118cc032b924a791cb9683df93414
Brought functionality from git.py over to the GitRepositoryHooks class. This may change, but this is a starting point
f72a4ad674c91133e896a9b70e4b70b2e183f04c
Changed the wording and working of a few commands, so that the default is standard and it lexically makes sense for the user to add the option as a way to enable the function (e.g. --require-review-requests changed to dont-require-review-requests, and changed the default from True to False). As well, a few minor tab and line length errors were corrected
43358669072fd7988138c5f471f56eb6198324d3
This commit was an error fixing commit. Fixed some missed commas in the Options section, fixed a mispelling of store_true, fixed an error of using ! instead of not.
52269579029e65a75628683428951bff3fe37f18
Added option for specifying the type of repository repository being used (--repo-type).
Changed --type to be --hook-type to reduce confusion with --repo-type Moved execute() and get_review_request_id() from repo_hook.py to scmrepositoryhooks.py, as they were not used in repo_hook.py, and only needed in SCMRepositoryHooks and its subclasses. Other minor fixes, such as rearranging the imports and putting missing imports that were not brought over.
63f7658e2b9031c546a4b520fc64da6a2c703e72
Minor change, adding self variable to a class method inside SECRepositoryHooks class
Functionality brought from rbtools/hooks/common.py to rbtools/commands/repo_hook.py used to be outside the RepoHook class. These methods were brought into the RepoHook class to keep things clean.
55e914ec883c1fe8ae64d6737993396b298dad8c
Added the common lines between /contrib/tools/git-hook-set-submitted and /contrib/tools/git-hook-check-approval to rbtools/commands/repo_hook.py in the RepoHook Command subclass as the default behaviour before hook-type specific behaviour is taken
85cb9226317a9d8d009789e76f0ebe8bded52396
Removed unnecessary debug code from RepoHook class and its helper classes, and cleaned up the code a little.
f12f498b5ff2e8b59f2830060213d51d2bdac974
Brought logic for the pre-receive and post-receive functionality from /contrib/tools/git-hook-check-approval and /contrib/tools/git-hook-set-submitted into the pre_receive() and post_receive() methods of the RepoHook class.
Also implemented minor formatting fixes, as well as implementing Warning messages if the tool is given an unsupported SCM tool as a --repo-type option (currently Git is the only SCM supported
e1127d83acee2368c722df258c4b85171282fbe4
Adding in-progress files.
Created repo-hook.py, which implements the most basic of functionality of a command, on which to build. 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.
71f6f67374c30350d242432a46116d48618162e8
Added new options to repo-hook command based on the functionality in contrib\tools\git-hook-set-submitted and contrib\tools\git-hook-check-approval. Followed same default values as found in these two hook scripts.
9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb
Fixed a few flake8 failure, and added in standard regex flag from contrib\tools\git-hook-set-submitted\n and contrib\tools\git-hook-check-approval as an option in the repo-hook command
ba3b42ca15f118cc032b924a791cb9683df93414
Brought functionality from git.py over to the GitRepositoryHooks class. This may change, but this is a starting point
f72a4ad674c91133e896a9b70e4b70b2e183f04c
Changed the wording and working of a few commands, so that the default is standard and it lexically makes sense for the user to add the option as a way to enable the function (e.g. --require-review-requests changed to dont-require-review-requests, and changed the default from True to False). As well, a few minor tab and line length errors were corrected
43358669072fd7988138c5f471f56eb6198324d3
This commit was an error fixing commit. Fixed some missed commas in the Options section, fixed a mispelling of store_true, fixed an error of using ! instead of not.
52269579029e65a75628683428951bff3fe37f18
Added option for specifying the type of repository repository being used (--repo-type).
Changed --type to be --hook-type to reduce confusion with --repo-type Moved execute() and get_review_request_id() from repo_hook.py to scmrepositoryhooks.py, as they were not used in repo_hook.py, and only needed in SCMRepositoryHooks and its subclasses. Other minor fixes, such as rearranging the imports and putting missing imports that were not brought over.
63f7658e2b9031c546a4b520fc64da6a2c703e72
Minor change, adding self variable to a class method inside SECRepositoryHooks class
Functionality brought from rbtools/hooks/common.py to rbtools/commands/repo_hook.py used to be outside the RepoHook class. These methods were brought into the RepoHook class to keep things clean.
55e914ec883c1fe8ae64d6737993396b298dad8c
Added the common lines between /contrib/tools/git-hook-set-submitted and /contrib/tools/git-hook-check-approval to rbtools/commands/repo_hook.py in the RepoHook Command subclass as the default behaviour before hook-type specific behaviour is taken
85cb9226317a9d8d009789e76f0ebe8bded52396
Removed unnecessary debug code from RepoHook class and its helper classes, and cleaned up the code a little.
f12f498b5ff2e8b59f2830060213d51d2bdac974
Brought logic for the pre-receive and post-receive functionality from /contrib/tools/git-hook-check-approval and /contrib/tools/git-hook-set-submitted into the pre_receive() and post_receive() methods of the RepoHook class.
Also implemented minor formatting fixes, as well as implementing Warning messages if the tool is given an unsupported SCM tool as a --repo-type option (currently Git is the only SCM supported
e1127d83acee2368c722df258c4b85171282fbe4
Went through all flake8 errors that occured throughout the first 3 posts to ReviewBoard
and fixed them
005d94249b6f98b485f506ac8e949d81d7a841dd

Diff:

Revision 4 (+1397 -473)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

TheArcticGiraffe
Review request changed

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
Adding in-progress files.
Created repo-hook.py, which implements the most basic of functionality of a command, on which to build. 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.
71f6f67374c30350d242432a46116d48618162e8
Added new options to repo-hook command based on the functionality in contrib\tools\git-hook-set-submitted and contrib\tools\git-hook-check-approval. Followed same default values as found in these two hook scripts.
9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb
Fixed a few flake8 failure, and added in standard regex flag from contrib\tools\git-hook-set-submitted\n and contrib\tools\git-hook-check-approval as an option in the repo-hook command
ba3b42ca15f118cc032b924a791cb9683df93414
Brought functionality from git.py over to the GitRepositoryHooks class. This may change, but this is a starting point
f72a4ad674c91133e896a9b70e4b70b2e183f04c
Changed the wording and working of a few commands, so that the default is standard and it lexically makes sense for the user to add the option as a way to enable the function (e.g. --require-review-requests changed to dont-require-review-requests, and changed the default from True to False). As well, a few minor tab and line length errors were corrected
43358669072fd7988138c5f471f56eb6198324d3
This commit was an error fixing commit. Fixed some missed commas in the Options section, fixed a mispelling of store_true, fixed an error of using ! instead of not.
52269579029e65a75628683428951bff3fe37f18
Added option for specifying the type of repository repository being used (--repo-type).
Changed --type to be --hook-type to reduce confusion with --repo-type Moved execute() and get_review_request_id() from repo_hook.py to scmrepositoryhooks.py, as they were not used in repo_hook.py, and only needed in SCMRepositoryHooks and its subclasses. Other minor fixes, such as rearranging the imports and putting missing imports that were not brought over.
63f7658e2b9031c546a4b520fc64da6a2c703e72
Minor change, adding self variable to a class method inside SECRepositoryHooks class
Functionality brought from rbtools/hooks/common.py to rbtools/commands/repo_hook.py used to be outside the RepoHook class. These methods were brought into the RepoHook class to keep things clean.
55e914ec883c1fe8ae64d6737993396b298dad8c
Added the common lines between /contrib/tools/git-hook-set-submitted and /contrib/tools/git-hook-check-approval to rbtools/commands/repo_hook.py in the RepoHook Command subclass as the default behaviour before hook-type specific behaviour is taken
85cb9226317a9d8d009789e76f0ebe8bded52396
Removed unnecessary debug code from RepoHook class and its helper classes, and cleaned up the code a little.
f12f498b5ff2e8b59f2830060213d51d2bdac974
Brought logic for the pre-receive and post-receive functionality from /contrib/tools/git-hook-check-approval and /contrib/tools/git-hook-set-submitted into the pre_receive() and post_receive() methods of the RepoHook class.
Also implemented minor formatting fixes, as well as implementing Warning messages if the tool is given an unsupported SCM tool as a --repo-type option (currently Git is the only SCM supported
e1127d83acee2368c722df258c4b85171282fbe4
Went through all flake8 errors that occured throughout the first 3 posts to ReviewBoard
and fixed them
005d94249b6f98b485f506ac8e949d81d7a841dd
Adding in-progress files.
Created repo-hook.py, which implements the most basic of functionality of a command, on which to build. 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.
71f6f67374c30350d242432a46116d48618162e8
Added new options to repo-hook command based on the functionality in contrib\tools\git-hook-set-submitted and contrib\tools\git-hook-check-approval. Followed same default values as found in these two hook scripts.
9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb
Fixed a few flake8 failure, and added in standard regex flag from contrib\tools\git-hook-set-submitted\n and contrib\tools\git-hook-check-approval as an option in the repo-hook command
ba3b42ca15f118cc032b924a791cb9683df93414
Brought functionality from git.py over to the GitRepositoryHooks class. This may change, but this is a starting point
f72a4ad674c91133e896a9b70e4b70b2e183f04c
Changed the wording and working of a few commands, so that the default is standard and it lexically makes sense for the user to add the option as a way to enable the function (e.g. --require-review-requests changed to dont-require-review-requests, and changed the default from True to False). As well, a few minor tab and line length errors were corrected
43358669072fd7988138c5f471f56eb6198324d3
This commit was an error fixing commit. Fixed some missed commas in the Options section, fixed a mispelling of store_true, fixed an error of using ! instead of not.
52269579029e65a75628683428951bff3fe37f18
Added option for specifying the type of repository repository being used (--repo-type).
Changed --type to be --hook-type to reduce confusion with --repo-type Moved execute() and get_review_request_id() from repo_hook.py to scmrepositoryhooks.py, as they were not used in repo_hook.py, and only needed in SCMRepositoryHooks and its subclasses. Other minor fixes, such as rearranging the imports and putting missing imports that were not brought over.
63f7658e2b9031c546a4b520fc64da6a2c703e72
Minor change, adding self variable to a class method inside SECRepositoryHooks class
Functionality brought from rbtools/hooks/common.py to rbtools/commands/repo_hook.py used to be outside the RepoHook class. These methods were brought into the RepoHook class to keep things clean.
55e914ec883c1fe8ae64d6737993396b298dad8c
Added the common lines between /contrib/tools/git-hook-set-submitted and /contrib/tools/git-hook-check-approval to rbtools/commands/repo_hook.py in the RepoHook Command subclass as the default behaviour before hook-type specific behaviour is taken
85cb9226317a9d8d009789e76f0ebe8bded52396
Removed unnecessary debug code from RepoHook class and its helper classes, and cleaned up the code a little.
f12f498b5ff2e8b59f2830060213d51d2bdac974
Brought logic for the pre-receive and post-receive functionality from /contrib/tools/git-hook-check-approval and /contrib/tools/git-hook-set-submitted into the pre_receive() and post_receive() methods of the RepoHook class.
Also implemented minor formatting fixes, as well as implementing Warning messages if the tool is given an unsupported SCM tool as a --repo-type option (currently Git is the only SCM supported
e1127d83acee2368c722df258c4b85171282fbe4
Went through all flake8 errors that occured throughout the first 3 posts to ReviewBoard
and fixed them
005d94249b6f98b485f506ac8e949d81d7a841dd
More flake8 issue fixing.
f0903e5262699bf86eb5f3becaf85bf4dd8495b3
Review Request #11492
Removed 'continue on next line' characters from unnecessary locations in repo-hook command. Corrected lines being too long in some files.
46d45e305a396de7e67664529e2fea9dfc4e6897

Diff:

Revision 5 (+1487 -549)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

TheArcticGiraffe
Review request changed

Commits:

Summary ID
Adding in-progress files.
Created repo-hook.py, which implements the most basic of functionality of a command, on which to build. 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.
71f6f67374c30350d242432a46116d48618162e8
Added new options to repo-hook command based on the functionality in contrib\tools\git-hook-set-submitted and contrib\tools\git-hook-check-approval. Followed same default values as found in these two hook scripts.
9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb
Fixed a few flake8 failure, and added in standard regex flag from contrib\tools\git-hook-set-submitted\n and contrib\tools\git-hook-check-approval as an option in the repo-hook command
ba3b42ca15f118cc032b924a791cb9683df93414
Brought functionality from git.py over to the GitRepositoryHooks class. This may change, but this is a starting point
f72a4ad674c91133e896a9b70e4b70b2e183f04c
Changed the wording and working of a few commands, so that the default is standard and it lexically makes sense for the user to add the option as a way to enable the function (e.g. --require-review-requests changed to dont-require-review-requests, and changed the default from True to False). As well, a few minor tab and line length errors were corrected
43358669072fd7988138c5f471f56eb6198324d3
This commit was an error fixing commit. Fixed some missed commas in the Options section, fixed a mispelling of store_true, fixed an error of using ! instead of not.
52269579029e65a75628683428951bff3fe37f18
Added option for specifying the type of repository repository being used (--repo-type).
Changed --type to be --hook-type to reduce confusion with --repo-type Moved execute() and get_review_request_id() from repo_hook.py to scmrepositoryhooks.py, as they were not used in repo_hook.py, and only needed in SCMRepositoryHooks and its subclasses. Other minor fixes, such as rearranging the imports and putting missing imports that were not brought over.
63f7658e2b9031c546a4b520fc64da6a2c703e72
Minor change, adding self variable to a class method inside SECRepositoryHooks class
Functionality brought from rbtools/hooks/common.py to rbtools/commands/repo_hook.py used to be outside the RepoHook class. These methods were brought into the RepoHook class to keep things clean.
55e914ec883c1fe8ae64d6737993396b298dad8c
Added the common lines between /contrib/tools/git-hook-set-submitted and /contrib/tools/git-hook-check-approval to rbtools/commands/repo_hook.py in the RepoHook Command subclass as the default behaviour before hook-type specific behaviour is taken
85cb9226317a9d8d009789e76f0ebe8bded52396
Removed unnecessary debug code from RepoHook class and its helper classes, and cleaned up the code a little.
f12f498b5ff2e8b59f2830060213d51d2bdac974
Brought logic for the pre-receive and post-receive functionality from /contrib/tools/git-hook-check-approval and /contrib/tools/git-hook-set-submitted into the pre_receive() and post_receive() methods of the RepoHook class.
Also implemented minor formatting fixes, as well as implementing Warning messages if the tool is given an unsupported SCM tool as a --repo-type option (currently Git is the only SCM supported
e1127d83acee2368c722df258c4b85171282fbe4
Went through all flake8 errors that occured throughout the first 3 posts to ReviewBoard
and fixed them
005d94249b6f98b485f506ac8e949d81d7a841dd
More flake8 issue fixing.
f0903e5262699bf86eb5f3becaf85bf4dd8495b3
Review Request #11492
Removed 'continue on next line' characters from unnecessary locations in repo-hook command. Corrected lines being too long in some files.
46d45e305a396de7e67664529e2fea9dfc4e6897
Adding in-progress files.
Created repo-hook.py, which implements the most basic of functionality of a command, on which to build. 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.
71f6f67374c30350d242432a46116d48618162e8
Added new options to repo-hook command based on the functionality in contrib\tools\git-hook-set-submitted and contrib\tools\git-hook-check-approval. Followed same default values as found in these two hook scripts.
9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb
Fixed a few flake8 failure, and added in standard regex flag from contrib\tools\git-hook-set-submitted\n and contrib\tools\git-hook-check-approval as an option in the repo-hook command
ba3b42ca15f118cc032b924a791cb9683df93414
Brought functionality from git.py over to the GitRepositoryHooks class. This may change, but this is a starting point
f72a4ad674c91133e896a9b70e4b70b2e183f04c
Changed the wording and working of a few commands, so that the default is standard and it lexically makes sense for the user to add the option as a way to enable the function (e.g. --require-review-requests changed to dont-require-review-requests, and changed the default from True to False). As well, a few minor tab and line length errors were corrected
43358669072fd7988138c5f471f56eb6198324d3
This commit was an error fixing commit. Fixed some missed commas in the Options section, fixed a mispelling of store_true, fixed an error of using ! instead of not.
52269579029e65a75628683428951bff3fe37f18
Added option for specifying the type of repository repository being used (--repo-type).
Changed --type to be --hook-type to reduce confusion with --repo-type Moved execute() and get_review_request_id() from repo_hook.py to scmrepositoryhooks.py, as they were not used in repo_hook.py, and only needed in SCMRepositoryHooks and its subclasses. Other minor fixes, such as rearranging the imports and putting missing imports that were not brought over.
63f7658e2b9031c546a4b520fc64da6a2c703e72
Minor change, adding self variable to a class method inside SECRepositoryHooks class
Functionality brought from rbtools/hooks/common.py to rbtools/commands/repo_hook.py used to be outside the RepoHook class. These methods were brought into the RepoHook class to keep things clean.
55e914ec883c1fe8ae64d6737993396b298dad8c
Added the common lines between /contrib/tools/git-hook-set-submitted and /contrib/tools/git-hook-check-approval to rbtools/commands/repo_hook.py in the RepoHook Command subclass as the default behaviour before hook-type specific behaviour is taken
85cb9226317a9d8d009789e76f0ebe8bded52396
Removed unnecessary debug code from RepoHook class and its helper classes, and cleaned up the code a little.
f12f498b5ff2e8b59f2830060213d51d2bdac974
Brought logic for the pre-receive and post-receive functionality from /contrib/tools/git-hook-check-approval and /contrib/tools/git-hook-set-submitted into the pre_receive() and post_receive() methods of the RepoHook class.
Also implemented minor formatting fixes, as well as implementing Warning messages if the tool is given an unsupported SCM tool as a --repo-type option (currently Git is the only SCM supported
e1127d83acee2368c722df258c4b85171282fbe4
Went through all flake8 errors that occured throughout the first 3 posts to ReviewBoard
and fixed them
005d94249b6f98b485f506ac8e949d81d7a841dd
More flake8 issue fixing.
f0903e5262699bf86eb5f3becaf85bf4dd8495b3
Review Request #11492
Removed 'continue on next line' characters from unnecessary locations in repo-hook command. Corrected lines being too long in some files.
46d45e305a396de7e67664529e2fea9dfc4e6897
Altered how repo_hook command accesses SCMRepositoryHooks subclasses. Now, repo_hook will call on the correcponsing SCM client, of which each now has a repository_hooks_class class attribute. The repo_hook command can access the corresponsing SCMRepositoryHooks subclass depending on the --repo-type supplied in the command. Skeleton code for the SVNRepositoryHooks and MercurialRepositoryHooks classes have been created to make sure all functionality is working. Also changed the GitRepositoryHooks class to no longer need to be supplied a copy of the RepoHook class (incorrect idea about code layout. Review Request #11492.
545a2942acc05c5bed4d1d02f46d7bdc0d7109ac

Diff:

Revision 6 (+1625 -555)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

TheArcticGiraffe
Review request changed

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
Adding in-progress files.
Created repo-hook.py, which implements the most basic of functionality of a command, on which to build. 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.
71f6f67374c30350d242432a46116d48618162e8
Added new options to repo-hook command based on the functionality in contrib\tools\git-hook-set-submitted and contrib\tools\git-hook-check-approval. Followed same default values as found in these two hook scripts.
9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb
Fixed a few flake8 failure, and added in standard regex flag from contrib\tools\git-hook-set-submitted\n and contrib\tools\git-hook-check-approval as an option in the repo-hook command
ba3b42ca15f118cc032b924a791cb9683df93414
Brought functionality from git.py over to the GitRepositoryHooks class. This may change, but this is a starting point
f72a4ad674c91133e896a9b70e4b70b2e183f04c
Changed the wording and working of a few commands, so that the default is standard and it lexically makes sense for the user to add the option as a way to enable the function (e.g. --require-review-requests changed to dont-require-review-requests, and changed the default from True to False). As well, a few minor tab and line length errors were corrected
43358669072fd7988138c5f471f56eb6198324d3
This commit was an error fixing commit. Fixed some missed commas in the Options section, fixed a mispelling of store_true, fixed an error of using ! instead of not.
52269579029e65a75628683428951bff3fe37f18
Added option for specifying the type of repository repository being used (--repo-type).
Changed --type to be --hook-type to reduce confusion with --repo-type Moved execute() and get_review_request_id() from repo_hook.py to scmrepositoryhooks.py, as they were not used in repo_hook.py, and only needed in SCMRepositoryHooks and its subclasses. Other minor fixes, such as rearranging the imports and putting missing imports that were not brought over.
63f7658e2b9031c546a4b520fc64da6a2c703e72
Minor change, adding self variable to a class method inside SECRepositoryHooks class
Functionality brought from rbtools/hooks/common.py to rbtools/commands/repo_hook.py used to be outside the RepoHook class. These methods were brought into the RepoHook class to keep things clean.
55e914ec883c1fe8ae64d6737993396b298dad8c
Added the common lines between /contrib/tools/git-hook-set-submitted and /contrib/tools/git-hook-check-approval to rbtools/commands/repo_hook.py in the RepoHook Command subclass as the default behaviour before hook-type specific behaviour is taken
85cb9226317a9d8d009789e76f0ebe8bded52396
Removed unnecessary debug code from RepoHook class and its helper classes, and cleaned up the code a little.
f12f498b5ff2e8b59f2830060213d51d2bdac974
Brought logic for the pre-receive and post-receive functionality from /contrib/tools/git-hook-check-approval and /contrib/tools/git-hook-set-submitted into the pre_receive() and post_receive() methods of the RepoHook class.
Also implemented minor formatting fixes, as well as implementing Warning messages if the tool is given an unsupported SCM tool as a --repo-type option (currently Git is the only SCM supported
e1127d83acee2368c722df258c4b85171282fbe4
Went through all flake8 errors that occured throughout the first 3 posts to ReviewBoard
and fixed them
005d94249b6f98b485f506ac8e949d81d7a841dd
More flake8 issue fixing.
f0903e5262699bf86eb5f3becaf85bf4dd8495b3
Review Request #11492
Removed 'continue on next line' characters from unnecessary locations in repo-hook command. Corrected lines being too long in some files.
46d45e305a396de7e67664529e2fea9dfc4e6897
Altered how repo_hook command accesses SCMRepositoryHooks subclasses. Now, repo_hook will call on the correcponsing SCM client, of which each now has a repository_hooks_class class attribute. The repo_hook command can access the corresponsing SCMRepositoryHooks subclass depending on the --repo-type supplied in the command. Skeleton code for the SVNRepositoryHooks and MercurialRepositoryHooks classes have been created to make sure all functionality is working. Also changed the GitRepositoryHooks class to no longer need to be supplied a copy of the RepoHook class (incorrect idea about code layout. Review Request #11492.
545a2942acc05c5bed4d1d02f46d7bdc0d7109ac
Adding in-progress files.
Created repo-hook.py, which implements the most basic of functionality of a command, on which to build. 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.
71f6f67374c30350d242432a46116d48618162e8
Added new options to repo-hook command based on the functionality in contrib\tools\git-hook-set-submitted and contrib\tools\git-hook-check-approval. Followed same default values as found in these two hook scripts.
9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb
Fixed a few flake8 failure, and added in standard regex flag from contrib\tools\git-hook-set-submitted\n and contrib\tools\git-hook-check-approval as an option in the repo-hook command
ba3b42ca15f118cc032b924a791cb9683df93414
Brought functionality from git.py over to the GitRepositoryHooks class. This may change, but this is a starting point
f72a4ad674c91133e896a9b70e4b70b2e183f04c
Changed the wording and working of a few commands, so that the default is standard and it lexically makes sense for the user to add the option as a way to enable the function (e.g. --require-review-requests changed to dont-require-review-requests, and changed the default from True to False). As well, a few minor tab and line length errors were corrected
43358669072fd7988138c5f471f56eb6198324d3
This commit was an error fixing commit. Fixed some missed commas in the Options section, fixed a mispelling of store_true, fixed an error of using ! instead of not.
52269579029e65a75628683428951bff3fe37f18
Added option for specifying the type of repository repository being used (--repo-type).
Changed --type to be --hook-type to reduce confusion with --repo-type Moved execute() and get_review_request_id() from repo_hook.py to scmrepositoryhooks.py, as they were not used in repo_hook.py, and only needed in SCMRepositoryHooks and its subclasses. Other minor fixes, such as rearranging the imports and putting missing imports that were not brought over.
63f7658e2b9031c546a4b520fc64da6a2c703e72
Minor change, adding self variable to a class method inside SECRepositoryHooks class
Functionality brought from rbtools/hooks/common.py to rbtools/commands/repo_hook.py used to be outside the RepoHook class. These methods were brought into the RepoHook class to keep things clean.
55e914ec883c1fe8ae64d6737993396b298dad8c
Added the common lines between /contrib/tools/git-hook-set-submitted and /contrib/tools/git-hook-check-approval to rbtools/commands/repo_hook.py in the RepoHook Command subclass as the default behaviour before hook-type specific behaviour is taken
85cb9226317a9d8d009789e76f0ebe8bded52396
Removed unnecessary debug code from RepoHook class and its helper classes, and cleaned up the code a little.
f12f498b5ff2e8b59f2830060213d51d2bdac974
Brought logic for the pre-receive and post-receive functionality from /contrib/tools/git-hook-check-approval and /contrib/tools/git-hook-set-submitted into the pre_receive() and post_receive() methods of the RepoHook class.
Also implemented minor formatting fixes, as well as implementing Warning messages if the tool is given an unsupported SCM tool as a --repo-type option (currently Git is the only SCM supported
e1127d83acee2368c722df258c4b85171282fbe4
Went through all flake8 errors that occured throughout the first 3 posts to ReviewBoard
and fixed them
005d94249b6f98b485f506ac8e949d81d7a841dd
More flake8 issue fixing.
f0903e5262699bf86eb5f3becaf85bf4dd8495b3
Review Request #11492
Removed 'continue on next line' characters from unnecessary locations in repo-hook command. Corrected lines being too long in some files.
46d45e305a396de7e67664529e2fea9dfc4e6897
Altered how repo_hook command accesses SCMRepositoryHooks subclasses. Now, repo_hook will call on the correcponsing SCM client, of which each now has a repository_hooks_class class attribute. The repo_hook command can access the corresponsing SCMRepositoryHooks subclass depending on the --repo-type supplied in the command. Skeleton code for the SVNRepositoryHooks and MercurialRepositoryHooks classes have been created to make sure all functionality is working. Also changed the GitRepositoryHooks class to no longer need to be supplied a copy of the RepoHook class (incorrect idea about code layout. Review Request #11492.
545a2942acc05c5bed4d1d02f46d7bdc0d7109ac
Fixed all current flake8 errors via local version of flake8
873fa7a5ff642af1291ebe1c12131d76c092e64b
Minor changes, added sys.exit(1) for bad result in order for pre-receive hook to know what happened. Fixed some uncaught name spelling errors and other issues. Review Request #11492
b310e24a3c5cf7afb0a7f0c98cb97e83ff70b3dd
Reorganized how rbtools/command/repo-hook.py and rbtools/clients/scmrepositoryhooks.py and all it's subclasses functioned. Previously, RepoHook called the functionality it needed from methods in the SCMRepositoryHooks directly. Now, depending on the hook-type passed in (pre-receive, post-receive, etc), RepoHook will call the corresponding method in the SCMRepositoryHooks subclass (e.g. SCMRepositoryHooks.pre_receive()) in order to get the stuff it needs. This is done so that the method calls will be the same, regardless of what SCM the hook is being used for.
Changed all instances of post_commit() to post_receive() in SCMRepositoryHooks class and it's subclasses. This was a typo, as post-commit hooks is not something currently planned to the repo-hook command. Other minor refactoring of the RepoHook class, such as moving bulky if/else statements for determining the SCMRepositoryHook subclass to be grabbed into a method of its own to clean up main(). As well, moved some code that would not neccesarily be used for hooks besides post-receive and pre-receive into their respective methods, instead of keeping them in main(). Also finished testing the pre-receive hook, before and after the refactoring. Review Request #11492
72eb9f5082f65cc8fba59cc346ed121964558f74
Minor tweaks to some method calls for the post-receive hook side of repo-hook. Errors found with passing too many arguments or passing arguments the incorrect way.
03a5a7ea1187a0ffbbae88489714fbf2f5305e15

Diff:

Revision 7 (+1808 -678)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

TheArcticGiraffe
Review request changed

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 used
+Implementing 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
Adding in-progress files.
Created repo-hook.py, which implements the most basic of functionality of a command, on which to build. 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.
71f6f67374c30350d242432a46116d48618162e8
Added new options to repo-hook command based on the functionality in contrib\tools\git-hook-set-submitted and contrib\tools\git-hook-check-approval. Followed same default values as found in these two hook scripts.
9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb
Fixed a few flake8 failure, and added in standard regex flag from contrib\tools\git-hook-set-submitted\n and contrib\tools\git-hook-check-approval as an option in the repo-hook command
ba3b42ca15f118cc032b924a791cb9683df93414
Brought functionality from git.py over to the GitRepositoryHooks class. This may change, but this is a starting point
f72a4ad674c91133e896a9b70e4b70b2e183f04c
Changed the wording and working of a few commands, so that the default is standard and it lexically makes sense for the user to add the option as a way to enable the function (e.g. --require-review-requests changed to dont-require-review-requests, and changed the default from True to False). As well, a few minor tab and line length errors were corrected
43358669072fd7988138c5f471f56eb6198324d3
This commit was an error fixing commit. Fixed some missed commas in the Options section, fixed a mispelling of store_true, fixed an error of using ! instead of not.
52269579029e65a75628683428951bff3fe37f18
Added option for specifying the type of repository repository being used (--repo-type).
Changed --type to be --hook-type to reduce confusion with --repo-type Moved execute() and get_review_request_id() from repo_hook.py to scmrepositoryhooks.py, as they were not used in repo_hook.py, and only needed in SCMRepositoryHooks and its subclasses. Other minor fixes, such as rearranging the imports and putting missing imports that were not brought over.
63f7658e2b9031c546a4b520fc64da6a2c703e72
Minor change, adding self variable to a class method inside SECRepositoryHooks class
Functionality brought from rbtools/hooks/common.py to rbtools/commands/repo_hook.py used to be outside the RepoHook class. These methods were brought into the RepoHook class to keep things clean.
55e914ec883c1fe8ae64d6737993396b298dad8c
Added the common lines between /contrib/tools/git-hook-set-submitted and /contrib/tools/git-hook-check-approval to rbtools/commands/repo_hook.py in the RepoHook Command subclass as the default behaviour before hook-type specific behaviour is taken
85cb9226317a9d8d009789e76f0ebe8bded52396
Removed unnecessary debug code from RepoHook class and its helper classes, and cleaned up the code a little.
f12f498b5ff2e8b59f2830060213d51d2bdac974
Brought logic for the pre-receive and post-receive functionality from /contrib/tools/git-hook-check-approval and /contrib/tools/git-hook-set-submitted into the pre_receive() and post_receive() methods of the RepoHook class.
Also implemented minor formatting fixes, as well as implementing Warning messages if the tool is given an unsupported SCM tool as a --repo-type option (currently Git is the only SCM supported
e1127d83acee2368c722df258c4b85171282fbe4
Went through all flake8 errors that occured throughout the first 3 posts to ReviewBoard
and fixed them
005d94249b6f98b485f506ac8e949d81d7a841dd
More flake8 issue fixing.
f0903e5262699bf86eb5f3becaf85bf4dd8495b3
Review Request #11492
Removed 'continue on next line' characters from unnecessary locations in repo-hook command. Corrected lines being too long in some files.
46d45e305a396de7e67664529e2fea9dfc4e6897
Altered how repo_hook command accesses SCMRepositoryHooks subclasses. Now, repo_hook will call on the correcponsing SCM client, of which each now has a repository_hooks_class class attribute. The repo_hook command can access the corresponsing SCMRepositoryHooks subclass depending on the --repo-type supplied in the command. Skeleton code for the SVNRepositoryHooks and MercurialRepositoryHooks classes have been created to make sure all functionality is working. Also changed the GitRepositoryHooks class to no longer need to be supplied a copy of the RepoHook class (incorrect idea about code layout. Review Request #11492.
545a2942acc05c5bed4d1d02f46d7bdc0d7109ac
Fixed all current flake8 errors via local version of flake8
873fa7a5ff642af1291ebe1c12131d76c092e64b
Minor changes, added sys.exit(1) for bad result in order for pre-receive hook to know what happened. Fixed some uncaught name spelling errors and other issues. Review Request #11492
b310e24a3c5cf7afb0a7f0c98cb97e83ff70b3dd
Reorganized how rbtools/command/repo-hook.py and rbtools/clients/scmrepositoryhooks.py and all it's subclasses functioned. Previously, RepoHook called the functionality it needed from methods in the SCMRepositoryHooks directly. Now, depending on the hook-type passed in (pre-receive, post-receive, etc), RepoHook will call the corresponding method in the SCMRepositoryHooks subclass (e.g. SCMRepositoryHooks.pre_receive()) in order to get the stuff it needs. This is done so that the method calls will be the same, regardless of what SCM the hook is being used for.
Changed all instances of post_commit() to post_receive() in SCMRepositoryHooks class and it's subclasses. This was a typo, as post-commit hooks is not something currently planned to the repo-hook command. Other minor refactoring of the RepoHook class, such as moving bulky if/else statements for determining the SCMRepositoryHook subclass to be grabbed into a method of its own to clean up main(). As well, moved some code that would not neccesarily be used for hooks besides post-receive and pre-receive into their respective methods, instead of keeping them in main(). Also finished testing the pre-receive hook, before and after the refactoring. Review Request #11492
72eb9f5082f65cc8fba59cc346ed121964558f74
Minor tweaks to some method calls for the post-receive hook side of repo-hook. Errors found with passing too many arguments or passing arguments the incorrect way.
03a5a7ea1187a0ffbbae88489714fbf2f5305e15
Adding in-progress files.
Created repo-hook.py, which implements the most basic of functionality of a command, on which to build. 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.
71f6f67374c30350d242432a46116d48618162e8
Added new options to repo-hook command based on the functionality in contrib\tools\git-hook-set-submitted and contrib\tools\git-hook-check-approval. Followed same default values as found in these two hook scripts.
9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb
Fixed a few flake8 failure, and added in standard regex flag from contrib\tools\git-hook-set-submitted\n and contrib\tools\git-hook-check-approval as an option in the repo-hook command
ba3b42ca15f118cc032b924a791cb9683df93414
Brought functionality from git.py over to the GitRepositoryHooks class. This may change, but this is a starting point
f72a4ad674c91133e896a9b70e4b70b2e183f04c
Changed the wording and working of a few commands, so that the default is standard and it lexically makes sense for the user to add the option as a way to enable the function (e.g. --require-review-requests changed to dont-require-review-requests, and changed the default from True to False). As well, a few minor tab and line length errors were corrected
43358669072fd7988138c5f471f56eb6198324d3
This commit was an error fixing commit. Fixed some missed commas in the Options section, fixed a mispelling of store_true, fixed an error of using ! instead of not.
52269579029e65a75628683428951bff3fe37f18
Added option for specifying the type of repository repository being used (--repo-type).
Changed --type to be --hook-type to reduce confusion with --repo-type Moved execute() and get_review_request_id() from repo_hook.py to scmrepositoryhooks.py, as they were not used in repo_hook.py, and only needed in SCMRepositoryHooks and its subclasses. Other minor fixes, such as rearranging the imports and putting missing imports that were not brought over.
63f7658e2b9031c546a4b520fc64da6a2c703e72
Minor change, adding self variable to a class method inside SECRepositoryHooks class
Functionality brought from rbtools/hooks/common.py to rbtools/commands/repo_hook.py used to be outside the RepoHook class. These methods were brought into the RepoHook class to keep things clean.
55e914ec883c1fe8ae64d6737993396b298dad8c
Added the common lines between /contrib/tools/git-hook-set-submitted and /contrib/tools/git-hook-check-approval to rbtools/commands/repo_hook.py in the RepoHook Command subclass as the default behaviour before hook-type specific behaviour is taken
85cb9226317a9d8d009789e76f0ebe8bded52396
Removed unnecessary debug code from RepoHook class and its helper classes, and cleaned up the code a little.
f12f498b5ff2e8b59f2830060213d51d2bdac974
Brought logic for the pre-receive and post-receive functionality from /contrib/tools/git-hook-check-approval and /contrib/tools/git-hook-set-submitted into the pre_receive() and post_receive() methods of the RepoHook class.
Also implemented minor formatting fixes, as well as implementing Warning messages if the tool is given an unsupported SCM tool as a --repo-type option (currently Git is the only SCM supported
e1127d83acee2368c722df258c4b85171282fbe4
Went through all flake8 errors that occured throughout the first 3 posts to ReviewBoard
and fixed them
005d94249b6f98b485f506ac8e949d81d7a841dd
More flake8 issue fixing.
f0903e5262699bf86eb5f3becaf85bf4dd8495b3
Review Request #11492
Removed 'continue on next line' characters from unnecessary locations in repo-hook command. Corrected lines being too long in some files.
46d45e305a396de7e67664529e2fea9dfc4e6897
Altered how repo_hook command accesses SCMRepositoryHooks subclasses. Now, repo_hook will call on the correcponsing SCM client, of which each now has a repository_hooks_class class attribute. The repo_hook command can access the corresponsing SCMRepositoryHooks subclass depending on the --repo-type supplied in the command. Skeleton code for the SVNRepositoryHooks and MercurialRepositoryHooks classes have been created to make sure all functionality is working. Also changed the GitRepositoryHooks class to no longer need to be supplied a copy of the RepoHook class (incorrect idea about code layout. Review Request #11492.
545a2942acc05c5bed4d1d02f46d7bdc0d7109ac
Fixed all current flake8 errors via local version of flake8
873fa7a5ff642af1291ebe1c12131d76c092e64b
Minor changes, added sys.exit(1) for bad result in order for pre-receive hook to know what happened. Fixed some uncaught name spelling errors and other issues. Review Request #11492
b310e24a3c5cf7afb0a7f0c98cb97e83ff70b3dd
Reorganized how rbtools/command/repo-hook.py and rbtools/clients/scmrepositoryhooks.py and all it's subclasses functioned. Previously, RepoHook called the functionality it needed from methods in the SCMRepositoryHooks directly. Now, depending on the hook-type passed in (pre-receive, post-receive, etc), RepoHook will call the corresponding method in the SCMRepositoryHooks subclass (e.g. SCMRepositoryHooks.pre_receive()) in order to get the stuff it needs. This is done so that the method calls will be the same, regardless of what SCM the hook is being used for.
Changed all instances of post_commit() to post_receive() in SCMRepositoryHooks class and it's subclasses. This was a typo, as post-commit hooks is not something currently planned to the repo-hook command. Other minor refactoring of the RepoHook class, such as moving bulky if/else statements for determining the SCMRepositoryHook subclass to be grabbed into a method of its own to clean up main(). As well, moved some code that would not neccesarily be used for hooks besides post-receive and pre-receive into their respective methods, instead of keeping them in main(). Also finished testing the pre-receive hook, before and after the refactoring. Review Request #11492
72eb9f5082f65cc8fba59cc346ed121964558f74
Minor tweaks to some method calls for the post-receive hook side of repo-hook. Errors found with passing too many arguments or passing arguments the incorrect way.
03a5a7ea1187a0ffbbae88489714fbf2f5305e15
Added tests for RepoHook command, including checking proper fetching of GitRepositoryHooks class, exit from system in case of calling 'svn', 'mercurial' or an invalid repo type for repo-type, saving of server options, properly setting regex flags, and testing for exiting when given invalid hook-type.
Removed all references to pre-commit hooks withing the RepoHook command, as this is not a currently planned functionality. Will be removing pre-commit references from everywhere else in the next commit Review Request #11492
48e9df0bdda435f1312dbdfcc97092cecf1f638d
Added tests for valid --hook-types, the default hook_type, default repo_type, the default values for server options, and the default and activated states of calling --require-approval, --dont-require-review-requests, and --allow-unapproved-push.
Removed all (empty) methods for pre-receive in the SCMRepositoryHooks class and it's subclasses. Review Request #11492
19b303bb3ef1f48136ed87fcdedf812a6ebaa27f

Diff:

Revision 8 (+2397 -753)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

TheArcticGiraffe
Review request changed

Summary:

-Implementing a repo-hook command to standardize how hooks for RBTools are used
+Implementing 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
Adding in-progress files.
Created repo-hook.py, which implements the most basic of functionality of a command, on which to build. 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.
71f6f67374c30350d242432a46116d48618162e8
Added new options to repo-hook command based on the functionality in contrib\tools\git-hook-set-submitted and contrib\tools\git-hook-check-approval. Followed same default values as found in these two hook scripts.
9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb
Fixed a few flake8 failure, and added in standard regex flag from contrib\tools\git-hook-set-submitted\n and contrib\tools\git-hook-check-approval as an option in the repo-hook command
ba3b42ca15f118cc032b924a791cb9683df93414
Brought functionality from git.py over to the GitRepositoryHooks class. This may change, but this is a starting point
f72a4ad674c91133e896a9b70e4b70b2e183f04c
Changed the wording and working of a few commands, so that the default is standard and it lexically makes sense for the user to add the option as a way to enable the function (e.g. --require-review-requests changed to dont-require-review-requests, and changed the default from True to False). As well, a few minor tab and line length errors were corrected
43358669072fd7988138c5f471f56eb6198324d3
This commit was an error fixing commit. Fixed some missed commas in the Options section, fixed a mispelling of store_true, fixed an error of using ! instead of not.
52269579029e65a75628683428951bff3fe37f18
Added option for specifying the type of repository repository being used (--repo-type).
Changed --type to be --hook-type to reduce confusion with --repo-type Moved execute() and get_review_request_id() from repo_hook.py to scmrepositoryhooks.py, as they were not used in repo_hook.py, and only needed in SCMRepositoryHooks and its subclasses. Other minor fixes, such as rearranging the imports and putting missing imports that were not brought over.
63f7658e2b9031c546a4b520fc64da6a2c703e72
Minor change, adding self variable to a class method inside SECRepositoryHooks class
Functionality brought from rbtools/hooks/common.py to rbtools/commands/repo_hook.py used to be outside the RepoHook class. These methods were brought into the RepoHook class to keep things clean.
55e914ec883c1fe8ae64d6737993396b298dad8c
Added the common lines between /contrib/tools/git-hook-set-submitted and /contrib/tools/git-hook-check-approval to rbtools/commands/repo_hook.py in the RepoHook Command subclass as the default behaviour before hook-type specific behaviour is taken
85cb9226317a9d8d009789e76f0ebe8bded52396
Removed unnecessary debug code from RepoHook class and its helper classes, and cleaned up the code a little.
f12f498b5ff2e8b59f2830060213d51d2bdac974
Brought logic for the pre-receive and post-receive functionality from /contrib/tools/git-hook-check-approval and /contrib/tools/git-hook-set-submitted into the pre_receive() and post_receive() methods of the RepoHook class.
Also implemented minor formatting fixes, as well as implementing Warning messages if the tool is given an unsupported SCM tool as a --repo-type option (currently Git is the only SCM supported
e1127d83acee2368c722df258c4b85171282fbe4
Went through all flake8 errors that occured throughout the first 3 posts to ReviewBoard
and fixed them
005d94249b6f98b485f506ac8e949d81d7a841dd
More flake8 issue fixing.
f0903e5262699bf86eb5f3becaf85bf4dd8495b3
Review Request #11492
Removed 'continue on next line' characters from unnecessary locations in repo-hook command. Corrected lines being too long in some files.
46d45e305a396de7e67664529e2fea9dfc4e6897
Altered how repo_hook command accesses SCMRepositoryHooks subclasses. Now, repo_hook will call on the correcponsing SCM client, of which each now has a repository_hooks_class class attribute. The repo_hook command can access the corresponsing SCMRepositoryHooks subclass depending on the --repo-type supplied in the command. Skeleton code for the SVNRepositoryHooks and MercurialRepositoryHooks classes have been created to make sure all functionality is working. Also changed the GitRepositoryHooks class to no longer need to be supplied a copy of the RepoHook class (incorrect idea about code layout. Review Request #11492.
545a2942acc05c5bed4d1d02f46d7bdc0d7109ac
Fixed all current flake8 errors via local version of flake8
873fa7a5ff642af1291ebe1c12131d76c092e64b
Minor changes, added sys.exit(1) for bad result in order for pre-receive hook to know what happened. Fixed some uncaught name spelling errors and other issues. Review Request #11492
b310e24a3c5cf7afb0a7f0c98cb97e83ff70b3dd
Reorganized how rbtools/command/repo-hook.py and rbtools/clients/scmrepositoryhooks.py and all it's subclasses functioned. Previously, RepoHook called the functionality it needed from methods in the SCMRepositoryHooks directly. Now, depending on the hook-type passed in (pre-receive, post-receive, etc), RepoHook will call the corresponding method in the SCMRepositoryHooks subclass (e.g. SCMRepositoryHooks.pre_receive()) in order to get the stuff it needs. This is done so that the method calls will be the same, regardless of what SCM the hook is being used for.
Changed all instances of post_commit() to post_receive() in SCMRepositoryHooks class and it's subclasses. This was a typo, as post-commit hooks is not something currently planned to the repo-hook command. Other minor refactoring of the RepoHook class, such as moving bulky if/else statements for determining the SCMRepositoryHook subclass to be grabbed into a method of its own to clean up main(). As well, moved some code that would not neccesarily be used for hooks besides post-receive and pre-receive into their respective methods, instead of keeping them in main(). Also finished testing the pre-receive hook, before and after the refactoring. Review Request #11492
72eb9f5082f65cc8fba59cc346ed121964558f74
Minor tweaks to some method calls for the post-receive hook side of repo-hook. Errors found with passing too many arguments or passing arguments the incorrect way.
03a5a7ea1187a0ffbbae88489714fbf2f5305e15
Added tests for RepoHook command, including checking proper fetching of GitRepositoryHooks class, exit from system in case of calling 'svn', 'mercurial' or an invalid repo type for repo-type, saving of server options, properly setting regex flags, and testing for exiting when given invalid hook-type.
Removed all references to pre-commit hooks withing the RepoHook command, as this is not a currently planned functionality. Will be removing pre-commit references from everywhere else in the next commit Review Request #11492
48e9df0bdda435f1312dbdfcc97092cecf1f638d
Added tests for valid --hook-types, the default hook_type, default repo_type, the default values for server options, and the default and activated states of calling --require-approval, --dont-require-review-requests, and --allow-unapproved-push.
Removed all (empty) methods for pre-receive in the SCMRepositoryHooks class and it's subclasses. Review Request #11492
19b303bb3ef1f48136ed87fcdedf812a6ebaa27f
Adding in-progress files.
Created repo-hook.py, which implements the most basic of functionality of a command, on which to build. 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.
71f6f67374c30350d242432a46116d48618162e8
Added new options to repo-hook command based on the functionality in contrib\tools\git-hook-set-submitted and contrib\tools\git-hook-check-approval. Followed same default values as found in these two hook scripts.
9aea6c7c2b2c98ffa96bf0d67e8ab75ae06706fb
Fixed a few flake8 failure, and added in standard regex flag from contrib\tools\git-hook-set-submitted\n and contrib\tools\git-hook-check-approval as an option in the repo-hook command
ba3b42ca15f118cc032b924a791cb9683df93414
Brought functionality from git.py over to the GitRepositoryHooks class. This may change, but this is a starting point
f72a4ad674c91133e896a9b70e4b70b2e183f04c
Changed the wording and working of a few commands, so that the default is standard and it lexically makes sense for the user to add the option as a way to enable the function (e.g. --require-review-requests changed to dont-require-review-requests, and changed the default from True to False). As well, a few minor tab and line length errors were corrected
43358669072fd7988138c5f471f56eb6198324d3
This commit was an error fixing commit. Fixed some missed commas in the Options section, fixed a mispelling of store_true, fixed an error of using ! instead of not.
52269579029e65a75628683428951bff3fe37f18
Added option for specifying the type of repository repository being used (--repo-type).
Changed --type to be --hook-type to reduce confusion with --repo-type Moved execute() and get_review_request_id() from repo_hook.py to scmrepositoryhooks.py, as they were not used in repo_hook.py, and only needed in SCMRepositoryHooks and its subclasses. Other minor fixes, such as rearranging the imports and putting missing imports that were not brought over.
63f7658e2b9031c546a4b520fc64da6a2c703e72
Minor change, adding self variable to a class method inside SECRepositoryHooks class
Functionality brought from rbtools/hooks/common.py to rbtools/commands/repo_hook.py used to be outside the RepoHook class. These methods were brought into the RepoHook class to keep things clean.
55e914ec883c1fe8ae64d6737993396b298dad8c
Added the common lines between /contrib/tools/git-hook-set-submitted and /contrib/tools/git-hook-check-approval to rbtools/commands/repo_hook.py in the RepoHook Command subclass as the default behaviour before hook-type specific behaviour is taken
85cb9226317a9d8d009789e76f0ebe8bded52396
Removed unnecessary debug code from RepoHook class and its helper classes, and cleaned up the code a little.
f12f498b5ff2e8b59f2830060213d51d2bdac974
Brought logic for the pre-receive and post-receive functionality from /contrib/tools/git-hook-check-approval and /contrib/tools/git-hook-set-submitted into the pre_receive() and post_receive() methods of the RepoHook class.
Also implemented minor formatting fixes, as well as implementing Warning messages if the tool is given an unsupported SCM tool as a --repo-type option (currently Git is the only SCM supported
e1127d83acee2368c722df258c4b85171282fbe4
Went through all flake8 errors that occured throughout the first 3 posts to ReviewBoard
and fixed them
005d94249b6f98b485f506ac8e949d81d7a841dd
More flake8 issue fixing.
f0903e5262699bf86eb5f3becaf85bf4dd8495b3
Review Request #11492
Removed 'continue on next line' characters from unnecessary locations in repo-hook command. Corrected lines being too long in some files.
46d45e305a396de7e67664529e2fea9dfc4e6897
Altered how repo_hook command accesses SCMRepositoryHooks subclasses. Now, repo_hook will call on the correcponsing SCM client, of which each now has a repository_hooks_class class attribute. The repo_hook command can access the corresponsing SCMRepositoryHooks subclass depending on the --repo-type supplied in the command. Skeleton code for the SVNRepositoryHooks and MercurialRepositoryHooks classes have been created to make sure all functionality is working. Also changed the GitRepositoryHooks class to no longer need to be supplied a copy of the RepoHook class (incorrect idea about code layout. Review Request #11492.
545a2942acc05c5bed4d1d02f46d7bdc0d7109ac
Fixed all current flake8 errors via local version of flake8
873fa7a5ff642af1291ebe1c12131d76c092e64b
Minor changes, added sys.exit(1) for bad result in order for pre-receive hook to know what happened. Fixed some uncaught name spelling errors and other issues. Review Request #11492
b310e24a3c5cf7afb0a7f0c98cb97e83ff70b3dd
Reorganized how rbtools/command/repo-hook.py and rbtools/clients/scmrepositoryhooks.py and all it's subclasses functioned. Previously, RepoHook called the functionality it needed from methods in the SCMRepositoryHooks directly. Now, depending on the hook-type passed in (pre-receive, post-receive, etc), RepoHook will call the corresponding method in the SCMRepositoryHooks subclass (e.g. SCMRepositoryHooks.pre_receive()) in order to get the stuff it needs. This is done so that the method calls will be the same, regardless of what SCM the hook is being used for.
Changed all instances of post_commit() to post_receive() in SCMRepositoryHooks class and it's subclasses. This was a typo, as post-commit hooks is not something currently planned to the repo-hook command. Other minor refactoring of the RepoHook class, such as moving bulky if/else statements for determining the SCMRepositoryHook subclass to be grabbed into a method of its own to clean up main(). As well, moved some code that would not neccesarily be used for hooks besides post-receive and pre-receive into their respective methods, instead of keeping them in main(). Also finished testing the pre-receive hook, before and after the refactoring. Review Request #11492
72eb9f5082f65cc8fba59cc346ed121964558f74
Minor tweaks to some method calls for the post-receive hook side of repo-hook. Errors found with passing too many arguments or passing arguments the incorrect way.
03a5a7ea1187a0ffbbae88489714fbf2f5305e15
Added tests for RepoHook command, including checking proper fetching of GitRepositoryHooks class, exit from system in case of calling 'svn', 'mercurial' or an invalid repo type for repo-type, saving of server options, properly setting regex flags, and testing for exiting when given invalid hook-type.
Removed all references to pre-commit hooks withing the RepoHook command, as this is not a currently planned functionality. Will be removing pre-commit references from everywhere else in the next commit Review Request #11492
48e9df0bdda435f1312dbdfcc97092cecf1f638d
Added tests for valid --hook-types, the default hook_type, default repo_type, the default values for server options, and the default and activated states of calling --require-approval, --dont-require-review-requests, and --allow-unapproved-push.
Removed all (empty) methods for pre-receive in the SCMRepositoryHooks class and it's subclasses. Review Request #11492
19b303bb3ef1f48136ed87fcdedf812a6ebaa27f
Added documentation where needed, and fixed bad/non-compliant documentation
Changed all instances of sys.exit(x) to instead by raisings of HookError, and changed testing to correspond to this change Changed REGEX_FLAGS to be regex_flags in rbtools/commands/repo_hook.py, as it is not a constant Removed all debugging print() statements from rbtools/commands/repo_hook.py. Review request#11492
761842443c320f0f4decd5be3cb71253fe797c2b
Fixed a minor flake8 error in rbtools/clients/scmrepositoryhooks.py. Review request #11492
b6b0454774fc12048c77f9efaf16ab7371653e12

Diff:

Revision 9 (+2660 -866)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

Loading...