Loading...
 
Skip to main content

Source Code Copyright Change Info


Here are some notes about how to change the copyright comments in the source code which need updating every year. Thanks Jyhem for doing this and providing this info!

Jean-Marc Libs wrote:
Well, it's not scripts, it's just command line trickery. I can explain from my bash history, though.


For a grep command which does not get in useless directories

Copy to clipboard
alias greps='grep --exclude-dir=.svn --exclude-dir='\''unified-*'\'''


Last year I found it tedious to look for the about half dozen ways of writing the copyright line and normalize them. This year it paid off. I looked for different ways and only found one file:

Copy to clipboard
greps -r 'Copyright 2002-2014' * | grep -v 'by authors of the Tiki Wiki CMS Groupware Project'

So I copied a standard copyright line to the file.

Then I changed them all:

Copy to clipboard
greps -rl 'Copyright 2002-2014 by authors of the Tiki' * | xargs perl -pi.bak -e 's/Copyright 2002-2014 by authors of the Tiki Wiki CMS Groupware Project/Copyright 2002-2015 by authors of the Tiki Wiki CMS Groupware Project/'


As it looked good, I cleaned up

Copy to clipboard
find . -name "*.bak" | xargs \rm


Now comes the hard part: committing everything at once nearly always fails at the Sourceforge level, so it needs to be restarted, or split in smaller parts, etc.
So I just commit bunches of 200 files and again and again nearly forever. This can be vastly improved (20 is about right. It should be calculated from the results of «svn status | wc -l » divided by 200, rounded up)

Copy to clipboard
for((i=0;i<20;i++)); do svn up; svn status | grep "^M" | sed -e 's/^M *//' | tail -n 200 | xargs svn commit --username jyhem --password 'xxxxx' -m "Copyright bumped to 2015 Happy new year (again)"; done


...and as we are semi-automatic merging currently (note, do it before branching next time! 😉) i'll need to commit the merge in the same way.

Copy to clipboard
for((i=0;i<20;i++)); do svn up; svn status | grep "^M" | sed -e 's/^M *//' | tail -n 200 | xargs svn commit --username jonnybradley --password 'xxxxx' -m "[MRG] Automatic merge, branches/15.x 57934 to 57955 (batch commit)"; done

Jean-Marc Libs wrote:

It's easier done than automated, honestly. Anyone interested is welcome to document it somewhere.

Cheers,
J-M



I feel strongly this should not be done on a yearly basis. It creates pollution in commit logs, and wastes everyone's time for no real benefit.

Show PHP error messages