@@ -91,7 +91,7 @@ def main():
9191 no_sha1 = True
9292 prev_commit = ""
9393 initial_commit = current_commit
94- branch = subprocess .check_output ([GIT , 'show' , '-s' , '--format=%H' , initial_commit ], universal_newlines = True , encoding = 'utf8' ).splitlines ()[0 ]
94+ branch = subprocess .check_output ([GIT , 'show' , '-s' , '--format=%H' , initial_commit ]). decode ( 'utf8' ).splitlines ()[0 ]
9595
9696 # Iterate through commits
9797 while True :
@@ -112,7 +112,7 @@ def main():
112112 if prev_commit != "" :
113113 print ("No parent of {} was signed with a trusted key!" .format (prev_commit ), file = sys .stderr )
114114 print ("Parents are:" , file = sys .stderr )
115- parents = subprocess .check_output ([GIT , 'show' , '-s' , '--format=format:%P' , prev_commit ], universal_newlines = True , encoding = 'utf8' ).splitlines ()[0 ].split (' ' )
115+ parents = subprocess .check_output ([GIT , 'show' , '-s' , '--format=format:%P' , prev_commit ]). decode ( 'utf8' ).splitlines ()[0 ].split (' ' )
116116 for parent in parents :
117117 subprocess .call ([GIT , 'show' , '-s' , parent ], stdout = sys .stderr )
118118 else :
@@ -122,25 +122,25 @@ def main():
122122 # Check the Tree-SHA512
123123 if (verify_tree or prev_commit == "" ) and current_commit not in incorrect_sha512_allowed :
124124 tree_hash = tree_sha512sum (current_commit )
125- if ("Tree-SHA512: {}" .format (tree_hash )) not in subprocess .check_output ([GIT , 'show' , '-s' , '--format=format:%B' , current_commit ], universal_newlines = True , encoding = 'utf8' ).splitlines ():
125+ if ("Tree-SHA512: {}" .format (tree_hash )) not in subprocess .check_output ([GIT , 'show' , '-s' , '--format=format:%B' , current_commit ]). decode ( 'utf8' ).splitlines ():
126126 print ("Tree-SHA512 did not match for commit " + current_commit , file = sys .stderr )
127127 sys .exit (1 )
128128
129129 # Merge commits should only have two parents
130- parents = subprocess .check_output ([GIT , 'show' , '-s' , '--format=format:%P' , current_commit ], universal_newlines = True , encoding = 'utf8' ).splitlines ()[0 ].split (' ' )
130+ parents = subprocess .check_output ([GIT , 'show' , '-s' , '--format=format:%P' , current_commit ]). decode ( 'utf8' ).splitlines ()[0 ].split (' ' )
131131 if len (parents ) > 2 :
132132 print ("Commit {} is an octopus merge" .format (current_commit ), file = sys .stderr )
133133 sys .exit (1 )
134134
135135 # Check that the merge commit is clean
136- commit_time = int (subprocess .check_output ([GIT , 'show' , '-s' , '--format=format:%ct' , current_commit ], universal_newlines = True , encoding = 'utf8' ).splitlines ()[0 ])
136+ commit_time = int (subprocess .check_output ([GIT , 'show' , '-s' , '--format=format:%ct' , current_commit ]). decode ( 'utf8' ).splitlines ()[0 ])
137137 check_merge = commit_time > time .time () - args .clean_merge * 24 * 60 * 60 # Only check commits in clean_merge days
138138 allow_unclean = current_commit in unclean_merge_allowed
139139 if len (parents ) == 2 and check_merge and not allow_unclean :
140- current_tree = subprocess .check_output ([GIT , 'show' , '--format=%T' , current_commit ], universal_newlines = True , encoding = 'utf8' ).splitlines ()[0 ]
140+ current_tree = subprocess .check_output ([GIT , 'show' , '--format=%T' , current_commit ]). decode ( 'utf8' ).splitlines ()[0 ]
141141 subprocess .call ([GIT , 'checkout' , '--force' , '--quiet' , parents [0 ]])
142142 subprocess .call ([GIT , 'merge' , '--no-ff' , '--quiet' , '--no-gpg-sign' , parents [1 ]], stdout = subprocess .DEVNULL )
143- recreated_tree = subprocess .check_output ([GIT , 'show' , '--format=format:%T' , 'HEAD' ], universal_newlines = True , encoding = 'utf8' ).splitlines ()[0 ]
143+ recreated_tree = subprocess .check_output ([GIT , 'show' , '--format=format:%T' , 'HEAD' ]). decode ( 'utf8' ).splitlines ()[0 ]
144144 if current_tree != recreated_tree :
145145 print ("Merge commit {} is not clean" .format (current_commit ), file = sys .stderr )
146146 subprocess .call ([GIT , 'diff' , current_commit ])
0 commit comments