Accept the "file:(project:)?filePath" directive.

Test: checkowners.py some_owner_files
Bug: 126777637
Bug: 126761563
Change-Id: Iee03521681bc38fa28970a015058e1eba3c8b87a
This commit is contained in:
Chih-Hung Hsieh 2019-03-04 15:13:20 -08:00
parent cf9509df01
commit cc47729719

View file

@ -52,12 +52,13 @@ def main():
noparent = 'set +noparent'
email = '([^@ ]+@[^ @]+|\\*)'
emails = '(%s( *, *%s)*)' % (email, email)
directive = '(%s|%s)' % (emails, noparent)
file_directive = 'file: *([^ :]+ *: *)?[^ ]+'
directive = '(%s|%s|%s)' % (emails, noparent, file_directive)
glob = '[a-zA-Z0-9_\\.\\-\\*\\?]+'
globs = '(%s( *, *%s)*)' % (glob, glob)
perfile = 'per-file +' + globs + ' *= *' + directive
include = 'include +([^ :]+ *: *)?[^ ]+'
pats = '(|%s|%s|%s|%s)$' % (noparent, email, perfile, include)
pats = '(|%s|%s|%s|%s|%s)$' % (noparent, email, perfile, include, file_directive)
patterns = re.compile(pats)
address_pattern = re.compile('([^@ ]+@[^ @]+)')
perfile_pattern = re.compile('per-file +.*=(.*)')