on xenial help sign in
improve the bzr commit hook
4e98193Michael Zanetti
.bazaar/plugins/makecheck_unity_phablet.py+14−5
@@ -24,11 +24,20 @@ def execute_makecheck(local_branch, master_branch, old_revision_number, old_revi
24 os.chdir(local_path_from_url(master_branch.base))
24 os.chdir(local_path_from_url(master_branch.base))
25
25
26 print "Executing 'make check'.."
26 print "Executing 'make check'.."
27+ os.environ['CTEST_OUTPUT_ON_FAILURE'] = "1"
27− if (subprocess.call("make check", shell=True) != 0):
28+ if (subprocess.call("make -C builddir test", shell=True) != 0):
28− raise errors.BzrError("Unit tests failed, fix them before committing!")
29
29
30− print "Executing 'make qmluitests'.."
30+ print("\n\n*** Warning ***\n\nBasic tests failed. This commit will not pass continuous integration.")
31− if (subprocess.call("make qmluitests", shell=True) != 0):
31+
32− raise errors.BzrError("QML UI tests failed, fix them before committing!")
32+ branch = local_branch or master_branch
33+ revision = branch.repository.get_revision(future_revision_id)
34+ msg_file = open('message.txt', 'w')
35+ msg_file.write(revision.message)
36+ msg_file.close()
37+
38+ print("\n\nSaved commit message to $SRC_DIR/message.txt.")
39+ print("You can uncommit this revision, fix the tests and reuse your message running:\n\nbzr commit -F message.txt\n\n")
40+ elif os.path.isfile("message.txt"):
41+ os.remove("message.txt")
33
42
34branch.Branch.hooks.install_named_hook('pre_commit', execute_makecheck, 'make check pre-commit')
43branch.Branch.hooks.install_named_hook('pre_commit', execute_makecheck, 'make check pre-commit')
.bzrignore+1
@@ -7,3 +7,4 @@
7/.cproject
7/.cproject
8/.settings
8/.settings
9/.pydevproject
9/.pydevproject
10+message.txt