mirror of https://github.com/ARMmbed/mbed-os.git
Use regex to find cherry-pick message
parent
3273edba8d
commit
09af58fad5
|
@ -22,6 +22,7 @@ import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
import logging
|
import logging
|
||||||
import argparse
|
import argparse
|
||||||
|
import re
|
||||||
from os.path import dirname, abspath, join, isfile, normpath
|
from os.path import dirname, abspath, join, isfile, normpath
|
||||||
|
|
||||||
# Be sure that the tools directory is in the search path
|
# Be sure that the tools directory is in the search path
|
||||||
|
@ -30,6 +31,9 @@ sys.path.insert(0, ROOT)
|
||||||
|
|
||||||
from tools.utils import delete_dir_files, mkdir, copy_file
|
from tools.utils import delete_dir_files, mkdir, copy_file
|
||||||
|
|
||||||
|
cherry_pick_re = re.compile(
|
||||||
|
'\s*\(cherry picked from commit (([0-9]|[a-f]|[A-F])+)\)')
|
||||||
|
|
||||||
|
|
||||||
def del_file(name):
|
def del_file(name):
|
||||||
""" Delete the file in RTOS/CMSIS/features directory of mbed-os
|
""" Delete the file in RTOS/CMSIS/features directory of mbed-os
|
||||||
|
@ -150,11 +154,14 @@ def get_last_cherry_pick_sha(branch):
|
||||||
sha = None
|
sha = None
|
||||||
get_commit = ['git', 'log', '-n', '1']
|
get_commit = ['git', 'log', '-n', '1']
|
||||||
_, output = run_cmd_with_output(get_commit, exit_on_failure=True)
|
_, output = run_cmd_with_output(get_commit, exit_on_failure=True)
|
||||||
lines = output.split('\n')
|
|
||||||
|
lines = output.splitlines()
|
||||||
|
lines.reverse()
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if 'cherry picked from' in line:
|
match = cherry_pick_re.match(line)
|
||||||
sha = line.split(' ')[-1][:-1]
|
if match:
|
||||||
return sha
|
return match.group(1)
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def normalize_commit_sha(sha_lst):
|
def normalize_commit_sha(sha_lst):
|
||||||
|
|
Loading…
Reference in New Issue