1
0
Fork 0

adding flush after every print

so it appears in the Jenkins logs
This commit is contained in:
Christian Kühnel 2020-05-08 15:36:13 +02:00
parent 8ea2a3b846
commit 510ed904f8

View file

@ -22,6 +22,7 @@ import git
import operator import operator
import os import os
import re import re
import sys
from typing import List from typing import List
@ -40,9 +41,11 @@ def delete_old_branches(repo_path: str, max_age: datetime.datetime, branch_patte
committed_date = datetime.datetime.fromtimestamp(reference.commit.committed_date) committed_date = datetime.datetime.fromtimestamp(reference.commit.committed_date)
if committed_date < max_age and _has_pattern_match(reference.name, branch_patterns): if committed_date < max_age and _has_pattern_match(reference.name, branch_patterns):
if dry_run: if dry_run:
print('dryrun: would have deleted {}'.format(reference.name)) print('dryrun: would have been deleted {}'.format(reference.name))
sys.stdout.flush()
else: else:
print('Deleting {}'.format(reference.name)) print('Deleting {}'.format(reference.name))
sys.stdout.flush()
remote.push(refspec=':{}'.format(reference.remote_head)) remote.push(refspec=':{}'.format(reference.remote_head))
del_count += 1 del_count += 1