]> nv-tegra.nvidia Code Review - linux-3.10.git/commit
scripts/get_maintainer.pl: add --file-emails, find embedded email addresses
authorJoe Perches <joe@perches.com>
Fri, 5 Mar 2010 21:43:00 +0000 (13:43 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 6 Mar 2010 19:26:33 +0000 (11:26 -0800)
commit03372dbbe618bfcd02f9c8cdbfe78e97e3aad43b
tree8b848249ec5d45154fb05c43aa0c7bd34f13d09e
parentcea83886dde49fd7524e9f4a246dd5dff4ad236a
scripts/get_maintainer.pl: add --file-emails, find embedded email addresses

Add an imperfect option to search a source file for email addresses.

New option:  --file-emails or --fe

email addresses in files are freeform text and are nearly impossible to
parse.  Still, might as well try to do a somewhat acceptable job of
finding them.  This code should find all addresses that are in the form
addr@domain.tld

The code assumes that up to 3 alphabetic words along with dashes, commas,
and periods that preceed the email address are a name.

If 3 words are found for the name, and one of the first two words are a
single letter and period, or just a single letter then the 3 words are use
as name otherwise the last 2 words are used.

Some variants that are shown correctly:
    John Smith <jksmith@domain.org>
    Random J. Developer <rjd@tld.com>
    Random J. Developer (rjd@tld.com)
    J. Random Developer rjd@tld.com

Variants that are shown nominally correctly:
    Written by First Last (funny-addr@somecompany.com)
is shown as:
    First Last <funny-addr@somecompany.com>

Variants that are shown incorrectly:
    Some Really Long Name <srln@foo.bar>
    MontaVista Software, Inc. <source@mvista.com>
are returned as:
    Long Name <srln@foo.bar>
    "Software, Inc" <source@mvista.com>

--roles and --rolestats show "(in file)" for matches.

For instance:

Without -file-emails:

$ ./scripts/get_maintainer.pl -f -nogit -roles net/core/netpoll.c
David S. Miller <davem@davemloft.net> (maintainer:NETWORKING [GENERAL])
linux-kernel@vger.kernel.org (open list)

With -fe:

$ ./scripts/get_maintainer.pl -f -fe -nogit -roles net/core/netpoll.c
David S. Miller <davem@davemloft.net> (maintainer:NETWORKING [GENERAL])
Matt Mackall <mpm@selenic.com> (in file)
Ingo Molnar <mingo@redhat.com> (in file)
linux-kernel@vger.kernel.org (open list)
netdev@vger.kernel.org (open list:NETWORKING [GENERAL])

The number of email addresses in the file in not limited.  Neither is the
number of returned email addresses.

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Matt Mackall <mpm@selenic.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/get_maintainer.pl