Skip to content

Contrib script to accurately update copyright headers

SlowRiot requested to merge SlowRiot/bitcoin-cash-node:copyright_headers into master

There is already a script to update or insert copyright headers in the correct format - copyright_headers.py.

This is a contrib script intended as a helper wrapping around the existing script, intended to allow the script to work on the entire source directory with accurate dates.

Changes

Contrib script contrib/devtools/copyright_headers_update_or_insert.sh

The script works in the following way:

  1. It runs copyright_headers.py on the source tree in update mode
  2. It processes the output to find files that do not have an existing line to update
  3. It filters those files to remove the third party libraries and auto-generated files
  4. It runs copyright_headers.py again on the identified files in insert mode
  5. It reports insertions, or no-changes, in the same format as copyright_headers.py.

Usage: contrib/devtools/copyright_headers_update_or_insert.sh

Changes to contrib/devtools/copyright_header.py

The existing script has been modified to only find changes since the fork commit, 964a185cc83af34587194a6ecda3ed9cf6b49263, so it will not erroneously add new copyright lines for "the bitcoin developers" in duplicate, for changes made in Core before the fork and already marked "the bitcoin core developers".

Output has also had an over-exuberant exclamation mark removed.

Example results:

image

...

image

Future work

A separate MR has been raised to actually update the copyright notices: !1550 (merged)

Test plan

contrib/devtools/copyright_headers_update_or_insert.sh

Examine the git diffs to verify the changes look acceptable. Spot check several files with git log to confirm the newly updated and inserted copyright periods are correct.

Edited by SlowRiot

Merge request reports