You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bb...@apache.org on 2017/09/18 08:32:55 UTC

mesos git commit: Added a `[-s|--skip-hooks]` option when applying reviews.

Repository: mesos
Updated Branches:
  refs/heads/master 95406868a -> bcb88aba5


Added a `[-s|--skip-hooks]` option when applying reviews.

Review: https://reviews.apache.org/r/61588/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/bcb88aba
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/bcb88aba
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/bcb88aba

Branch: refs/heads/master
Commit: bcb88aba56637d8befd4747a12b95475a8b7099d
Parents: 9540686
Author: Chun-Hung Hsiao <ch...@mesosphere.io>
Authored: Mon Sep 18 10:31:17 2017 +0200
Committer: Benjamin Bannier <bb...@apache.org>
Committed: Mon Sep 18 10:31:17 2017 +0200

----------------------------------------------------------------------
 support/apply-reviews.py | 29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/bcb88aba/support/apply-reviews.py
----------------------------------------------------------------------
diff --git a/support/apply-reviews.py b/support/apply-reviews.py
index aa2eb8d..23f2047 100755
--- a/support/apply-reviews.py
+++ b/support/apply-reviews.py
@@ -206,9 +206,9 @@ def fetch_patch(options):
                 review_id=patch_id(options),
                 url=patch_url(options))
 
-        # In case of github we always need to fetch the patch to extract username
-        # and email, so we ignore the dry_run option by setting the second parameter
-        # to False.
+        # In case of GitHub we always need to fetch the patch to extract
+        # username and email, so we ignore the dry_run option by setting the
+        # second parameter to False.
         if options['github']:
             shell(cmd, False)
         else:
@@ -252,6 +252,12 @@ def commit_patch(options):
     else:
         amend = '-e'
 
+    # Check whether we should skip the commit hooks.
+    if options['skip_hooks']:
+        verify = '-n'
+    else:
+        verify = ''
+
     # NOTE: Windows does not support multi-line commit messages via the shell.
     message_file = '%s.message' % patch_id(options)
     atexit.register(
@@ -260,10 +266,14 @@ def commit_patch(options):
     with open(message_file, 'w') as message:
         message.write(data['message'])
 
-    cmd = u'git commit --author \"{author}\" {_amend} -aF \"{message}\"'.format(
-        author=quote(data['author']),
-        _amend=amend,
-        message=message_file)
+    cmd = u'git commit' \
+          u' --author \"{author}\"' \
+          u' {amend} -aF \"{message}\"' \
+          u' {verify}'.format(
+              author=quote(data['author']),
+              amend=amend,
+              message=message_file,
+              verify=verify)
 
     shell(cmd, options['dry_run'])
 
@@ -361,7 +371,9 @@ def parse_options():
     parser.add_argument('-c', '--chain',
                         action='store_true',
                         help='Recursively apply parent review chain.')
-
+    parser.add_argument('-s', '--skip-hooks',
+                        action='store_true',
+                        help='Skip the commit hooks (e.g., Mesos style check).')
     parser.add_argument('-3', '--3way',
                         dest='three_way',
                         action='store_true',
@@ -383,6 +395,7 @@ def parse_options():
     options['no_amend'] = args.no_amend
     options['github'] = args.github
     options['chain'] = args.chain
+    options['skip_hooks'] = args.skip_hooks
     options['3way'] = args.three_way
 
     return options