Reputation: 106549
I need a license block:
// Copyright Billy O'Neal 2010 // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt)
to be embedded in all of my source files. I'm worried that I might have missed one or more of these files, and I don't want to release the source to my library without these. Is there an easy way to look at a project and dump all files which don't have such a block?
Bonus points for a way to hook this into Mercurial so that a commit cannot succeed if there are files with missing licenses.
(I've got lots of tools which will find the blocks, but no tools which will find the missing ones)
Upvotes: 2
Views: 198
Reputation: 1324837
Basically, you need to combine:
hg log --keyword
, which "do case-insensitive search for a given text" (see "hg log")find $(hg root) -type f -name '*.cpp' | xargs grep --files-without-match LICENSE_1_0.txt
Upvotes: 4