[p4] Find old dead code?

Peter Stephenson pws at csr.com
Tue Oct 30 02:48:04 PDT 2007


On Mon, 29 Oct 2007 23:08:55 -0400
Roy Smith <smith_roy at emc.com> wrote:
> I want to clean out some old dead code, i.e. blocks which are  
> surrounded by
> 
> #if 0
> [...]
> #endif
> 
> Finding all the #if 0 lines is easy with grep.  What's a bit more  
> complicated is finding all the *old* ones.  Say, older than a year  
> (i.e. I'll put up with such sillyness, as long as it's recent; humor  
> me on that for the moment).  Perforce certainly has the information  
> needed to perform that query, but is there any reasonable way to  
> script doing this?

The attached Perl script "p4annotate.pl" behaves like "p4 annotate" but
takes an additional format option: "p4annotate.pl -f %d <file>" should do
what you want.  It doesn't need the Perl API, just the p4 command.

It's so old I can't even remember if I wrote it or it fell off the back of
a lorry.

-- 
Peter Stephenson <pws at csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


More information about the perforce-user mailing list