This is an automated email from the ASF dual-hosted git repository.

wesm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 81bfb38  ARROW-2185: Strip CI directives from commit messages
81bfb38 is described below

commit 81bfb38e2fbe246347822c42197d76e655d6b0a0
Author: Wes McKinney <wes.mckin...@twosigma.com>
AuthorDate: Thu Feb 22 19:47:05 2018 -0500

    ARROW-2185: Strip CI directives from commit messages
    
    Author: Wes McKinney <wes.mckin...@twosigma.com>
    
    Closes #1639 from wesm/ARROW-2185 and squashes the following commits:
    
    adf038d5  Fix regex
    75c3b178  Do not eat closing braces
    baa7e2c6  Strip CI directives from commit messages when preparing squashed 
commit message
---
 dev/merge_arrow_pr.py | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/dev/merge_arrow_pr.py b/dev/merge_arrow_pr.py
index 6c0e663..74f0762 100755
--- a/dev/merge_arrow_pr.py
+++ b/dev/merge_arrow_pr.py
@@ -175,7 +175,8 @@ def merge_pr(pr_num, target_ref):
         "Closes #%s from %s and squashes the following commits:"
         % (pr_num, pr_repo_desc)]
     for c in commits:
-        merge_message_flags += ["-m", c]
+        stripped_message = strip_ci_directives(c).strip()
+        merge_message_flags += ["-m", stripped_message]
 
     run_cmd(['git', 'commit',
              '--no-verify',  # do not run commit hooks
@@ -199,6 +200,15 @@ def merge_pr(pr_num, target_ref):
     return merge_hash
 
 
+_REGEX_CI_DIRECTIVE = re.compile('\[[^\]]*\]')
+
+
+def strip_ci_directives(commit_message):
+    # Remove things like '[force ci]', '[skip appveyor]' from the assembled
+    # commit message
+    return _REGEX_CI_DIRECTIVE.sub('', commit_message)
+
+
 def fix_version_from_branch(branch, versions):
     # Note: Assumes this is a sorted (newest->oldest) list of un-released
     # versions
@@ -209,7 +219,7 @@ def fix_version_from_branch(branch, versions):
         return [x for x in versions if x.name.startswith(branch_ver)][-1]
 
 
-def exctract_jira_id(title):
+def extract_jira_id(title):
     m = re.search(r'^(ARROW-[0-9]+)\b.*$', title)
     if m:
         return m.group(1)
@@ -219,7 +229,7 @@ def exctract_jira_id(title):
 
 
 def check_jira(title):
-    jira_id = exctract_jira_id(title)
+    jira_id = extract_jira_id(title)
     asf_jira = jira.client.JIRA({'server': JIRA_API_BASE},
                                 basic_auth=(JIRA_USERNAME, JIRA_PASSWORD))
     try:
@@ -232,7 +242,7 @@ def resolve_jira(title, merge_branches, comment):
     asf_jira = jira.client.JIRA({'server': JIRA_API_BASE},
                                 basic_auth=(JIRA_USERNAME, JIRA_PASSWORD))
 
-    default_jira_id = exctract_jira_id(title)
+    default_jira_id = extract_jira_id(title)
 
     jira_id = input("Enter a JIRA id [%s]: " % default_jira_id)
     if jira_id == "":

-- 
To stop receiving notification emails like this one, please contact
w...@apache.org.

Reply via email to