You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Jason Aubrey <au...@gmail.com> on 2011/08/10 18:06:47 UTC

Adding license text to files

Hi All,

I'd like to use keyword substitution or something like it to
automatically append/update license information in a large collection
of files. In other words, I'd like the licensing information to be a
property of the file, but also appear as text in the file.  I can do
the former with properties, but can't see how to do the latter in some
automatic easy way. (Also, ideally, the license text in the file would
come from the property on the file. )

Is it possible to do this? I haven't yet deduced how to do this from
the svn book.

Thanks for any help you can provide,

Jason

Re: Adding license text to files

Posted by Thorsten Schöning <ts...@am-soft.de>.
Guten Tag Jason Aubrey,
am Mittwoch, 10. August 2011 um 18:06 schrieben Sie:

> I'd like to use keyword substitution or something like it to
> automatically append/update license information in a large collection
> of files. In other words, I'd like the licensing information to be a
> property of the file, but also appear as text in the file.  I can do
> the former with properties, but can't see how to do the latter in some
> automatic easy way. (Also, ideally, the license text in the file would
> come from the property on the file. )

As already said, this is not possible without doing on your own, but
besides that, what's the benefit of having the license text as a
property on each file, which gets substituted into the file, over
having the text directly versioned in the file? If I understand you
right, you would have to change the property of each file for changing
the license text which doesn't seem easier that replacing the text
directly in the file with some text replacement tool. In my opinion
the property approach is even less handy because you don't have things
like blame and diffs where you can see who changed what line of the
license and why.

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning
AM-SoFT IT-Systeme - Hameln | Potsdam | Leipzig
 
Telefon: Potsdam: 0331-743881-0
E-Mail:  tschoening@am-soft.de
Web:     http://www.am-soft.de

AM-SoFT GmbH IT-Systeme, Konsumhof 1-5, 14482 Potsdam
Amtsgericht Potsdam HRB 21278 P, Geschäftsführer: Andreas Muchow


AW: Adding license text to files

Posted by Markus Schaber <m....@3s-software.com>.
Hi, Jason,

Jason Aubrey [mailto:aubreyja@gmail.com]
> 
> I'd like to use keyword substitution or something like it to automatically
> append/update license information in a large collection of files. In other
> words, I'd like the licensing information to be a property of the file,
> but also appear as text in the file.  I can do the former with properties,
> but can't see how to do the latter in some automatic easy way. (Also,
> ideally, the license text in the file would come from the property on the
> file. )
> 
> Is it possible to do this? I haven't yet deduced how to do this from the
> svn book.

All you can do from subversion itself is to create a pre-commit hook which refuses commits which don't have that license in place. You then can write a tool or script which users run on the working copies before committing. (Some clients like TortoiseSVN provide client-side pre-commit hooks, so you can automate this step.)

Another solution would be a cron job (or windows task planner) which checks out the HEAD, fixes all files, and commits them back to the repository. This approach is less intrusive, but the revisions without license will be available in the repository.

Mit freundlichen Grüßen

Markus Schaber

___________________________
We software Automation.

3S-Smart Software Solutions GmbH
Markus Schaber | Entwicklung
Memminger Str. 151 | 87439 Kempten | Tel. +49-831-54031-0 | Fax +49-831-54031-50

Email: m.schaber@3s-software.com | Web: http://www.3s-software.com 
CoDeSys Internet-Forum: http://forum.3s-software.com

Geschäftsführer: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Handelsregister: Kempten HRB 6186 | USt-IDNr.: DE 167014915


Re: Adding license text to files

Posted by Jason Aubrey <au...@gmail.com>.
Thanks all for you very helpful suggestions.

Thanks again,
Jason

Re: Adding license text to files

Posted by Ulrich Eckhardt <ul...@dominolaser.com>.
On Wednesday 10 August 2011, Jason Aubrey wrote:
> I'd like to use keyword substitution or something like it to
> automatically append/update license information in a large collection
> of files. In other words, I'd like the licensing information to be a
> property of the file, but also appear as text in the file.  I can do
> the former with properties, but can't see how to do the latter in some
> automatic easy way. (Also, ideally, the license text in the file would
> come from the property on the file. )

You discovered yourself that you can set arbitrary properties on a file and 
others already mentioned that you can't use this to expand keywords. What you 
can do though is to create a script that checks the license property and 
substitutes a placeholder in the file or prepends a header. What this doesn't 
achieve is that anybody checking out will see the license. That said, even SVN 
keyword substitution is performed on client-side, so it can be circumvented. 

There is another thing that comes to mind. You could include a text stanza 
like "see 'license.text' for licensing details" to the file and then use 
svn:external to reference the file from somewhere else. That would allow 
changing the license without having to touch hundreds of files.

Cheers!

Uli

-- 
ML: http://subversion.apache.org/docs/community-guide/mailing-lists.html
FAQ: http://subversion.apache.org/faq.html
Docs: http://svnbook.red-bean.com/

**************************************************************************************
Domino Laser GmbH, Fangdieckstra�e 75a, 22547 Hamburg, Deutschland
Gesch�ftsf�hrer: Thorsten F�cking, Amtsgericht Hamburg HR B62 932
**************************************************************************************
Visit our website at http://www.dominolaser.com
**************************************************************************************
Diese E-Mail einschlie�lich s�mtlicher Anh�nge ist nur f�r den Adressaten bestimmt und kann vertrauliche Informationen enthalten. Bitte benachrichtigen Sie den Absender umgehend, falls Sie nicht der beabsichtigte Empf�nger sein sollten. Die E-Mail ist in diesem Fall zu l�schen und darf weder gelesen, weitergeleitet, ver�ffentlicht oder anderweitig benutzt werden.
E-Mails k�nnen durch Dritte gelesen werden und Viren sowie nichtautorisierte �nderungen enthalten. Domino Laser GmbH ist f�r diese Folgen nicht verantwortlich.
**************************************************************************************


Re: Adding license text to files

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Aug 10, 2011, at 11:06, Jason Aubrey wrote:

> I'd like to use keyword substitution or something like it to
> automatically append/update license information in a large collection
> of files. In other words, I'd like the licensing information to be a
> property of the file, but also appear as text in the file.  I can do
> the former with properties, but can't see how to do the latter in some
> automatic easy way. (Also, ideally, the license text in the file would
> come from the property on the file. )
> 
> Is it possible to do this? I haven't yet deduced how to do this from
> the svn book.

Subversion doesn't have this feature. Subversion keyword substitution is not expandable by the user; you can't define your own keywords or change how the existing keywords behave.