diff options
Diffstat (limited to 'apex/build_utils.py')
-rw-r--r-- | apex/build_utils.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/apex/build_utils.py b/apex/build_utils.py index 213ae115..7457e561 100644 --- a/apex/build_utils.py +++ b/apex/build_utils.py @@ -86,7 +86,7 @@ def clone_fork(args): logging.info('Checked out commit:\n{}'.format(ws.head.commit.message)) -def strip_patch_sections(patch, sections=['releasenotes']): +def strip_patch_sections(patch, sections=['releasenotes', 'tests']): """ Removes patch sections from a diff which contain a file path :param patch: patch to strip @@ -111,6 +111,19 @@ def strip_patch_sections(patch, sections=['releasenotes']): return '\n'.join(tmp_patch) +def is_path_in_patch(patch, path): + """ + Checks if a particular path is modified in a patch diff + :param patch: patch diff + :param path: path to check for in diff + :return: Boolean + """ + for line in patch.split("\n"): + if re.match('^diff.*{}'.format(path), line): + return True + return False + + def get_patch(change_id, repo, branch, url=con.OPENSTACK_GERRIT): logging.info("Fetching patch for change id {}".format(change_id)) change = get_change(url, repo, branch, change_id) |