| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """A database of OWNERS files. | 5 """A database of OWNERS files. |
| 6 | 6 |
| 7 OWNERS files indicate who is allowed to approve changes in a specific directory | 7 OWNERS files indicate who is allowed to approve changes in a specific directory |
| 8 (or who is allowed to make changes without needing approval of another OWNER). | 8 (or who is allowed to make changes without needing approval of another OWNER). |
| 9 Note that all changes must still be reviewed by someone familiar with the code, | 9 Note that all changes must still be reviewed by someone familiar with the code, |
| 10 so you may need approval from both an OWNER and a reviewer in many cases. | 10 so you may need approval from both an OWNER and a reviewer in many cases. |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 continue | 217 continue |
| 218 if line == 'set noparent': | 218 if line == 'set noparent': |
| 219 self.stop_looking.add(dirpath) | 219 self.stop_looking.add(dirpath) |
| 220 continue | 220 continue |
| 221 | 221 |
| 222 m = re.match("per-file (.+)=(.+)", line) | 222 m = re.match("per-file (.+)=(.+)", line) |
| 223 if m: | 223 if m: |
| 224 glob_string = m.group(1) | 224 glob_string = m.group(1) |
| 225 directive = m.group(2) | 225 directive = m.group(2) |
| 226 full_glob_string = self.os_path.join(self.root, dirpath, glob_string) | 226 full_glob_string = self.os_path.join(self.root, dirpath, glob_string) |
| 227 if self.os_path.sep in glob_string: | 227 if '/' in glob_string or '\\' in glob_string: |
| 228 raise SyntaxErrorInOwnersFile(owners_path, lineno, | 228 raise SyntaxErrorInOwnersFile(owners_path, lineno, |
| 229 'per-file globs cannot span directories: "%s"' % line) | 229 'per-file globs cannot span directories or use escapes: "%s"' % |
| 230 line) |
| 230 baselines = self.glob(full_glob_string) | 231 baselines = self.glob(full_glob_string) |
| 231 for baseline in (self.os_path.relpath(b, self.root) for b in baselines): | 232 for baseline in (self.os_path.relpath(b, self.root) for b in baselines): |
| 232 self._add_entry(baseline, directive, "per-file line", | 233 self._add_entry(baseline, directive, "per-file line", |
| 233 owners_path, lineno) | 234 owners_path, lineno) |
| 234 continue | 235 continue |
| 235 | 236 |
| 236 if line.startswith('set '): | 237 if line.startswith('set '): |
| 237 raise SyntaxErrorInOwnersFile(owners_path, lineno, | 238 raise SyntaxErrorInOwnersFile(owners_path, lineno, |
| 238 'unknown option: "%s"' % line[4:].strip()) | 239 'unknown option: "%s"' % line[4:].strip()) |
| 239 | 240 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 break | 300 break |
| 300 | 301 |
| 301 final_owners.add(max_owner) | 302 final_owners.add(max_owner) |
| 302 | 303 |
| 303 # Remove all directories owned by the current owner from the remaining | 304 # Remove all directories owned by the current owner from the remaining |
| 304 # list. | 305 # list. |
| 305 for dirname in owned_dirs[max_owner]: | 306 for dirname in owned_dirs[max_owner]: |
| 306 dirs.discard(dirname) | 307 dirs.discard(dirname) |
| 307 | 308 |
| 308 return final_owners | 309 return final_owners |
| OLD | NEW |