X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=set-commit-date.py;h=71594ae3899e896a2d50901d7bf873178b7fdf0c;hb=3d9718102201b0be6ab314ca7a336d8791aba6b2;hp=9588bd87aa26e991006637b3e7779c2df82ffa99;hpb=be308b7b8c887a71e26a8044bba3b334487452b5;p=git-scripts.git diff --git a/set-commit-date.py b/set-commit-date.py index 9588bd8..71594ae 100755 --- a/set-commit-date.py +++ b/set-commit-date.py @@ -13,12 +13,13 @@ separator = '----- GIT LOG SEPARATOR -----' git_log = subprocess.Popen(['git', 'log', '-m', '--first-parent', '--name-only', '--no-color', '--format=%s%%n%%ct' % separator], - stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + stdout=subprocess.PIPE, stderr=subprocess.STDOUT, + universal_newlines=True) filenames = set() # stages: 1 - start of commit, 2 - timestamp, 3 - empty line, 4 - files stage = 1 -while True: - line = git_log.stdout.readline().strip() +for line in git_log.stdout: + line = line.strip() if (stage in (1, 4)) and (line == separator): # Start of a commit stage = 2 elif stage == 2: @@ -30,8 +31,6 @@ while True: continue stage = 4 assert line == '', line - elif not line: # EOF - break elif stage == 4: filename = line if filename not in filenames: