Making it easy to write pre/post-commit hooks

Review Request #9236 - Created Sept. 29, 2017 and updated

Graham Sea
RBTools
master
ec73886...
rbtools, students

Applies the 0001-WIP-Repository-hooks-support.patch that Christian Hammond
created.

Adds the repo-hook command to make it easy to use pre and post commit hooks. The
supported repositories are Git, Mercurial and SVN.

Ran nosetests -v; all tests pass with patch applied.

Created unit tests for all functions.

Ran nosetests -v; all tests passed.

  • 0
  • 0
  • 25
  • 2
  • 27
Description From Last Updated
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

Graham Sea
Review request changed

Description:

~  

Applies the 0001-WIP-Repository-hooks-support.patch that Christian Hammond gave me as a skeleton to start with. No other changes have been made yet, as I'm still going through the code.

  ~

Applies the 0001-WIP-Repository-hooks-support.patch that Christian Hammond gave

  + me as a skeleton to start with. No other changes have been made yet, as I'm
  + still going through the code.

  +
  +

Oct 1 - 8

  + Fixed common.py to make the old hook method work so I could test it and learn
  + how it works. Found the common.py fix in https://reviews.reviewboard.org/r/9198/
  + Started working through repo_hook.py and learned that the code Christian Hammond
  + gave me comes with working git functionality.

Testing Done:

   

Ran nosetests -v; all tests pass with patch applied.

  +
  +

Oct 1 - 8

  + Manually tested the repo-hook command by making hooks for pre-receive and
  + post-receive in a local remote repository. I made changes and pushed the changes
  + to test the pre-receive hook, it denied the push as expected because the review
  + request was not marked "Ship It". Allowing the push to succeed caused the
  + post-receive code close the review-request.

Commit:

-39f4e50ab9c9271572eab66b55b0cd2f2add6415
+1ea1b5644830abc5a0f1a7caf72d5bf2e7c9333f

Diff:

Revision 2 (+409 -16)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

Graham Sea
Graham Sea
Graham Sea
Review request changed

Change Summary:

Started svn repository hooks unit tests and added basics to Mercurial.

Commit:

-d76a380ab6e7560b4b7e6bb042cbe6aebc307c01
+c97ca4a0b39aff638a2ad0ab3f56befd41c5d37d

Diff:

Revision 5 (+466 -17)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

Graham Sea
Review request changed

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

Graham Sea
Review request changed

Change Summary:

Working Mercurial pre-commit hooks. Fixed Flake8 errors.

Commit:

-ba97b9f4c0ba14ed0b9559eefdf10072c8a3c9ed
+1a4d2395433934d6f0ac781bc96a4e406c8c71a3

Diff:

Revision 7 (+519 -18)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

Graham Sea
Review request changed

Change Summary:

Added Mercurial tests, Changed SVN to make Post-commit work, still not working atm. Changed Repo_hook to use command arguments for input

Commit:

-1a4d2395433934d6f0ac781bc96a4e406c8c71a3
+769cf363965c7c286c9da5893d9b53bf807fa23b

Diff:

Revision 8 (+559 -19)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

Brian LeBlanc
  1. Just a note about the regex being used for parsing the mercurial logs.

  2. rbtools/clients/mercurial.py (Diff revision 8)
     
     

    Have you checked what happens when the commit message contains a colon+space separator (:)? The regex looks like it would end up splitting a commit message if it is there.

    I'm also guessing the regex would split multiline commit messages at the newline.

    1. Good call. It will mess up. Thanks, I'll change the way I do it.

  3. 
      
Graham Sea
Graham Sea
Graham Sea
Nicholas Mercier
  1. 
      
  2. rbtools/commands/__init__.py (Diff revision 11)
     
     

    run_from_argv now returns the exit code, as opposed to calling sys.exit(exit_code). I'd consider adding what it returns to the function's docstring.

  3. 
      
Graham Sea
Graham Sea
Review request changed

Change Summary:

Fixed spelling and added Git docstrings.

Commit:

-896d777e4482f97d8b17bf0d6ec4568f69dcdc69
+ec738867fe27c1d9a6c915954a5bc236190fb8ce

Diff:

Revision 13 (+816 -19)

Show changes

Checks run (2 succeeded)

flake8 passed.
JSHint passed.
Loading...