@@ -24,7 +24,7 @@ def process_git_request(fname, target_branch, source_branch, prj_dir):
24
24
os .chdir (working_dir )
25
25
# print(f"pwd : {os.getcwd()}")
26
26
git_cmd = f"git log --oneline --no-abbrev-commit origin/{ target_branch } ..origin/{ source_branch } "
27
- # print(git_cmd)
27
+ print (f"git command is { git_cmd } " )
28
28
loglines_to_check = 13
29
29
try :
30
30
out , err = subprocess .Popen (git_cmd , shell = True , stdout = subprocess .PIPE ,
@@ -46,7 +46,7 @@ def process_git_request(fname, target_branch, source_branch, prj_dir):
46
46
y = x .split ()
47
47
print (f"This is y { y } " )
48
48
commit_sha = str (y [0 ])
49
- print ("Found a commit in line " , commit_sha )
49
+ print (f "Found a commit in line " , commit_sha )
50
50
51
51
git_cmd = "git show " + commit_sha
52
52
gitlog_out , gitlog_err = subprocess .Popen (git_cmd , shell = True , stdout = subprocess .PIPE , stderr = subprocess .PIPE , universal_newlines = True ).communicate ()
@@ -58,7 +58,7 @@ def process_git_request(fname, target_branch, source_branch, prj_dir):
58
58
upstream_diff = False
59
59
60
60
for logline in loglines :
61
- print (f"Processing logline { commit_sh } " )
61
+ print (f"Processing logline { commit_sha } " )
62
62
lines_counted += 1
63
63
if lines_counted == 1 :
64
64
file .write ("Merge Request sha: " + local_diffdiff_sha )
@@ -81,7 +81,7 @@ def process_git_request(fname, target_branch, source_branch, prj_dir):
81
81
if "commit" in logline .lower ():
82
82
commit_sha = re .search (r'[0-9a-f]{40}' , logline )
83
83
upstream_diffdiff_sha = str (commit_sha .group (0 )) if commit_sha else ""
84
- print ("Upstream : " + upstream_diffdiff_sha )
84
+ print (f "Upstream : " + upstream_diffdiff_sha )
85
85
if upstream_diffdiff_sha :
86
86
file .write ("\t Upstream sha: " + upstream_diffdiff_sha )
87
87
file .write ("\n " )
@@ -99,10 +99,12 @@ def process_git_request(fname, target_branch, source_branch, prj_dir):
99
99
diff_status = process .returncode
100
100
101
101
if diff_status != 0 and not upstream_diff :
102
- print ("diffdiff out: " + diff_out )
103
- print ("diffdiff err: " + diff_err )
102
+ print (f "diffdiff out: " + diff_out )
103
+ print (f "diffdiff err: " + diff_err )
104
104
retcode = 1
105
105
file .write ("error:\n Commit: " + local_diffdiff_sha + " differs with no upstream tag in commit message\n " )
106
+ except Exception as error :
107
+ print (f"Exception in git log command error { error } " )
106
108
107
109
finally :
108
110
file .close ()
0 commit comments