Browse Source

[devtools] Use git pretty-format for year parsing

0.13
MarcoFalke 9 years ago
parent
commit
fa71669452
  1. 4
      contrib/devtools/fix-copyright-headers.py

4
contrib/devtools/fix-copyright-headers.py

@ -16,7 +16,7 @@ import time @@ -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: @@ -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

Loading…
Cancel
Save