@@ -24,21 +24,64 @@ the script should be called from the git root folder as follows.
24
24
```
25
25
git diff -U0 HEAD~1.. | ./contrib/devtools/clang-format-diff.py -p1 -i -v
26
26
```
27
+ copyright\_ header.py
28
+ ====================
27
29
28
- fix- copyright- headers.py
29
- ========================
30
+ Provides utilities for managing copyright headers of `The Bitcoin Core
31
+ developers` in repository source files. It has three subcommands:
30
32
31
- Every year newly updated files need to have its copyright headers updated to reflect the current year.
32
- If you run this script from the root folder it will automatically update the year on the copyright header for all
33
- source files if these have a git commit from the current year.
33
+ ```
34
+ $ ./copyright_header.py report <base_directory> [verbose]
35
+ $ ./copyright_header.py update <base_directory>
36
+ $ ./copyright_header.py insert <file>
37
+ ```
38
+ Running these subcommands without arguments displays a usage string.
34
39
35
- For example a file changed in 2015 (with 2015 being the current year):
40
+ copyright\_ header.py report \< base\_ directory\> [ verbose]
41
+ ---------------------------------------------------------
36
42
37
- ``` // Copyright (c) 2009-2013 The Bitcoin Core developers ```
43
+ Produces a report of all copyright header notices found inside the source files
44
+ of a repository. Useful to quickly visualize the state of the headers.
45
+ Specifying ` verbose ` will list the full filenames of files of each category.
38
46
39
- would be changed to:
47
+ copyright\_ header.py update \< base\_ directory\> [ verbose]
48
+ ---------------------------------------------------------
49
+ Updates all the copyright headers of ` The Bitcoin Core developers ` which were
50
+ changed in a year more recent than is listed. For example:
51
+ ```
52
+ // Copyright (c) <firstYear>-<lastYear> The Bitcoin Core developers
53
+ ```
54
+ will be updated to:
55
+ ```
56
+ // Copyright (c) <firstYear>-<lastModifiedYear> The Bitcoin Core developers
57
+ ```
58
+ where ` <lastModifiedYear> ` is obtained from the ` git log ` history.
40
59
41
- ``` // Copyright (c) 2009-2015 The Bitcoin Core developers ```
60
+ This subcommand also handles copyright headers that have only a single year. In
61
+ those cases:
62
+ ```
63
+ // Copyright (c) <year> The Bitcoin Core developers
64
+ ```
65
+ will be updated to:
66
+ ```
67
+ // Copyright (c) <year>-<lastModifiedYear> The Bitcoin Core developers
68
+ ```
69
+ where the update is appropriate.
70
+
71
+ copyright\_ header.py insert \< file\>
72
+ ------------------------------------
73
+ Inserts a copyright header for ` The Bitcoin Core developers ` at the top of the
74
+ file in either Python or C++ style as determined by the file extension. If the
75
+ file is a Python file and it has ` #! ` starting the first line, the header is
76
+ inserted in the line below it.
77
+
78
+ The copyright dates will be set to be ` <year_introduced>-<current_year> ` where
79
+ ` <year_introduced> ` is according to the ` git log ` history. If
80
+ ` <year_introduced> ` is equal to ` <current_year> ` , it will be set as a single
81
+ year rather than two hyphenated years.
82
+
83
+ If the file already has a copyright for ` The Bitcoin Core developers ` , the
84
+ script will exit.
42
85
43
86
gen-manpages.sh
44
87
===============
0 commit comments