33
44# CIQ Kernel Tools function library
55
6- import git
76import os
87import re
98import subprocess
109
10+ import git
11+
1112
1213def process_full_commit_message (commit ):
1314 """Process the full git commit message specific to the CIQ Kernel Tools.
@@ -84,9 +85,7 @@ def get_backport_commit_data(repo, branch, common_ancestor, allow_duplicates=Fal
8485
8586 for line in lines :
8687 if len (commit ) > 0 and line .startswith (b"commit " ):
87- upstream_commit , cves , tickets , upstream_subject , repo_commit = (
88- process_full_commit_message (commit )
89- )
88+ upstream_commit , cves , tickets , upstream_subject , repo_commit = process_full_commit_message (commit )
9089 if upstream_commit in upstream_commits :
9190 print (f"WARNING: { upstream_commit } already in upstream_commits" )
9291 if not allow_duplicates :
@@ -104,9 +103,7 @@ def get_backport_commit_data(repo, branch, common_ancestor, allow_duplicates=Fal
104103 return upstream_commits , True
105104
106105
107- def CIQ_cherry_pick_commit_standardization (
108- lines , commit , tags = None , jira = "" , optional_msg = ""
109- ):
106+ def CIQ_cherry_pick_commit_standardization (lines , commit , tags = None , jira = "" , optional_msg = "" ):
110107 """Standardize CIQ the cherry-pick commit message.
111108 Parameters:
112109 lines: Original SHAS commit message.
@@ -159,13 +156,17 @@ def CIQ_original_commit_author_to_tag_string(repo_path, sha):
159156
160157 Return: String for Tag
161158 """
162- git_auth_res = subprocess .run (['git' , 'show' , '--pretty="%aN <%aE>"' , '--no-patch' , sha ], stderr = subprocess .PIPE ,
163- stdout = subprocess .PIPE , cwd = repo_path )
159+ git_auth_res = subprocess .run (
160+ ["git" , "show" , '--pretty="%aN <%aE>"' , "--no-patch" , sha ],
161+ stderr = subprocess .PIPE ,
162+ stdout = subprocess .PIPE ,
163+ cwd = repo_path ,
164+ )
164165 if git_auth_res .returncode != 0 :
165166 print (f"[FAILED] git show --pretty='%aN <%aE>' --no-patch { sha } " )
166167 print (f"[FAILED][STDERR:{ git_auth_res .returncode } ] { git_auth_res .stderr .decode ('utf-8' )} " )
167168 return None
168- return "commit-author " + git_auth_res .stdout .decode (' utf-8' ).replace ('\ " ' , '' ).strip ()
169+ return "commit-author " + git_auth_res .stdout .decode (" utf-8" ).replace ('"' , "" ).strip ()
169170
170171
171172def repo_init (repo ):
0 commit comments