Skip to content

Commit b8d9058

Browse files
committed
Merge pull request #3646
5770254 Copyright header updates s/2013/2014 on files whose last git commit was done in 2014. contrib/devtools/fix-copyright-headers.py script to be able to perform this maintenance task with ease during the rest of the year, every year. Modifications to contrib/devtools/README.md to document what fix-copyright-headers.py does. (gubatron)
2 parents 25d8161 + 5770254 commit b8d9058

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+114
-50
lines changed

contrib/devtools/README.md

Lines changed: 11 additions & 0 deletions
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/usr/bin/env python
2+
'''
3+
Run this script inside of src/ and it will look for all the files
4+
that were changed this year that still have the last year in the
5+
copyright headers, and it will fix the headers on that file using
6+
a perl regex one liner.
7+
8+
For example: if it finds something like this and we're in 2014
9+
10+
// Copyright (c) 2009-2013 The Bitcoin developers
11+
12+
it will change it to
13+
14+
// Copyright (c) 2009-2014 The Bitcoin developers
15+
16+
It will do this for all the files in the folder and its children.
17+
18+
Author: @gubatron
19+
'''
20+
import os
21+
import time
22+
23+
year = time.gmtime()[0]
24+
last_year = year - 1
25+
command = "perl -pi -e 's/%s The Bitcoin/%s The Bitcoin/' %s"
26+
listFilesCommand = "find . | grep %s"
27+
28+
extensions = [".cpp",".h"]
29+
30+
def getLastGitModifiedDate(filePath):
31+
gitGetLastCommitDateCommand = "git log " + filePath +" | grep Date | head -n 1"
32+
p = os.popen(gitGetLastCommitDateCommand)
33+
result = ""
34+
for l in p:
35+
result = l
36+
break
37+
result = result.replace("\n","")
38+
return result
39+
40+
n=1
41+
for extension in extensions:
42+
foundFiles = os.popen(listFilesCommand % extension)
43+
for filePath in foundFiles:
44+
filePath = filePath[1:-1]
45+
if filePath.endswith(extension):
46+
filePath = os.getcwd() + filePath
47+
modifiedTime = getLastGitModifiedDate(filePath)
48+
if len(modifiedTime) > 0 and str(year) in modifiedTime:
49+
print n,"Last Git Modified: ", modifiedTime, " - ", filePath
50+
os.popen(command % (last_year,year,filePath))
51+
n = n + 1
52+
53+

src/alert.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright (c) 2010 Satoshi Nakamoto
2-
// Copyright (c) 2009-2013 The Bitcoin developers
2+
// Copyright (c) 2009-2014 The Bitcoin developers
33
// Distributed under the MIT/X11 software license, see the accompanying
44
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

src/chainparams.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright (c) 2010 Satoshi Nakamoto
2-
// Copyright (c) 2009-2013 The Bitcoin developers
2+
// Copyright (c) 2009-2014 The Bitcoin developers
33
// Distributed under the MIT/X11 software license, see the accompanying
44
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

src/core.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright (c) 2009-2010 Satoshi Nakamoto
2-
// Copyright (c) 2009-2013 The Bitcoin developers
2+
// Copyright (c) 2009-2014 The Bitcoin developers
33
// Distributed under the MIT/X11 software license, see the accompanying
44
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

src/db.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright (c) 2009-2010 Satoshi Nakamoto
2-
// Copyright (c) 2009-2013 The Bitcoin developers
2+
// Copyright (c) 2009-2014 The Bitcoin developers
33
// Distributed under the MIT/X11 software license, see the accompanying
44
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

src/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright (c) 2009-2010 Satoshi Nakamoto
2-
// Copyright (c) 2009-2013 The Bitcoin developers
2+
// Copyright (c) 2009-2014 The Bitcoin developers
33
// Distributed under the MIT/X11 software license, see the accompanying
44
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

src/leveldbwrapper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2012-2013 The Bitcoin developers
1+
// Copyright (c) 2012-2014 The Bitcoin developers
22
// Distributed under the MIT/X11 software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright (c) 2009-2010 Satoshi Nakamoto
2-
// Copyright (c) 2009-2013 The Bitcoin developers
2+
// Copyright (c) 2009-2014 The Bitcoin developers
33
// Distributed under the MIT/X11 software license, see the accompanying
44
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

src/main.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright (c) 2009-2010 Satoshi Nakamoto
2-
// Copyright (c) 2009-2013 The Bitcoin developers
2+
// Copyright (c) 2009-2014 The Bitcoin developers
33
// Distributed under the MIT/X11 software license, see the accompanying
44
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

0 commit comments

Comments
 (0)