3824: Git hooks not working
- Fixed
- Review Board
kevin.bern**********@gmai***** (Google Code) (Is this you? Claim this profile.) | |
April 26, 2015 |
When using the git hooks provided in RBTools/contrib/tools, I've got a Python TypeError. This bug affect RBTools v0.7.2 The version 0.6 works fine. Example of a "git push" with the two server-side hooks: $> git push Counting objects: 9, done. Delta compression using up to 4 threads. Compressing objects: 100% (5/5), done. Writing objects: 100% (6/6), 572 bytes | 0 bytes/s, done. Total 6 (delta 3), reused 0 (delta 0) remote: ['92838c18206430eadad27792c744458e1391b8e2 d0f234ec84f84973b1e3d2992d67af45f8f373ca refs/heads/master\n'] remote: Traceback (most recent call last): remote: File "hooks/pre-receive", line 80, in <module> remote: main() remote: File "hooks/pre-receive", line 49, in main remote: review_id_to_commits = get_review_id_to_commits_map(lines, compiled_regex) remote: File "/usr/local/lib/python2.7/dist-packages/RBTools-0.7.2-py2.7.egg/rbtools/hooks/git.py", line 78, in get_review_id_to_commits_map remote: commit_hashes = get_commit_hashes(old_rev, new_rev) remote: File "/usr/local/lib/python2.7/dist-packages/RBTools-0.7.2-py2.7.egg/rbtools/hooks/git.py", line 20, in get_commit_hashes remote: return execute(git_command, split_lines=True) remote: TypeError: execute() got an unexpected keyword argument 'split_lines' To ssh://git@192.168.1.105/my_repo ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'ssh://git@192.168.1.105/my_repo'
Looks like there's a second execute() function that shouldn't be there, which doesn't accept the split_lines argument. Should be an easy fix.
-
+ Confirmed -
+ Project-RBTools + EasyFix + Milestone-RBTools-Release0.7.x + Component-RBTools
I got this one
I am facing the same issue RBT version is as below $ rbt --version RBTools 0.7.2 (RBTools-0.7.2-1.el6.noarch) Upgraded rbtools as well but no luck .. $ git push Counting objects: 5, done. Delta compression using up to 4 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 278 bytes | 0 bytes/s, done. Total 3 (delta 1), reused 0 (delta 0) remote: Test bug remote: 20150521-084733.txt remote: Traceback (most recent call last): remote: File "/var/lib/gitolite/.gitolite/hooks/common/git-hook-check-approval.py", line 80, in <module> remote: main() remote: File "/var/lib/gitolite/.gitolite/hooks/common/git-hook-check-approval .py", line 52, in main remote: review_id_to_commits = get_review_id_to_commits_map(lines, compiled_regex) remote: File "/usr/lib/python2.6/site-packages/rbtools/hooks/git.py", line 78, in get_review_id_to_commits_map remote: commit_hashes = get_commit_hashes(old_rev, new_rev) remote: File "/usr/lib/python2.6/site-packages/rbtools/hooks/git.py", line 20, in get_commit_hashes remote: return execute(git_command, split_lines=True) remote: TypeError: execute() got an unexpected keyword argument 'split_lines' To ssh://gitolite@myserver/test123.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'ssh://gitolite@myserver/test123.git'
Thanks, I have updated to 0.7.3 but now I get "review_request_id" as "0" all the time by default. Its not reading the commit message as defined in the function "get_review_request_id". Also it sounds to me inappropriate to get the review request id from "commit message" how a user will know the id before doing "rbt post" as there will be many other user's in parallel who will be doing commit and push. Please correct me if I am wrong. I do not understand this hook behavior. Is there anything else I need to do before copying this (pre-receive -> git-hook-check-approval)hook or there is still some bug in it?
the git-hook-check-approval hook verifies that there's an existing review request for the pushed change, which is listed in the commit message, and that said review request is "approved" as per the built-in (or extensible) approval rules. It's intended to be used in a pre-commit review model where changes are reviewed before they're pushed. If you're expecting the hook to create review requests for you, that's not the right hook.
Review request exist (used "rbt post" command to create it) and already created but not sure why it is still taking the "review_request_id" as "0"
I am using the same model as described here https://www.reviewboard.org/docs/manual/2.5/users/getting-started/workflow/ .. Is there anything I am missing here? What needs to be done in order to make this hook work for me?
Yes I did here is the git log output $ git log -2 commit a47d5832b1da763e9c9940a678eecd0357c767c2 Author: Pratap <kdarious@gmail.com> Date: Wed Jun 3 09:52:16 2015 +0530 foo12 Reviewed at http://myserver/r/59/ commit 5a6d6a1b7650fc47cac98372dc0b9818438be03a Author: Pratap <kdarious@gmail.com> Date: Wed Jun 3 09:49:10 2015 +0530 foo11 with stamp Reviewed at http://myserver/r/58/ I did put some print statement in hook and getting this remote: review_id_to_commits ----> defaultdict(<type 'list'>, {0: ['master (a47d 583)']}) <---- remote: print review_request_id 0 remote: I am in ELIF Loop Exiting!! We failed again
I found the problem it was with the git log --pretty=format in function get_commit_message. Where git_command was using --pretty=format:%B which I have changed to --pretty=format:%b and hook is working fine for me .