From cc477297199786e6c49def016355daa2953742b1 Mon Sep 17 00:00:00 2001 From: Chih-Hung Hsieh Date: Mon, 4 Mar 2019 15:13:20 -0800 Subject: [PATCH] Accept the "file:(project:)?filePath" directive. Test: checkowners.py some_owner_files Bug: 126777637 Bug: 126761563 Change-Id: Iee03521681bc38fa28970a015058e1eba3c8b87a --- tools/checkowners.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/checkowners.py b/tools/checkowners.py index 7f0396880..d6853d8e8 100755 --- a/tools/checkowners.py +++ b/tools/checkowners.py @@ -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 +.*=(.*)')