diff options
author | MarcoFalke <falke.marco@gmail.com> | 2015-12-26 17:18:35 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2015-12-26 17:53:42 +0100 |
commit | fa71669452e57039e4270fd2b33a0e0e1635b813 (patch) | |
tree | 967ec2d96585c215191204251085975951e5ea0b | |
parent | fa24439ff3d8ab5b9efaf66ef4dae6713b88cb35 (diff) |
[devtools] Use git pretty-format for year parsing
-rwxr-xr-x | contrib/devtools/fix-copyright-headers.py | 4 |
1 files changed, 2 insertions, 2 deletions
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 |