From: Oleg Broytman Date: Fri, 27 Apr 2018 21:41:01 +0000 (+0300) Subject: Refactor(set-commit-date.py): Use git_log.stdout as an iterator X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=3929127d65ddc5d676862e9a514c26b655221900;p=git-scripts.git Refactor(set-commit-date.py): Use git_log.stdout as an iterator --- diff --git a/set-commit-date.py b/set-commit-date.py index dc6a5fb..71594ae 100755 --- a/set-commit-date.py +++ b/set-commit-date.py @@ -18,10 +18,7 @@ git_log = subprocess.Popen(['git', 'log', '-m', '--first-parent', filenames = set() # stages: 1 - start of commit, 2 - timestamp, 3 - empty line, 4 - files stage = 1 -while True: - line = git_log.stdout.readline() - if not line: # EOF - break +for line in git_log.stdout: line = line.strip() if (stage in (1, 4)) and (line == separator): # Start of a commit stage = 2