@@ -91,7 +91,7 @@ def main():
91
91
no_sha1 = True
92
92
prev_commit = ""
93
93
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 ]
95
95
96
96
# Iterate through commits
97
97
while True :
@@ -112,7 +112,7 @@ def main():
112
112
if prev_commit != "" :
113
113
print ("No parent of {} was signed with a trusted key!" .format (prev_commit ), file = sys .stderr )
114
114
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 (' ' )
116
116
for parent in parents :
117
117
subprocess .call ([GIT , 'show' , '-s' , parent ], stdout = sys .stderr )
118
118
else :
@@ -122,25 +122,25 @@ def main():
122
122
# Check the Tree-SHA512
123
123
if (verify_tree or prev_commit == "" ) and current_commit not in incorrect_sha512_allowed :
124
124
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 ():
126
126
print ("Tree-SHA512 did not match for commit " + current_commit , file = sys .stderr )
127
127
sys .exit (1 )
128
128
129
129
# 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 (' ' )
131
131
if len (parents ) > 2 :
132
132
print ("Commit {} is an octopus merge" .format (current_commit ), file = sys .stderr )
133
133
sys .exit (1 )
134
134
135
135
# 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 ])
137
137
check_merge = commit_time > time .time () - args .clean_merge * 24 * 60 * 60 # Only check commits in clean_merge days
138
138
allow_unclean = current_commit in unclean_merge_allowed
139
139
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 ]
141
141
subprocess .call ([GIT , 'checkout' , '--force' , '--quiet' , parents [0 ]])
142
142
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 ]
144
144
if current_tree != recreated_tree :
145
145
print ("Merge commit {} is not clean" .format (current_commit ), file = sys .stderr )
146
146
subprocess .call ([GIT , 'diff' , current_commit ])
0 commit comments