Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(542)

Side by Side Diff: git_cl/test/hooks.sh

Issue 6665018: Remove support for generic "hook files" in git-cl, require depot_tools (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: put dcommit hook back in Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« git_cl/git_cl.py ('K') | « git_cl/git_cl.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 2
3 # Tests the "preupload and predcommit hooks" functionality, which lets you run 3 # Tests the "preupload and predcommit hooks" functionality, which lets you run
4 # hooks by installing a script into .git/hooks/pre-cl-* first. 4 # hooks by installing a script into .git/hooks/pre-cl-* first.
5 5
6 set -e 6 set -e
7 7
8 . ./test-lib.sh 8 . ./test-lib.sh
9 9
10 setup_initsvn 10 setup_initsvn
11 setup_gitsvn 11 setup_gitsvn
12 12
13 setup_hooks() {
14 upload_retval = shift
15 dcommit_retval = shift
16
17 echo > PRESUBMIT.py <<END
18 def CheckChangeOnUpload(input_api, output_api):
19 return $upload_retval
20
21 def CheckChangeOnCommit(input_api, output_api):
22 return $dcommit_retval
23 END
24 }
25
13 ( 26 (
14 set -e 27 set -e
15 cd git-svn 28 cd git-svn
16 29
17 # We need a server set up, but we don't use it. 30 # We need a server set up, but we don't use it. git config rietveld.server lo calhost:1
18 git config rietveld.server localhost:1
19 31
20 # Install a pre-cl-upload hook. 32 # Install hooks that will fail on upload and commit
21 echo "#!/bin/bash" > .git/hooks/pre-cl-upload 33 setup_hooks 1 1
22 echo "echo 'sample preupload fail'" >> .git/hooks/pre-cl-upload
23 echo "exit 1" >> .git/hooks/pre-cl-upload
24 chmod 755 .git/hooks/pre-cl-upload
25
26 # Install a pre-cl-dcommit hook.
27 echo "#!/bin/bash" > .git/hooks/pre-cl-dcommit
28 echo "echo 'sample predcommit fail'" >> .git/hooks/pre-cl-dcommit
29 echo "exit 1" >> .git/hooks/pre-cl-dcommit
30 chmod 755 .git/hooks/pre-cl-dcommit
31 34
32 echo "some work done" >> test 35 echo "some work done" >> test
33 git add test; git commit -q -m "work" 36 git add test; git commit -q -m "work"
34 37
35 # Verify git cl upload fails. 38 # Verify git cl upload fails.
36 test_expect_failure "git-cl upload hook fails" "$GIT_CL upload master" 39 test_expect_failure "git-cl upload hook fails" "$GIT_CL upload master"
37 40
38 # Verify git cl upload fails. 41 # Verify git cl dcommit fails.
39 test_expect_failure "git-cl dcommit hook fails" "$GIT_CL dcommit master" 42 test_expect_failure "git-cl dcommit hook fails" "$GIT_CL dcommit master"
40 ) 43 )
41 SUCCESS=$? 44 SUCCESS=$?
42 45
43 #cleanup 46 #cleanup
44 47
45 if [ $SUCCESS == 0 ]; then 48 if [ $SUCCESS == 0 ]; then
46 echo PASS 49 echo PASS
47 fi 50 fi
OLDNEW
« git_cl/git_cl.py ('K') | « git_cl/git_cl.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698