From fa71669452e57039e4270fd2b33a0e0e1635b813 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Sat, 26 Dec 2015 17:18:35 +0100 Subject: [devtools] Use git pretty-format for year parsing --- contrib/devtools/fix-copyright-headers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'contrib/devtools') diff --git a/contrib/devtools/fix-copyright-headers.py b/contrib/devtools/fix-copyright-headers.py index 1262e29acb..b6414a551f 100755 --- a/contrib/devtools/fix-copyright-headers.py +++ b/contrib/devtools/fix-copyright-headers.py @@ -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 -- cgit v1.2.3