Page MenuHomeWildfire Games

Script to auto update year for all modified files
Needs ReviewPublic

Authored by vladislavbelov on Jan 18 2019, 9:45 PM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Summary

Subj. Currently only for SVN. Requires https://pypi.python.org/pypi/svn. Installation:

pip install svn

Plans:

  • Add Git support (should be easy).
  • Add command line params for more flexible configuration.
Test Plan
  1. Make some modifications in repo.
  2. Run the script (python license_year.py or double-click on it in explorer).

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Lint Skipped
Unit
Unit Tests Skipped
Build Status
Buildable 6818
Build 11212: Vulcan BuildJenkins

Event Timeline

vladislavbelov created this revision.
vladislavbelov edited the summary of this revision. (Show Details)
vladislavbelov edited the test plan for this revision. (Show Details)
Vulcan added a subscriber: Vulcan.Jan 18 2019, 9:49 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/differential/983/

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/differential/984/

wraitii added inline comments.
source/tools/hooks/license_year.py
40

s/header/year/ I think?

vladislavbelov marked an inline comment as done.Jan 19 2019, 2:43 PM
vladislavbelov added inline comments.
source/tools/hooks/license_year.py
40

Yeah, you're right.

Stan added a subscriber: Stan.Jan 19 2019, 2:47 PM
Stan added inline comments.
source/tools/hooks/license_year.py
16

c file as well no ?

vladislavbelov marked an inline comment as done.Jan 19 2019, 2:57 PM
vladislavbelov added inline comments.
source/tools/hooks/license_year.py
16

We have only 3 *.c files in our source repo, but I suppose we can add it too :)

Stan added inline comments.Jan 19 2019, 3:00 PM
source/tools/hooks/license_year.py
16

Do we have hpp, tpp, ipp files ? :)

vladislavbelov marked an inline comment as done.Jan 19 2019, 3:03 PM
vladislavbelov added inline comments.
source/tools/hooks/license_year.py
16

I found only *.hpp. I can add most C++ extensions, since we just ignore files without the license (only warn about them).

vladislavbelov marked an inline comment as done.Jan 19 2019, 3:05 PM
vladislavbelov added inline comments.
source/tools/hooks/license_year.py
16

But actually we should one style, so other extensions aren't necessary.

  • s/header/year/
  • add basic C++ headers
  • a little bit of polishing

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/differential/985/

Stan added a subscriber: Itms.Feb 25 2019, 10:01 AM

@Itms any comments on this ? :)

Itms added a comment.Feb 25 2019, 10:14 AM

It's a nice script, but is it useful now that the linter detects those wrong license dates? What would be the use case?

vladislavbelov added a comment.EditedFeb 25 2019, 12:49 PM
In D1753#72433, @Itms wrote:

It's a nice script, but is it useful now that the linter detects those wrong license dates? What would be the use case?

The linter is only checks the year. But the script upgrades it. The case is simple (at least what I use it for): you have a big patch from previous years/you forgot to upgrade years in a big patch. With the script it's not a problem, you don't need a manual work.

My opinion:

  • not that often do we have to change over 20 copyrights... It's a bit annoying but quite doable manually.
  • feels like a bit of a long script for something that can be approximated by (syntax pending) git diff --name-only -- *.cpp | sed -i 's/Copyright ([cC]) 20[0-9][0-9] Wildfire Games/Copyright © 2019 WildfireGames'
  • worst case we can always not change the copyrights

I'm not sure it's worth adding to the repository.

feels like a bit of a long script for something that can be approximated by (syntax pending) git diff --name-only -- *.cpp | sed -i 's/Copyright ([cC]) 20[0-9][0-9] Wildfire Games/Copyright © 2019 WildfireGames'

We use SVN :P

Stan added a comment.May 28 2019, 4:59 PM

IMHO This could be added to the scripts, and anyone free to use it or not.

Or it could run after commits, and make another commit on top of it fixing missing updates.

feels like a bit of a long script for something that can be approximated by (syntax pending) git diff --name-only -- *.cpp | sed -i 's/Copyright ([cC]) 20[0-9][0-9] Wildfire Games/Copyright © 2019 WildfireGames'

We use SVN :P

no we don't :p

Anyways what I'm saying is that I won't commit this, I don't really mind it being committed but it's likely to be forgotten. Have you ever actually used it more than once @vladislavbelov ?

Anyways what I'm saying is that I won't commit this, I don't really mind it being committed but it's likely to be forgotten. Have you ever actually used it more than once @vladislavbelov ?

Sure, I have a bunch of old patches, and sometimes I need to update many headers.

But I don't suggest to commit it, anyone still can use it just download from here.

Stan added a comment.Jan 9 2020, 3:40 PM

This script is useful to me at least :D

Stan added a comment.Dec 15 2021, 7:11 PM

Might add this as pre commit hook if we switch to git