[devtools] Use git pretty-format for year parsing

This commit is contained in:
MarcoFalke 2015-12-26 17:18:35 +01:00
parent fa24439ff3
commit fa71669452

View file

@ -16,7 +16,7 @@ import time
import re
year = time.gmtime()[0]
CMD_GIT_DATE = "git log %s | grep Date | head -n 1"
CMD_GIT_DATE = 'git log --format=@%%at -1 %s | date +"%%Y" -u -f -'
CMD_REGEX= "perl -pi -e 's/(20\d\d)(?:-20\d\d)? The Bitcoin/$1-%s The Bitcoin/' %s"
REGEX_CURRENT= re.compile("%s The Bitcoin" % year)
CMD_LIST_FILES= "find %s | grep %s"
@ -38,7 +38,7 @@ for folder in FOLDERS:
file_path = os.getcwd() + file_path[1:-1]
if file_path.endswith(extension):
git_date = get_git_date(file_path)
if len(git_date) > 0 and str(year) in git_date:
if str(year) == git_date:
# Only update if current year is not found
if REGEX_CURRENT.search(open(file_path, "r").read()) is None:
print n,"Last git edit", git_date, "-", file_path