Skip to content

Commit

Permalink
[devtools] Use git pretty-format for year parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoFalke committed Dec 26, 2015
1 parent fa24439 commit fa71669
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions contrib/devtools/fix-copyright-headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
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"
Expand All @@ -38,7 +38,7 @@ def get_git_date(file_path):
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
Expand Down

0 comments on commit fa71669

Please sign in to comment.